mirror of
https://github.com/imfing/hextra.git
synced 2025-06-19 17:51:23 -04:00
feat(search): support different search index types (#145)
* add support for different search index types: `content | summary | heading | title` * resolves #139
This commit is contained in:
@ -198,6 +198,37 @@ By default, the page width is set to `normal`.
|
||||
|
||||
Similarly, the width of the navbar and footer can be customized by the `params.navbar.width` and `params.footer.width` parameters.
|
||||
|
||||
### Search Index
|
||||
|
||||
Full-text search powered by [FlexSearch](https://github.com/nextapps-de/flexsearch) is enabled by default.
|
||||
To customize the search index, set the `params.search.flexsearch.index` parameter in the config file:
|
||||
|
||||
```yaml {filename="hugo.yaml"}
|
||||
params:
|
||||
# Search
|
||||
search:
|
||||
enable: true
|
||||
type: flexsearch
|
||||
|
||||
flexsearch:
|
||||
# index page by: content | summary | heading | title
|
||||
index: content
|
||||
```
|
||||
|
||||
available options for `flexsearch.index`:
|
||||
- `content` - full content of the page (default)
|
||||
- `summary` - summary of the page, see [Hugo Content Summaries](https://gohugo.io/content-management/summaries/) for more details
|
||||
- `heading` - level 1 and level 2 headings
|
||||
- `title` - only include the page title
|
||||
|
||||
To exclude a page from the search index, set the `excludeSearch: true` in the front matter of the page:
|
||||
|
||||
```yaml {filename="content/docs/guide/configuration.md"}
|
||||
---
|
||||
title: Configuration
|
||||
excludeSearch: true
|
||||
---
|
||||
```
|
||||
|
||||
### Google Analytics
|
||||
|
||||
|
@ -117,8 +117,15 @@ params:
|
||||
displayUpdatedDate: true
|
||||
dateFormat: "January 2, 2006"
|
||||
|
||||
# Search
|
||||
# flexsearch is enabled by default
|
||||
search:
|
||||
enable: true
|
||||
type: flexsearch
|
||||
|
||||
flexsearch:
|
||||
# index page by: content | summary | heading | title
|
||||
index: content
|
||||
|
||||
editURL:
|
||||
enable: true
|
||||
|
Reference in New Issue
Block a user