abc
" }} → <p>abc</p> +``` + +When using `transform.XMLEscape` in a template rendered by Go's [html/template] package, declare the string to be safe HTML to avoid double escaping. For example, in an RSS template: + +{{< code file="layouts/_default/rss.xml" >}} +{{ .Fragments.Headings | jsonify (dict "indent" " ") }}``` HeadingsMap -: (`slice`) A slice of maps of all headings on the page, with first-level keys for each heading. Each map contains the following keys: `ID`, `Title` and `Headings`. To inspect the data structure: +: (`slice`) A slice of maps of all headings on the page, with first-level keys for each heading. Each map contains the following keys: `ID`, `Level`, `Title` and `Headings`. To inspect the data structure: ```go-html-template
{{ .Fragments.HeadingsMap | jsonify (dict "indent" " ") }}diff --git a/content/en/methods/page/GetPage.md b/content/en/methods/page/GetPage.md index ed072932a2..b1f192d583 100644 --- a/content/en/methods/page/GetPage.md +++ b/content/en/methods/page/GetPage.md @@ -6,7 +6,7 @@ keywords: [] action: related: - methods/site/GetPage - returnType: hugolib.pageState + returnType: page.Page signatures: [PAGE.GetPage PATH] aliases: [/functions/getpage] --- diff --git a/content/en/methods/page/GitInfo.md b/content/en/methods/page/GitInfo.md index 88137614ca..9dba2a2b20 100644 --- a/content/en/methods/page/GitInfo.md +++ b/content/en/methods/page/GitInfo.md @@ -34,7 +34,7 @@ hugo --enableGitInfo ``` {{% note %}} -When you set `enableGitInto` to `true`, or enable the feature with the command line flag, the last modification date for each content page will be the Author Date of the last commit for that file. +When you set `enableGitInfo` to `true`, or enable the feature with the command line flag, the last modification date for each content page will be the Author Date of the last commit for that file. This is configurable. See [details]. @@ -43,8 +43,9 @@ This is configurable. See [details]. ## Methods -AbbreviatedHash -: (`string`) The abbreviated commit hash. +###### AbbreviatedHash + +(`string`) The abbreviated commit hash. ```go-html-template {{ with .GitInfo }} @@ -52,8 +53,9 @@ AbbreviatedHash {{ end }} ``` -AuthorDate -: (`time.Time`) The author date. +###### AuthorDate + +(`time.Time`) The author date. ```go-html-template {{ with .GitInfo }} @@ -61,8 +63,9 @@ AuthorDate {{ end }} ``` -AuthorEmail -: (`string`) The author's email address, respecting [gitmailmap]. +###### AuthorEmail + +(`string`) The author's email address, respecting [gitmailmap]. ```go-html-template {{ with .GitInfo }} @@ -70,8 +73,9 @@ AuthorEmail {{ end }} ``` -AuthorName -: (`string`) The author's name, respecting [gitmailmap]. +###### AuthorName + +(`string`) The author's name, respecting [gitmailmap]. ```go-html-template {{ with .GitInfo }} @@ -79,8 +83,19 @@ AuthorName {{ end }} ``` -Hash -: (`string`) The commit hash. +###### CommitDate + +(`time.Time`) The commit date. + +```go-html-template +{{ with .GitInfo }} + {{ .CommitDate.Format "2006-01-02" }} → 2023-10-09 +{{ end }} +``` + +###### Hash + +(`string`) The commit hash. ```go-html-template {{ with .GitInfo }} @@ -88,8 +103,9 @@ Hash {{ end }} ``` -Subject -: (`string`) The commit message subject. +###### Subject + +(`string`) The commit message subject. ```go-html-template {{ with .GitInfo }} diff --git a/content/en/methods/page/Next.md b/content/en/methods/page/Next.md index 3c9e3495ac..57fc1f2f87 100644 --- a/content/en/methods/page/Next.md +++ b/content/en/methods/page/Next.md @@ -10,7 +10,7 @@ action: - methods/page/PrevInSection - methods/pages/Next - methods/pages/Prev - returnType: hugolib.pageState + returnType: page.Page signatures: [PAGE.Next] toc: true --- diff --git a/content/en/methods/page/NextInSection.md b/content/en/methods/page/NextInSection.md index b48ddcc624..73f82d754a 100644 --- a/content/en/methods/page/NextInSection.md +++ b/content/en/methods/page/NextInSection.md @@ -10,7 +10,7 @@ action: - methods/page/Prev - methods/pages/Next - methods/pages/Prev - returnType: hugolib.pageState + returnType: page.Page signatures: [PAGE.NextInSection] --- diff --git a/content/en/methods/page/Page.md b/content/en/methods/page/Page.md index 2c0536bee0..4d81c04ef2 100644 --- a/content/en/methods/page/Page.md +++ b/content/en/methods/page/Page.md @@ -5,7 +5,7 @@ categories: [] keywords: [] action: related: [] - returnType: hugolib.pageState + returnType: page.Page signatures: [PAGE.Page] --- diff --git a/content/en/methods/page/Params.md b/content/en/methods/page/Params.md index ce624c3944..3d79d15c5b 100644 --- a/content/en/methods/page/Params.md +++ b/content/en/methods/page/Params.md @@ -18,7 +18,6 @@ With this front matter: title = 'Annual conference' date = 2023-10-17T15:11:37-07:00 display_related = true -event-date = '2023' [params.author] email = 'jsmith@example.org' name = 'John Smith' @@ -36,8 +35,9 @@ Access the custom parameters by [chaining] the [identifiers]: In the template example above, each of the keys is a valid identifier. For example, none of the keys contains a hyphen. To access a key that is not a valid identifier, use the [`index`] function: ```go-html-template -{{ index .Params "event-date" }} → 2023 +{{ index .Params "key-with-hyphens" }} → 2023 ``` + [`index`]: /functions/collections/indexfunction [chaining]: /getting-started/glossary/#chain [identifiers]: /getting-started/glossary/#identifier diff --git a/content/en/methods/page/Parent.md b/content/en/methods/page/Parent.md index dbd2cb9b3f..9d9ed7ea3b 100644 --- a/content/en/methods/page/Parent.md +++ b/content/en/methods/page/Parent.md @@ -12,7 +12,7 @@ action: - methods/page/IsAncestor - methods/page/IsDescendant - methods/page/Sections - returnType: hugolib.pageState + returnType: page.Page signatures: [PAGE.Parent] --- diff --git a/content/en/methods/page/Permalink.md b/content/en/methods/page/Permalink.md index be6df5aadf..d8416df866 100644 --- a/content/en/methods/page/Permalink.md +++ b/content/en/methods/page/Permalink.md @@ -21,5 +21,5 @@ Template: ```go-html-template {{ $page := .Site.GetPage "/about" }} -{{ $page.RelPermalink }} → https://example.org/docs/about/ +{{ $page.Permalink }} → https://example.org/docs/about/ ``` diff --git a/content/en/methods/page/Prev.md b/content/en/methods/page/Prev.md index cde83b0f27..b1a503af53 100644 --- a/content/en/methods/page/Prev.md +++ b/content/en/methods/page/Prev.md @@ -10,7 +10,7 @@ action: - methods/page/NextInSection - methods/pages/Prev - methods/pages/Next - returnType: hugolib.pageState + returnType: page.Page signatures: [PAGE.Prev] toc: true --- diff --git a/content/en/methods/page/PrevInSection.md b/content/en/methods/page/PrevInSection.md index 30b813350e..c09e4580f7 100644 --- a/content/en/methods/page/PrevInSection.md +++ b/content/en/methods/page/PrevInSection.md @@ -10,7 +10,7 @@ action: - methods/pages/Next - methods/page/Prev - methods/pages/Prev - returnType: hugolib.pageState + returnType: page.Page signatures: [PAGE.PrevInSection] --- diff --git a/content/en/methods/page/RelPermalink.md b/content/en/methods/page/RelPermalink.md index 8a5972ccc2..817e3c862c 100644 --- a/content/en/methods/page/RelPermalink.md +++ b/content/en/methods/page/RelPermalink.md @@ -21,5 +21,5 @@ Template: ```go-html-template {{ $page := .Site.GetPage "/about" }} -{{ $page.Permalink }} → /docs/about/ +{{ $page.RelPermalink }} → /docs/about/ ``` diff --git a/content/en/methods/page/Resources.md b/content/en/methods/page/Resources.md index a9fa3dab2f..140b50020e 100644 --- a/content/en/methods/page/Resources.md +++ b/content/en/methods/page/Resources.md @@ -21,8 +21,9 @@ To work with global or remote resources, see the [`resources`] functions. ## Methods -ByType -: (`resource.Resources`) Returns a collection of page resources of the given [media type], or nil if none found. The media type is typically one of `image`, `text`, `audio`, `video`, or `application`. +###### ByType + +(`resource.Resources`) Returns a collection of page resources of the given [media type], or nil if none found. The media type is typically one of `image`, `text`, `audio`, `video`, or `application`. ```go-html-template {{ range .Resources.ByType "image" }} @@ -32,8 +33,9 @@ ByType When working with global resources instead of page resources, use the [`resources.ByType`] function. -Get -: (`resource.Resource`) Returns a page resource from the given path, or nil if none found. +###### Get + +(`resource.Resource`) Returns a page resource from the given path, or nil if none found. ```go-html-template {{ with .Resources.Get "images/a.jpg" }} @@ -43,8 +45,9 @@ Get When working with global resources instead of page resources, use the [`resources.Get`] function. -GetMatch -: (`resource.Resource`) Returns the first page resource from paths matching the given [glob pattern], or nil if none found. +###### GetMatch + +(`resource.Resource`) Returns the first page resource from paths matching the given [glob pattern], or nil if none found. ```go-html-template {{ with .Resources.GetMatch "images/*.jpg" }} @@ -54,8 +57,9 @@ GetMatch When working with global resources instead of page resources, use the [`resources.GetMatch`] function. -Match -: (`resource.Resources`) Returns a collection of page resources from paths matching the given [glob pattern], or nil if none found. +###### Match + +(`resource.Resources`) Returns a collection of page resources from paths matching the given [glob pattern], or nil if none found. ```go-html-template {{ range .Resources.Match "images/*.jpg" }} diff --git a/content/en/methods/page/Store.md b/content/en/methods/page/Store.md index 04e1d52566..8bc16034b7 100644 --- a/content/en/methods/page/Store.md +++ b/content/en/methods/page/Store.md @@ -22,25 +22,28 @@ To create a locally scoped scratch pad that is not attached to a `Page` object, ## Methods -Set -: Sets the value of a given key. +###### Set + +Sets the value of a given key. ```go-html-template {{ .Store.Set "greeting" "Hello" }} ``` -Get -: Gets the value of a given key. +###### Get + +Gets the value of a given key. ```go-html-template {{ .Store.Set "greeting" "Hello" }} {{ .Store.Get "greeting" }} → Hello ``` -Add -: Adds a given value to existing value(s) of the given key. +###### Add -: For single values, `Add` accepts values that support Go's `+` operator. If the first `Add` for a key is an array or slice, the following adds will be appended to that list. +Adds a given value to existing value(s) of the given key. + +For single values, `Add` accepts values that support Go's `+` operator. If the first `Add` for a key is an array or slice, the following adds will be appended to that list. ```go-html-template {{ .Store.Set "greeting" "Hello" }} @@ -60,8 +63,9 @@ Add {{ .Store.Get "greetings" }} → [Hello Welcome Cheers] ``` -SetInMap -: Takes a `key`, `mapKey` and `value` and adds a map of `mapKey` and `value` to the given `key`. +###### SetInMap + +Takes a `key`, `mapKey` and `value` and adds a map of `mapKey` and `value` to the given `key`. ```go-html-template {{ .Store.SetInMap "greetings" "english" "Hello" }} @@ -69,8 +73,9 @@ SetInMap {{ .Store.Get "greetings" }} → map[english:Hello french:Bonjour] ``` -DeleteInMap -: Takes a `key` and `mapKey` and removes the map of `mapKey` from the given `key`. +###### DeleteInMap + +Takes a `key` and `mapKey` and removes the map of `mapKey` from the given `key`. ```go-html-template {{ .Store.SetInMap "greetings" "english" "Hello" }} @@ -79,8 +84,9 @@ DeleteInMap {{ .Store.Get "greetings" }} → map[french:Bonjour] ``` -GetSortedMapValues -: Returns an array of values from `key` sorted by `mapKey`. +###### GetSortedMapValues + +Returns an array of values from `key` sorted by `mapKey`. ```go-html-template {{ .Store.SetInMap "greetings" "english" "Hello" }} @@ -88,8 +94,9 @@ GetSortedMapValues {{ .Store.GetSortedMapValues "greetings" }} → [Hello Bonjour] ``` -Delete -: Removes the given key. +###### Delete + +Removes the given key. ```go-html-template {{ .Store.Set "greeting" "Hello" }} diff --git a/content/en/methods/page/Translations.md b/content/en/methods/page/Translations.md index 7aaee75ab7..1ed2566307 100644 --- a/content/en/methods/page/Translations.md +++ b/content/en/methods/page/Translations.md @@ -63,8 +63,9 @@ And this template: {{ with .Translations }}
abc
" }}' + - '<p>abc</p>' urls: AbsLangURL: Aliases: diff --git a/go.mod b/go.mod index b53b245e14..ac58db6b35 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module github.com/gohugoio/hugoDocs go 1.16 -require github.com/gohugoio/gohugoioTheme v0.0.0-20231111235806-77931ac4875e // indirect +require github.com/gohugoio/gohugoioTheme v0.0.0-20240125093153-bea12fdc0b15 // indirect diff --git a/go.sum b/go.sum index d8cea868c9..3d66fb5511 100644 --- a/go.sum +++ b/go.sum @@ -1,2 +1,4 @@ -github.com/gohugoio/gohugoioTheme v0.0.0-20231111235806-77931ac4875e h1:X4OxWNt7weGfmRHBAQWW1gsdZBd3V/6DJMNhrYS9ALE= -github.com/gohugoio/gohugoioTheme v0.0.0-20231111235806-77931ac4875e/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM= +github.com/gohugoio/gohugoioTheme v0.0.0-20240108005931-638ffe386bd2 h1:wa2rkKQnFxJK0czyiCiKgJZZ9fQQlzn1iFsuKryffHE= +github.com/gohugoio/gohugoioTheme v0.0.0-20240108005931-638ffe386bd2/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM= +github.com/gohugoio/gohugoioTheme v0.0.0-20240125093153-bea12fdc0b15 h1:NJvuWADEYyNmpyRScXC/1dIwy6kqLDkwB9GP3Wq4W+I= +github.com/gohugoio/gohugoioTheme v0.0.0-20240125093153-bea12fdc0b15/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM= diff --git a/hugo.toml b/hugo.toml index 0267434662..209231663f 100644 --- a/hugo.toml +++ b/hugo.toml @@ -93,3 +93,8 @@ ID = 'G-MBZGKNMDWC' [taxonomies] category = "categories" + +[[cascade]] +categories = ['commands'] +[cascade._target] +path = '/commands/**' diff --git a/layouts/shortcodes/new-in.html b/layouts/shortcodes/new-in.html deleted file mode 100644 index e22a91f3d9..0000000000 --- a/layouts/shortcodes/new-in.html +++ /dev/null @@ -1,36 +0,0 @@ -{{- /* -Renders a "new in" button indicating the version in which a feature was added. - -When comparing the current version to the specified version, the "new in" -button will be hidden if any of the following conditions is true: - -- The major version difference exceeds the majorVersionDiffThreshold -- The minor version difference exceeds the minorVersionDiffThreshold - -@param {string} version The semantic version string, with or without a leading v. -@returns {template.HTML} - -@example {{< new-in 0.100.0 >}} -*/}} - -{{- /* Set defaults. */}} -{{- $majorVersionDiffThreshold := 0 }} -{{- $minorVersionDiffThreshold := 30 }} -{{- $displayExpirationWarning := true }} - -{{- /* Render. */}} -{{- with $version := .Get 0 | strings.TrimPrefix "v" }} - {{- $majorVersionDiff := sub (index (split hugo.Version ".") 0 | int) (index (split $version ".") 0 | int) }} - {{- $minorVersionDiff := sub (index (split hugo.Version ".") 1 | int) (index (split $version ".") 1 | int) }} - {{- if or (gt $majorVersionDiff $majorVersionDiffThreshold) (gt $minorVersionDiff $minorVersionDiffThreshold) }} - {{- if $displayExpirationWarning }} - {{- warnf "This call to the %q shortcode should be removed: %s. The button is now hidden because the specified version (%s) is older than the display threshold." $.Name $.Position $version }} - {{- end }} - {{- else }} - - {{- end }} -{{- else }} - {{- errorf "The %q shortcode requires a positional parameter (version). See %s" .Name .Position }} -{{- end -}} diff --git a/netlify.toml b/netlify.toml index cc46695a58..7c5633da8e 100644 --- a/netlify.toml +++ b/netlify.toml @@ -3,7 +3,7 @@ command = "hugo --gc --minify" [build.environment] - HUGO_VERSION = "0.120.4" + HUGO_VERSION = "0.121.2" [context.production.environment] HUGO_ENV = "production"