#242, Add bookSearchExclude frontmatter param
This commit is contained in:
parent
5cc3d6719c
commit
b76bdd715b
2 changed files with 30 additions and 24 deletions
14
README.md
14
README.md
|
@ -211,20 +211,23 @@ type = 'docs'
|
||||||
# Set page weight to re-arrange items in file-tree menu (if BookMenuBundle not set)
|
# Set page weight to re-arrange items in file-tree menu (if BookMenuBundle not set)
|
||||||
weight = 10
|
weight = 10
|
||||||
|
|
||||||
# (Optional) Set to mark page as flat section in file-tree menu (if BookMenuBundle not set)
|
# (Optional) Set to 'true' to mark page as flat section in file-tree menu (if BookMenuBundle not set)
|
||||||
bookFlatSection = true
|
bookFlatSection = false
|
||||||
|
|
||||||
# (Optional, Experimental) Set to hide nested sections or pages at that level. Works only with file-tree menu mode
|
# (Optional) Set to hide nested sections or pages at that level. Works only with file-tree menu mode
|
||||||
bookCollapseSection = true
|
bookCollapseSection = true
|
||||||
|
|
||||||
# (Optional) Set true to hide page or section from side menu (if BookMenuBundle not set)
|
# (Optional) Set true to hide page or section from side menu (if BookMenuBundle not set)
|
||||||
bookHidden = true
|
bookHidden = false
|
||||||
|
|
||||||
# (Optional) Set 'false' to hide ToC from page
|
# (Optional) Set 'false' to hide ToC from page
|
||||||
bookToC = true
|
bookToC = true
|
||||||
|
|
||||||
# (Optional) If you have enabled BookComments for the site, you can disable it for specific pages.
|
# (Optional) If you have enabled BookComments for the site, you can disable it for specific pages.
|
||||||
bookComments = true
|
bookComments = true
|
||||||
|
|
||||||
|
# (Optional) Set to 'false' to exclude page from search index.
|
||||||
|
bookSearchExclude = true
|
||||||
```
|
```
|
||||||
|
|
||||||
### Partials
|
### Partials
|
||||||
|
@ -284,7 +287,8 @@ By default, Goldmark trims unsafe outputs which might prevent some shortcodes fr
|
||||||
[markup.goldmark.renderer]
|
[markup.goldmark.renderer]
|
||||||
unsafe = true
|
unsafe = true
|
||||||
```
|
```
|
||||||
If you are using ```config.yaml``` or ```config.json```, consult the [configuration markup](https://gohugo.io/getting-started/configuration-markup/)
|
|
||||||
|
If you are using `config.yaml` or `config.json`, consult the [configuration markup](https://gohugo.io/getting-started/configuration-markup/)
|
||||||
|
|
||||||
## Versioning
|
## Versioning
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,11 @@
|
||||||
const index = FlexSearch.create('balance', indexCfg);
|
const index = FlexSearch.create('balance', indexCfg);
|
||||||
window.bookSearchIndex = index;
|
window.bookSearchIndex = index;
|
||||||
|
|
||||||
{{ range $index, $page := where .Site.Pages "Kind" "in" (slice "page" "section") }}
|
{{- $pages := where .Site.Pages "Kind" "in" (slice "page" "section") -}}
|
||||||
{{ if $page.Content }}
|
{{- $pages = where $pages "Params.booksearchexclude" "!=" true -}}
|
||||||
|
{{- $pages = where $pages "Content" "not in" (slice nil "") -}}
|
||||||
|
|
||||||
|
{{ range $index, $page := $pages }}
|
||||||
index.add({
|
index.add({
|
||||||
'id': {{ $index }},
|
'id': {{ $index }},
|
||||||
'href': '{{ $page.RelPermalink }}',
|
'href': '{{ $page.RelPermalink }}',
|
||||||
|
@ -26,5 +29,4 @@
|
||||||
'content': {{ $page.Plain | jsonify }}
|
'content': {{ $page.Plain | jsonify }}
|
||||||
});
|
});
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
|
||||||
})();
|
})();
|
||||||
|
|
Loading…
Reference in a new issue