mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-09-09 19:15:17 -04:00
search: Use front matter parameter to control search indexing
Closes #3108
This commit is contained in:
parent
b4f90e39d4
commit
7ccd084ad7
@ -152,26 +152,27 @@ This example demonstrates the minimum required front matter fields.
|
|||||||
|
|
||||||
If quotation marks are required, prefer single quotes to double quotes when possible.
|
If quotation marks are required, prefer single quotes to double quotes when possible.
|
||||||
|
|
||||||
Seq|Field|Description|Required
|
Field|Description|Required
|
||||||
--:|:--|:--|:--
|
:--|:--|:--
|
||||||
1|`title`|The page title|:heavy_check_mark:|
|
`title`|The page title|:heavy_check_mark:|
|
||||||
2|`linkTitle`|A short version of the page title||
|
`linkTitle`|A short version of the page title||
|
||||||
3|`description`|A complete sentence describing the page|:heavy_check_mark:|
|
`description`|A complete sentence describing the page|:heavy_check_mark:|
|
||||||
4|`categories`|An array of terms in the categories taxonomy|:heavy_check_mark: [^1]|
|
`categories`|An array of terms in the categories taxonomy|:heavy_check_mark: [^1]|
|
||||||
5|`keywords`|An array of keywords used to identify related content|:heavy_check_mark: [^1]|
|
`keywords`|An array of keywords used to identify related content|:heavy_check_mark: [^1]|
|
||||||
6|`publishDate`|Applicable to news items: the publication date||
|
`publishDate`|Applicable to news items: the publication date||
|
||||||
7|`params.altTitle`|An alternate title: used in the "see also" panel if provided||
|
`params.alt_title`|An alternate title: used in the "see also" panel if provided||
|
||||||
8|`params.functions_and_methods.aliases`|Applicable to function and method pages: an array of alias names||
|
`params.functions_and_methods.aliases`|Applicable to function and method pages: an array of alias names||
|
||||||
9|`params.functions_and_methods.returnType`|Applicable to function and method pages: the data type returned||
|
`params.functions_and_methods.returnType`|Applicable to function and method pages: the data type returned||
|
||||||
10|`params.functions_and_methods.signatures`|Applicable to function and method pages: an array of signatures||
|
`params.functions_and_methods.signatures`|Applicable to function and method pages: an array of signatures||
|
||||||
11|`params.hide_in_this_section`|Whether to hide the "in this section" panel||
|
`params.hide_in_this_section`|Whether to hide the "in this section" panel||
|
||||||
12|`params.minversion`|Applicable to the quick start page: the minimum Hugo version required||
|
`params.minversion`|Applicable to the quick start page: the minimum Hugo version required||
|
||||||
13|`params.permalink`|Reserved for use by the news content adapter||
|
`params.permalink`|Reserved for use by the news content adapter||
|
||||||
14|`params.reference (used in glossary term)`|Applicable to glossary entries: a URL for additional information||
|
`params.reference (used in glossary term)`|Applicable to glossary entries: a URL for additional information||
|
||||||
15|`params.show_publish_date`|Whether to show the `publishDate` when rendering the page||
|
`params.searchable`|Whether to add the content of this page to the search index. The default value is cascaded down from the site configuration; `true` if the page kind is `page`, and `false` if the page kind is one of `home`, `section`, `taxonomy`, or `term`. Add this field to override the default value.||
|
||||||
16|`weight`|The page weight||
|
`params.show_publish_date`|Whether to show the `publishDate` when rendering the page||
|
||||||
17|`aliases`|Previous URLs used to access this page||
|
`weight`|The page weight||
|
||||||
18|`expirydate`|The expiration date||
|
`aliases`|Previous URLs used to access this page||
|
||||||
|
`expirydate`|The expiration date||
|
||||||
|
|
||||||
[^1]: The field is required, but its data is not.
|
[^1]: The field is required, but its data is not.
|
||||||
|
|
||||||
@ -185,13 +186,13 @@ If the title in the "See also" sidebar is ambiguous or the same as another page,
|
|||||||
title = "Long descriptive title"
|
title = "Long descriptive title"
|
||||||
linkTitle = "Short title"
|
linkTitle = "Short title"
|
||||||
[params]
|
[params]
|
||||||
altTitle = "Whatever you want"
|
alt_title = "Whatever you want"
|
||||||
{{< /code-toggle >}}
|
{{< /code-toggle >}}
|
||||||
|
|
||||||
Use of the alternate title is limited to the "See also" sidebar.
|
Use of the alternate title is limited to the "See also" sidebar.
|
||||||
|
|
||||||
> [!note]
|
> [!note]
|
||||||
> Think carefully before setting the `altTitle`. Use it only when absolutely necessary.
|
> Think carefully before setting the `alt_title`. Use it only when absolutely necessary.
|
||||||
|
|
||||||
## Code examples
|
## Code examples
|
||||||
|
|
||||||
|
@ -3,6 +3,8 @@ title: Emojis
|
|||||||
description: Include emoji shortcodes in your Markdown or templates.
|
description: Include emoji shortcodes in your Markdown or templates.
|
||||||
categories: []
|
categories: []
|
||||||
keywords: []
|
keywords: []
|
||||||
|
params:
|
||||||
|
searchable: false
|
||||||
---
|
---
|
||||||
|
|
||||||
## Attribution
|
## Attribution
|
||||||
|
@ -13,6 +13,7 @@ cascade:
|
|||||||
layout: single
|
layout: single
|
||||||
params:
|
params:
|
||||||
hide_in_this_section: true
|
hide_in_this_section: true
|
||||||
|
searchable: true
|
||||||
aliases: [/getting-started/glossary/]
|
aliases: [/getting-started/glossary/]
|
||||||
---
|
---
|
||||||
|
|
||||||
|
270
hugo.toml
270
hugo.toml
@ -9,165 +9,175 @@ title = "Hugo"
|
|||||||
disableAliases = true
|
disableAliases = true
|
||||||
|
|
||||||
[build]
|
[build]
|
||||||
[build.buildStats]
|
[build.buildStats]
|
||||||
disableIDs = true
|
disableIDs = true
|
||||||
enable = true
|
enable = true
|
||||||
[[build.cachebusters]]
|
[[build.cachebusters]]
|
||||||
source = "assets/notwatching/hugo_stats\\.json"
|
source = "assets/notwatching/hugo_stats\\.json"
|
||||||
target = "css"
|
target = "css"
|
||||||
[[build.cachebusters]]
|
[[build.cachebusters]]
|
||||||
source = "(postcss|tailwind)\\.config\\.js"
|
source = "(postcss|tailwind)\\.config\\.js"
|
||||||
target = "css"
|
target = "css"
|
||||||
|
|
||||||
[caches]
|
[caches]
|
||||||
[caches.images]
|
[caches.images]
|
||||||
dir = ":cacheDir/images"
|
dir = ":cacheDir/images"
|
||||||
maxAge = "1440h"
|
maxAge = "1440h"
|
||||||
[caches.getresource]
|
[caches.getresource]
|
||||||
dir = ':cacheDir/:project'
|
dir = ':cacheDir/:project'
|
||||||
maxAge = "1h"
|
maxAge = "1h"
|
||||||
|
|
||||||
[cascade]
|
[[cascade]]
|
||||||
[cascade.params]
|
[cascade.params]
|
||||||
hide_in_this_section = true
|
hide_in_this_section = true
|
||||||
show_publish_date = true
|
show_publish_date = true
|
||||||
[cascade.target]
|
[cascade.target]
|
||||||
kind = 'page'
|
kind = 'page'
|
||||||
path = '{/news/**}'
|
path = '{/news/**}'
|
||||||
|
[[cascade]]
|
||||||
|
[cascade.params]
|
||||||
|
searchable = true
|
||||||
|
[cascade.target]
|
||||||
|
kind = 'page'
|
||||||
|
[[cascade]]
|
||||||
|
[cascade.params]
|
||||||
|
searchable = false
|
||||||
|
[cascade.target]
|
||||||
|
kind = '{home,section,taxonomy,term}'
|
||||||
|
|
||||||
[frontmatter]
|
[frontmatter]
|
||||||
date = ['date'] # do not add publishdate; it will affect page sorting
|
date = ['date'] # do not add publishdate; it will affect page sorting
|
||||||
expiryDate = ['expirydate']
|
expiryDate = ['expirydate']
|
||||||
lastmod = [':git', 'lastmod', 'publishdate', 'date']
|
lastmod = [':git', 'lastmod', 'publishdate', 'date']
|
||||||
publishDate = ['publishdate', 'date']
|
publishDate = ['publishdate', 'date']
|
||||||
|
|
||||||
[languages]
|
[languages]
|
||||||
[languages.en]
|
[languages.en]
|
||||||
languageCode = "en-US"
|
languageCode = "en-US"
|
||||||
languageName = "English"
|
languageName = "English"
|
||||||
weight = 1
|
weight = 1
|
||||||
|
|
||||||
[markup]
|
[markup]
|
||||||
[markup.goldmark]
|
[markup.goldmark]
|
||||||
[markup.goldmark.extensions]
|
[markup.goldmark.extensions]
|
||||||
[markup.goldmark.extensions.typographer]
|
[markup.goldmark.extensions.typographer]
|
||||||
disable = false
|
disable = false
|
||||||
[markup.goldmark.extensions.passthrough]
|
[markup.goldmark.extensions.passthrough]
|
||||||
enable = true
|
enable = true
|
||||||
[markup.goldmark.extensions.passthrough.delimiters]
|
[markup.goldmark.extensions.passthrough.delimiters]
|
||||||
block = [['\[', '\]'], ['$$', '$$']]
|
block = [['\[', '\]'], ['$$', '$$']]
|
||||||
inline = [['\(', '\)']]
|
inline = [['\(', '\)']]
|
||||||
[markup.goldmark.parser]
|
[markup.goldmark.parser]
|
||||||
autoDefinitionTermID = true
|
autoDefinitionTermID = true
|
||||||
[markup.goldmark.parser.attribute]
|
[markup.goldmark.parser.attribute]
|
||||||
block = true
|
block = true
|
||||||
[markup.highlight]
|
[markup.highlight]
|
||||||
lineNumbersInTable = false
|
lineNumbersInTable = false
|
||||||
noClasses = false
|
noClasses = false
|
||||||
style = 'solarized-dark'
|
style = 'solarized-dark'
|
||||||
wrapperClass = 'highlight not-prose'
|
wrapperClass = 'highlight not-prose'
|
||||||
|
|
||||||
[mediaTypes]
|
[mediaTypes]
|
||||||
[mediaTypes."text/netlify"]
|
[mediaTypes."text/netlify"]
|
||||||
delimiter = ""
|
delimiter = ""
|
||||||
|
|
||||||
[module]
|
[module]
|
||||||
[module.hugoVersion]
|
[module.hugoVersion]
|
||||||
min = "0.144.0"
|
min = "0.144.0"
|
||||||
[[module.mounts]]
|
[[module.mounts]]
|
||||||
source = "assets"
|
source = "assets"
|
||||||
target = "assets"
|
target = "assets"
|
||||||
[[module.mounts]]
|
[[module.mounts]]
|
||||||
lang = 'en'
|
lang = 'en'
|
||||||
source = 'content/en'
|
source = 'content/en'
|
||||||
target = 'content'
|
target = 'content'
|
||||||
[[module.mounts]]
|
[[module.mounts]]
|
||||||
disableWatch = true
|
disableWatch = true
|
||||||
source = "hugo_stats.json"
|
source = "hugo_stats.json"
|
||||||
target = "assets/notwatching/hugo_stats.json"
|
target = "assets/notwatching/hugo_stats.json"
|
||||||
|
|
||||||
[outputFormats]
|
[outputFormats]
|
||||||
[outputFormats.redir]
|
[outputFormats.redir]
|
||||||
baseName = "_redirects"
|
baseName = "_redirects"
|
||||||
isPlainText = true
|
isPlainText = true
|
||||||
mediatype = "text/netlify"
|
mediatype = "text/netlify"
|
||||||
[outputFormats.headers]
|
[outputFormats.headers]
|
||||||
baseName = "_headers"
|
baseName = "_headers"
|
||||||
isPlainText = true
|
isPlainText = true
|
||||||
mediatype = "text/netlify"
|
mediatype = "text/netlify"
|
||||||
notAlternative = true
|
notAlternative = true
|
||||||
|
|
||||||
[outputs]
|
[outputs]
|
||||||
home = ["html", "rss", "redir", "headers"]
|
home = ["html", "rss", "redir", "headers"]
|
||||||
page = ["html"]
|
page = ["html"]
|
||||||
section = ["html"]
|
section = ["html"]
|
||||||
taxonomy = ["html"]
|
taxonomy = ["html"]
|
||||||
term = ["html"]
|
term = ["html"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
description = "The world’s fastest framework for building websites"
|
description = "The world’s fastest framework for building websites"
|
||||||
ghrepo = "https://github.com/gohugoio/hugoDocs/"
|
ghrepo = "https://github.com/gohugoio/hugoDocs/"
|
||||||
[params.render_hooks.link]
|
[params.render_hooks.link]
|
||||||
errorLevel = 'warning' # ignore (default), warning, or error (fails the build)
|
errorLevel = 'warning' # ignore (default), warning, or error (fails the build)
|
||||||
[params.social.mastodon]
|
[params.social.mastodon]
|
||||||
url = "https://fosstodon.org/@gohugoio"
|
url = "https://fosstodon.org/@gohugoio"
|
||||||
|
|
||||||
[related]
|
[related]
|
||||||
includeNewer = true
|
includeNewer = true
|
||||||
threshold = 80
|
threshold = 80
|
||||||
toLower = true
|
toLower = true
|
||||||
[[related.indices]]
|
[[related.indices]]
|
||||||
name = 'keywords'
|
name = 'keywords'
|
||||||
weight = 1
|
weight = 1
|
||||||
|
|
||||||
[security]
|
[security]
|
||||||
[security.funcs]
|
[security.funcs]
|
||||||
getenv = ['^HUGO_', '^REPOSITORY_URL$', '^BRANCH$']
|
getenv = ['^HUGO_', '^REPOSITORY_URL$', '^BRANCH$']
|
||||||
|
|
||||||
[server]
|
[server]
|
||||||
[[server.headers]]
|
[[server.headers]]
|
||||||
for = "/*"
|
for = "/*"
|
||||||
[server.headers.values]
|
[server.headers.values]
|
||||||
X-Frame-Options = "DENY"
|
X-Frame-Options = "DENY"
|
||||||
X-XSS-Protection = "1; mode=block"
|
X-XSS-Protection = "1; mode=block"
|
||||||
X-Content-Type-Options = "nosniff"
|
X-Content-Type-Options = "nosniff"
|
||||||
Referrer-Policy = "no-referrer"
|
Referrer-Policy = "no-referrer"
|
||||||
[[server.headers]]
|
[[server.headers]]
|
||||||
for = "/**.{css,js}"
|
for = "/**.{css,js}"
|
||||||
|
|
||||||
[services]
|
[services]
|
||||||
[services.googleAnalytics]
|
[services.googleAnalytics]
|
||||||
ID = 'G-MBZGKNMDWC'
|
ID = 'G-MBZGKNMDWC'
|
||||||
|
|
||||||
[taxonomies]
|
[taxonomies]
|
||||||
category = 'categories'
|
category = 'categories'
|
||||||
|
|
||||||
######## GLOBAL ITEMS TO BE SHARED WITH THE HUGO SITES ########
|
######## GLOBAL ITEMS TO BE SHARED WITH THE HUGO SITES ########
|
||||||
[menus]
|
[menus]
|
||||||
[[menus.global]]
|
[[menus.global]]
|
||||||
identifier = 'news'
|
identifier = 'news'
|
||||||
name = 'News'
|
name = 'News'
|
||||||
pageRef = '/news/'
|
pageRef = '/news/'
|
||||||
weight = 1
|
weight = 1
|
||||||
[[menus.global]]
|
[[menus.global]]
|
||||||
identifier = 'docs'
|
identifier = 'docs'
|
||||||
name = 'Docs'
|
name = 'Docs'
|
||||||
url = '/documentation/'
|
url = '/documentation/'
|
||||||
weight = 5
|
weight = 5
|
||||||
[[menus.global]]
|
[[menus.global]]
|
||||||
identifier = 'themes'
|
identifier = 'themes'
|
||||||
name = 'Themes'
|
name = 'Themes'
|
||||||
url = 'https://themes.gohugo.io/'
|
url = 'https://themes.gohugo.io/'
|
||||||
weight = 10
|
weight = 10
|
||||||
[[menus.global]]
|
[[menus.global]]
|
||||||
identifier = 'community'
|
identifier = 'community'
|
||||||
name = 'Community'
|
name = 'Community'
|
||||||
post = 'external'
|
post = 'external'
|
||||||
url = 'https://discourse.gohugo.io/'
|
url = 'https://discourse.gohugo.io/'
|
||||||
weight = 150
|
weight = 150
|
||||||
[[menus.global]]
|
[[menus.global]]
|
||||||
identifier = 'github'
|
identifier = 'github'
|
||||||
name = 'GitHub'
|
name = 'GitHub'
|
||||||
post = 'external'
|
post = 'external'
|
||||||
url = 'https://github.com/gohugoio/hugo'
|
url = 'https://github.com/gohugoio/hugo'
|
||||||
weight = 200
|
weight = 200
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
<a
|
<a
|
||||||
class="text-sm text-blue-600 hover:text-blue-500 dark:text-blue-500 dark:hover:text-blue-400"
|
class="text-sm text-blue-600 hover:text-blue-500 dark:text-blue-500 dark:hover:text-blue-400"
|
||||||
href="{{ .RelPermalink }}"
|
href="{{ .RelPermalink }}"
|
||||||
>{{ or .Params.altTitle .Title }}</a
|
>{{ or .Params.alt_title .Title }}</a
|
||||||
>
|
>
|
||||||
</li>
|
</li>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
@ -32,8 +32,13 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
{{ partial "layouts/head/head.html" . }}
|
{{ partial "layouts/head/head.html" . }}
|
||||||
</head>
|
</head>
|
||||||
<body
|
|
||||||
class="flex flex-col min-h-full bg-white dark:bg-blue-950 kind-{{ .Kind }}">
|
{{ $bodyClass := printf "flex flex-col min-h-full bg-white dark:bg-blue-950 kind-%s" .Kind }}
|
||||||
|
{{ if .Params.searchable }}
|
||||||
|
{{ $bodyClass = printf "%s searchable" $bodyClass }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
<body class="{{ $bodyClass }}">
|
||||||
{{ partial "layouts/hooks/body-start.html" . }}
|
{{ partial "layouts/hooks/body-start.html" . }}
|
||||||
{{/* Layout. */}}
|
{{/* Layout. */}}
|
||||||
{{ block "header" . }}
|
{{ block "header" . }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user