Hugo 搜索模块可用的站点和页面参数列表。
hugo.yaml
1params:
2 search:
3 stall_threshold: 200
hugo.toml
1[params]
2 [params.search]
3 stall_threshold = 200
hugo.json
1{
2 "params": {
3 "search": {
4 "stall_threshold": 200
5 }
6 }
7}
case_sensitive
Indicates whether comparisons should be case sensitive.
Name | Type | Default | Required |
---|---|---|---|
case_sensitive | boolean | false | - |
distance
Determines how close the match must be to the fuzzy location (specified by location). An exact letter match which is distance characters away from the fuzzy location would score as a complete mismatch. A distance of 0 requires the match be at the exact location specified. A distance of 1000
would require a perfect match to be within 800
characters of the location to be found using a threshold of 0.8
.
Name | Type | Default | Required |
---|---|---|---|
distance | number | 100 | - |
expand_results_meta
When true
, expand the results meta by default.
Name | Type | Default | Required |
---|---|---|---|
expand_results_meta | boolean | false | - |
filter_taxonomies
Whether to enable the taxonomies filter.
Name | Type | Default | Required |
---|---|---|---|
filter_taxonomies | boolean | true | - |
filter_years
Whether to enable the years filter.
Name | Type | Default | Required |
---|---|---|---|
filter_years | boolean | true | - |
ignore_location
When true, search will ignore location and distance, so it won't matter where in the string the pattern appears.
Name | Type | Default | Required |
---|---|---|---|
ignore_location | boolean | false | - |
index_all_pages
When true
, all pages except noindex
pages will be indexed, include non-regular pages, such as home and taxonomy lists.
Name | Type | Default | Required |
---|---|---|---|
index_all_pages | boolean | true | - |
index_content
When true
, the engine will also search by content, you may need to tweak the distance
parameter as well. Please note that, it may become a performance killer on a large site.
Name | Type | Default | Required |
---|---|---|---|
index_content | boolean | false | - |
lazy_loading
Lazy loading the indices.
Name | Type | Default | Required |
---|---|---|---|
lazy_loading | boolean | true | - |
location
Determines approximately where in the text is the pattern expected to be found.
Name | Type | Default | Required |
---|---|---|---|
location | number | 0 | - |
max_results
Denotes the max number of returned search results.
Name | Type | Default | Required |
---|---|---|---|
max_results | number | 100 | - |
min_match_char_length
Only the matches whose length exceeds this value will be returned. (For instance, if you want to ignore single character matches in the result, set it to 2
).
Name | Type | Default | Required |
---|---|---|---|
min_match_char_length | number | 1 | - |
modal_container
The container for the search modal. It should be a valid CSS selector. Leave it empty if you're using single search page mode only.
Name | Type | Default | Required |
---|---|---|---|
modal_container | string | body | - |
modal_toggle_selector
The search modal toggle selector.
Name | Type | Default | Required |
---|---|---|---|
modal_toggle_selector | string | .search-modal-toggle | - |
paginate
How many results per page, at least 20
, for making sure the load more event will be able to trigger.
Name | Type | Default | Required |
---|---|---|---|
paginate | number | 20 | - |
shortcut_close
Shortcuts to close the search modal. Empty array means disabled. See key values for keyboard events.
Name | Type | Default | Required |
---|---|---|---|
shortcut_close | array | [Escape] | - |
shortcut_search
Shortcuts to open the search modal. Leave it empty to disable.
Name | Type | Default | Required |
---|---|---|---|
shortcut_search | array | [Control k] | - |
stall_threshold
How many milliseconds must elapse before considering the autocomplete experience stalled.
Name | Type | Default | Required |
---|---|---|---|
stall_threshold | number | 300 | - |
threshold
At what point does the match algorithm give up. A threshold of 0.0
requires a perfect match (of both letters and location), a threshold of 1.0
would match anything.
Name | Type | Default | Required |
---|---|---|---|
threshold | number | 0.6 | - |
AKA front matter.
noindex
When true
, the page won't be indexed, that is, it won't appear on the search results.
Name | Type | Default | Required |
---|---|---|---|
noindex | boolean | false | - |