It may be difficult for readers to retrieve an article in the case if there are many articles in your site, therefore, we added the search feature.
Prerequisites
First of all, we need to append JSON to the home outputs in the configuration file.
1[outputs]
2 home = ["HTML", "RSS", "JSON"]
This step generates an index file
index.json, in order to retrieve content by JavaScript.
Secondary, create a page called search/_index.md in the content directory.
1+++
2title = "Search"
3layout = "search"
4+++
Site Parameters
| Name | Type | Default | Description |
|---|---|---|---|
search | Object | - | Search configuration. |
search.paginate | Integer | 10 | Pagination. |
search.resultContentWordCount | Integer | 240 | The maximum word count of result content for displaying. |
search.fuse | Object | - | Fuse.js options. |
search.fuse.ignoreLocation | Boolean | true | |
search.fuse.location | Integer | - | |
search.fuse.isCaseSensitive | Boolean | - | |
search.fuse.minMatchCharLength | Integer | - | |
search.fuse.threshold | Double | - | |
search.fuse.distance | Integer | - | |
search.fuse.useExtendedSearch | Boolean | - |
Comments