Skip to content

Commit

Permalink
add a search page
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui committed Sep 18, 2023
1 parent c92de9e commit 67605e4
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions exampleSite/content/search.md
@@ -0,0 +1,40 @@
---
title: Search
menu:
main:
weight: 4
---

The searching is performed via fuse.js. For the search keywords, white spaces act as the `AND` operator, and `|` acts as the `OR` operator. To match an exact phrase, double quote it. For example, `R Markdown` matches articles that contain both `R` and `Markdown`, `R | Markdown` matches articles that contain `R` or `Markdown`, and `"R Markdown"` matches articles that contain the whole phrase `R Markdown`.

<style type="text/css">
.main {
width: 100%;
}
#search-input {
width: 100%;
font-size: 1.2em;
padding: .5em;
}
.search-results b {
background-color: yellow;
}
.search-preview {
margin-left: 2em;
}
.single .main a, .single .main h2 {
border-bottom: none;
}
</style>

<input type="search" id="search-input">

<div class="search-results">
<section>
<h2 class="toc-line"><a target="_blank"></a><span class="dots"></span><span class="page-num small"></span></h2>
<div class="search-preview"></div>
</section>
</div>

<script src="https://cdn.jsdelivr.net/npm/fuse.js@6.6.2" defer></script>
<script src="https://cdn.jsdelivr.net/npm/@xiee/utils/js/fuse-search.min.js" defer></script>

0 comments on commit 67605e4

Please sign in to comment.