Replace links to variable pages with links to method pages

See #2196
This commit is contained in:
Joe Mooring
2024-02-03 14:57:43 -08:00
committed by Bjørn Erik Pedersen
parent ad4a124c0c
commit b8d5383f71
175 changed files with 382 additions and 378 deletions
+1 -1
View File
@@ -66,7 +66,7 @@ toc: true
[install]: /installation/
[LiveReload]: /getting-started/usage/
[organization for your projects]: /getting-started/directory-structure/
[pagevars]: /variables/page/
[pagevars]: /methods/page/
[Permalink]: /content-management/urls/#permalinks
[Powerful theming]: /hugo-modules/theme-components/
[Pretty URLs]: /content-management/urls/
+9 -4
View File
@@ -72,10 +72,15 @@ You can use any [template function] within an archetype. As shown above, the def
Archetypes receive the following objects and values in [context]:
- `.Date`
- `.Type`
- `.Site` (see [details](/variables/site/))
- `.File` (see [details](/variables/file/))
- [`Date`]
- [`Type`]
- [`File`]
- [`Site`]
[`Date`]: /methods/page/date/
[`Type`]: /methods/page/type/
[`File`]: /methods/page/
[`Site`]: /methods/site/
As shown above, the default archetype passes `.File.ContentBaseName` as the argument to the `replace` function when populating the title in front matter.
@@ -55,17 +55,17 @@ render
- `never`
: Never render the page to disk, and exclude it from all page collections.
[page bundles]: content-management/page-bundles
[page resources]: /content-management/page-resources
[`Permalink`]: /methods/resource/permalink
[`RelPermalink`]: /methods/resource/relpermalink
[`Publish`]: /methods/resource/publish
[page bundles]: /content-management/page-bundles/
[page resources]: /content-management/page-resources/
[`Permalink`]: /methods/resource/permalink/
[`RelPermalink`]: /methods/resource/relpermalink/
[`Publish`]: /methods/resource/publish/
{{% note %}}
Any page, regardless of its build options, will always be available by using the [`.Page.GetPage`] or [`.Site.GetPage`] method.
[`.Page.GetPage`]: /methods/page/getpage
[`.Site.GetPage`]: /methods/site/getpage
[`.Page.GetPage`]: /methods/page/getpage/
[`.Site.GetPage`]: /methods/site/getpage/
{{% /note %}}
## Example -- headless page
@@ -121,7 +121,7 @@ In the example above, note that:
Create a unpublished section whose content and resources can be included in other pages.
[branch bundle]: /content-management/page-bundles
[branch bundle]: /content-management/page-bundles/
```text
content/
+1 -1
View File
@@ -46,7 +46,7 @@ Will be rendered as:
Hugo does not provide a built-in template for Mermaid diagrams. Create your own using a [code block render hook]:
[code block render hook]: /render-hooks/code-blocks
[code block render hook]: /render-hooks/code-blocks/
{{< code file=layouts/_default/_markup/render-codeblock-mermaid.html >}}
<pre class="mermaid">
+18 -18
View File
@@ -71,7 +71,7 @@ The field names below are reserved. For example, you cannot create a custom fiel
(`map`) A map of [build options].
[build options]: /content-management/build-options
[build options]: /content-management/build-options/
###### cascade {#cascade-field}
@@ -115,16 +115,16 @@ If `true`, the page will not be rendered unless you pass the `--buildDrafts` fla
(`bool`) Set to `true` if the content language is in the [CJK] family. This value determines how Hugo calculates word count, and affects the values returned by the [`WordCount`], [`FuzzyWordCount`], and [`Summary`] methods on a `Page` object.
[`fuzzywordcount`]: /methods/page/wordcount
[`summary`]: /methods/page/wordcount
[`wordcount`]: /methods/page/wordcount
[`fuzzywordcount`]: /methods/page/wordcount/
[`summary`]: /methods/page/summary/
[`wordcount`]: /methods/page/wordcount/
[cjk]: /getting-started/glossary/#cjk
###### keywords
(`string array`) An array of keywords, typically rendered within a `meta` element within the `head` element of the published HTML file, or used as a [taxonomy] to classify content. Access these values from a template using the [`Keywords`] method on a `Page` object.
[`keywords`]: /methods/page/keywords
[`keywords`]: /methods/page/keywords/
[taxonomy]: /getting-started/glossary/#taxonomy
<!-- Added in v0.123.0 but purposefully omitted from documentation. -->
@@ -149,8 +149,8 @@ lang
(`string`) Provide a template name to [target a specific template], overriding the default [template lookup order]. Set the value to the base file name of the template, excluding its extension. Access this value from a template using the [`Layout`] method on a `Page` object.
[`layout`]: /methods/page/layout
[template lookup order]: /templates/lookup-order
[`layout`]: /methods/page/layout/
[template lookup order]: /templates/lookup-order/
[target a specific template]: templates/lookup-order/#target-a-template
###### linkTitle
@@ -172,7 +172,7 @@ Identifier|Content format
`pdc`|Pandoc
`rst`|reStructuredText
[content formats]: /content-management/formats
[content formats]: /content-management/formats/
###### menus
@@ -184,7 +184,7 @@ Identifier|Content format
(`string array`) The [output formats] to render.
[output formats]: /templates/output-formats
[output formats]: /templates/output-formats/
<!-- Added in v0.123.0 but purposefully omitted from documentation. -->
<!--
@@ -202,7 +202,7 @@ path
(`string`) The page publication date. Before the publication date, the page will not be rendered unless you pass the `--buildFuture` flag to the `hugo` command. Note that the TOML format also supports date/time values using unquoted strings. Access this value from a template using the [`PublishDate`] method on a `Page` object.
[`publishdate`]: /methods/page/publishdate
[`publishdate`]: /methods/page/publishdate/
###### resources
@@ -215,26 +215,26 @@ path
(`map`) A map of sitemap options. See the [sitemap templates] page for details. Access these values from a template using the [`Sitemap`] method on a `Page` object.
[sitemap templates]: /templates/sitemap-template/
[`sitemap`]: /methods/page/sitemap
[`sitemap`]: /methods/page/sitemap/
###### slug
(`string`) Overrides the last segment of the URL path. Not applicable to section pages. See the [URL management] page for details. Access this value from a template using the [`Slug`] method on a `Page` object.
[`slug`]: /methods/page/slug
[`slug`]: /methods/page/slug/
[URL management]: /content-management/urls/#slug
###### summary
(`string`) Conceptually different than the page `description`, the summary either summarizes the content or serves a teaser to encourage readers to visit the page. Access this value from a template using the [`Summary`] method on a `Page` object.
[`Summary`]: /methods/page/summary
[`Summary`]: /methods/page/summary/
###### title
(`string`) The page title. Access this value from a template using the [`Title`] method on a `Page` object.
[`title`]: /methods/page/title
[`title`]: /methods/page/title/
###### translationKey
@@ -247,7 +247,7 @@ path
(`string`) The [content type], overriding the value derived from the top level section in which the page resides. Access this value from a template using the [`Type`] method on a `Page` object.
[content type]: /getting-started/glossary/#content-type
[`type`]: /methods/page/type
[`type`]: /methods/page/type/
###### url
@@ -258,7 +258,7 @@ path
[page collection]: /getting-started/glossary/#page-collection
[weight]: /getting-started/glossary/#weight
[`weight`]: /methods/page/weight
[`weight`]: /methods/page/weight/
## Parameters
@@ -276,8 +276,8 @@ tags = ['red','blue']
Access these values from a template using the [`Params`] or [`Param`] method on a `Page` object.
[`param`]: /methods/page/param
[`params`]: /methods/page/params
[`param`]: /methods/page/param/
[`params`]: /methods/page/params/
## Cascade
@@ -500,11 +500,11 @@ If you change image processing methods or options, or if you rename or remove im
hugo --gc
```
[time.Format]: /functions/time/format
[time.Format]: /functions/time/format/
[`anchor`]: /content-management/image-processing#anchor
[mounted]: /hugo-modules/configuration#module-configuration-mounts
[page bundle]: /content-management/page-bundles
[`lang.FormatNumber`]: /functions/lang/formatnumber
[page bundle]: /content-management/page-bundles/
[`lang.FormatNumber`]: /functions/lang/formatnumber/
[filters]: /functions/images/filter/#image-filters
[github.com/disintegration/imaging]: <https://github.com/disintegration/imaging#image-resizing>
[Smartcrop]: <https://github.com/muesli/smartcrop#smartcrop>
+11 -11
View File
@@ -351,7 +351,7 @@ Private use subtags must not exceed 8 alphanumeric characters.
From within your templates, use the [`i18n`] function like this:
[`i18n`]: /functions/lang/translate
[`i18n`]: /functions/lang/translate/
```go-html-template
{{ i18n "home" }}
@@ -694,23 +694,23 @@ hugo new content content/en/post/test.md
hugo new content content/de/post/test.md
```
[`abslangurl`]: /functions/urls/abslangurl
[`abslangurl`]: /functions/urls/abslangurl/
[config]: /getting-started/configuration/
[contenttemplate]: /templates/single-page-templates/
[go-i18n-source]: https://github.com/nicksnyder/go-i18n
[go-i18n]: https://github.com/nicksnyder/go-i18n
[homepage]: /templates/homepage/
[Hugo Multilingual Part 1: Content translation]: https://regisphilibert.com/blog/2018/08/hugo-multilingual-part-1-managing-content-translation/
[i18func]: /functions/lang/translate
[lang.FormatAccounting]: /functions/lang/formataccounting
[lang.FormatCurrency]: /functions/lang/formatcurrency
[lang.FormatNumber]: /functions/lang/formatnumber
[lang.FormatNumberCustom]: /functions/lang/formatnumbercustom
[lang.FormatPercent]: /functions/lang/formatpercent
[i18func]: /functions/lang/translate/
[lang.FormatAccounting]: /functions/lang/formataccounting/
[lang.FormatCurrency]: /functions/lang/formatcurrency/
[lang.FormatNumber]: /functions/lang/formatnumber/
[lang.FormatNumberCustom]: /functions/lang/formatnumbercustom/
[lang.FormatPercent]: /functions/lang/formatpercent/
[lang.Merge]: /functions/lang/merge/
[menus]: /content-management/menus/
[OS environment]: /getting-started/configuration/#configure-with-environment-variables
[`rellangurl`]: /functions/urls/rellangurl
[RFC 5646]: https://tools.ietf.org/html/rfc5646
[`rellangurl`]: /functions/urls/rellangurl/
[RFC 5646]: https://tools.ietf.org/html/rfc564/
[single page templates]: /templates/single-page-templates/
[`time.Format`]: /functions/time/format
[`time.Format`]: /functions/time/format/
@@ -140,7 +140,7 @@ The `url` is the entire URL path, defined by the file path and optionally overri
[config]: /getting-started/configuration/
[formats]: /content-management/formats/
[front matter]: /content-management/front-matter/
[getpage]: /methods/page/getpage
[getpage]: /methods/page/getpage/
[homepage template]: /templates/homepage/
[homepage]: /templates/homepage/
[lists]: /templates/lists/
+4 -1
View File
@@ -77,7 +77,10 @@ With the file structure from the [example above](#overview):
1. The articles/2022 and articles/2023 directories do not have list pages; they are not sections.
1. The list page for the products section, by default, includes product-1 and product-2, but not their descendant pages. To include descendant pages, use the `.RegularPagesRecursive` collection instead of the `.Pages` collection in the list template. See&nbsp;[details](/variables/page/#page-collections).
1. The list page for the products section, by default, includes product-1 and product-2, but not their descendant pages. To include descendant pages, use the `RegularPagesRecursive` method instead of the `Pages` method in the list template.
[`Pages`]: /methods/page/pages/
[`RegularPagesRecursive`]: /methods/page/regularpagesrecursive/
1. All directories in the products section have list pages; each directory is a section.
+2 -2
View File
@@ -369,11 +369,11 @@ To learn more about creating custom shortcodes, see the [shortcode template docu
[figureelement]: https://html5doctor.com/the-figure-figcaption-elements/
[Hugo and the GDPR]: /about/hugo-and-gdpr/
[Instagram]: https://www.instagram.com/
[pagevariables]: /variables/page/
[pagevariables]: /methods/page/
[partials]: /templates/partials/
[quickstart]: /getting-started/quick-start/
[sctemps]: /templates/shortcode-templates/
[scvars]: /variables/shortcode/
[scvars]: /methods/shortcode/
[shortcode template documentation]: /templates/shortcode-templates/
[templatessection]: /templates/
[Vimeo]: https://vimeo.com/
+1 -1
View File
@@ -106,5 +106,5 @@ You can show content summaries with the following code. You could use the follow
Note how the `.Truncated` boolean variable value may be used to hide the "Read More..." link when the content is not truncated; i.e., when the summary contains the entire article.
[org]: /content-management/formats/
[pagevariables]: /variables/page/
[pagevariables]: /methods/page/
[section template]: /templates/section-templates/
+1 -1
View File
@@ -112,6 +112,6 @@ Hugo will take this AsciiDoc and create a table of contents store it in the page
[conditionals]: /templates/introduction/#conditionals
[front matter]: /content-management/front-matter/
[pagevars]: /variables/page/
[pagevars]: /methods/page/
[partials]: /templates/partials/
[single page template]: /templates/single-page-templates/
+4 -4
View File
@@ -96,7 +96,7 @@ Other guidelines to consider:
Level 6 markdown headings are styled as `dt` elements. This was implemented to support a [glossary] with linkable terms.
[glossary]: /getting-started/glossary
[glossary]: /getting-started/glossary/
## Code examples
@@ -210,7 +210,7 @@ Use the “deprecated-in” shortcode to indicate that a feature is deprecated:
{{%/* deprecated-in 0.120.0 */%}}
Use [`hugo.IsServer`] instead.
[`hugo.IsServer`]: /functions/hugo/isserver
[`hugo.IsServer`]: /functions/hugo/isserver/
{{%/* /deprecated-in */%}}
```
@@ -219,7 +219,7 @@ Rendered:
{{% deprecated-in 0.120.0 %}}
Use [`hugo.IsServer`] instead.
[`hugo.IsServer`]: /functions/hugo/isserver
[`hugo.IsServer`]: /functions/hugo/isserver/
{{% /deprecated-in %}}
### code
@@ -298,7 +298,7 @@ Use the "deprecated-in" shortcode to indicate that a feature is deprecated:
{{%/* deprecated-in 0.120.0 */%}}
Use [`hugo.IsServer`] instead.
[`hugo.IsServer`]: /functions/hugo/isserver
[`hugo.IsServer`]: /functions/hugo/isserver/
{{%/* /deprecated-in */%}}
{{< /code >}}
+2 -2
View File
@@ -65,7 +65,7 @@ You can use `after` in combination with the [`first`] function and Hugo's [power
{{ end }}
{{< /code >}}
[`first`]: /functions/collections/first
[list/section page]: /templates/section-templates
[`first`]: /functions/collections/first/
[list/section page]: /templates/section-templates/
[lists]: /templates/lists/#sort-content
[`slice`]: /functions/collections/slice/
@@ -58,7 +58,7 @@ To list everything except blog articles (`blog`) and frequently asked questions
{{% note %}}
Although the example above demonstrates the `complement` function, you could use the [`where`] function as well:
[`where`]: /functions/collections/where
[`where`]: /functions/collections/where/
{{% /note %}}
```go-html-template
+1 -1
View File
@@ -34,4 +34,4 @@ Use `first` and [`where`] together.
{{ end }}
```
[`where`]: /functions/collections/where
[`where`]: /functions/collections/where/
+1 -1
View File
@@ -14,7 +14,7 @@ aliases: [/functions/keyvals]
The primary application for this function is the definition of the `namedSlices` parameter in the options map passed to the [`Related`] method on the `Pages` object.
[`Related`]: /methods/pages/related
[`Related`]: /methods/pages/related/
See [related content](/content-management/related).
@@ -15,8 +15,8 @@ action:
The `collections.NewScratch` function creates a locally scoped [scratch pad] to store and manipulate data. To create a scratch pad that is attached to a `Page` object, use the [`Scratch`] or [`Store`] method.
[`Scratch`]: /methods/page/scratch
[`Store`]: /methods/page/store
[`Scratch`]: /methods/page/scratch/
[`Store`]: /methods/page/store/
[scratch pad]: /getting-started/glossary/#scratch-pad
## Methods
+1 -1
View File
@@ -144,7 +144,7 @@ After sorting:
{{% note %}}
Although you can use the `sort` function to sort a page collection, Hugo provides [sorting and grouping methods] as well.
[sorting and grouping methods]: /methods/pages
[sorting and grouping methods]: /methods/pages/
{{% /note %}}
In this contrived example, sort the site's regular pages by `.Type` in descending order:
+6 -6
View File
@@ -204,10 +204,10 @@ Use the `like` operator to compare string values. Comparing other data types wil
There are four predefined front matter dates: [`date`], [`publishDate`], [`lastmod`], and [`expiryDate`]. Regardless of the front matter data format (TOML, YAML, or JSON) these are [`time.Time`] values, allowing precise comparisons.
[`date`]: /methods/page/date
[`publishdate`]: /methods/page/publishdate
[`lastmod`]: /methods/page/lastmod
[`expirydate`]: /methods/page/expirydate
[`date`]: /methods/page/date/
[`publishdate`]: /methods/page/publishdate/
[`lastmod`]: /methods/page/lastmod/
[`expirydate`]: /methods/page/expirydate/
[`time.Time`]: https://pkg.go.dev/time#Time
For example, to return a collection of pages that were created before the current year:
@@ -288,7 +288,7 @@ These are equivalent:
Useful for theme authors, avoid hardcoding section names by using the `where` function with the [`MainSections`] method on a `Site` object.
[`MainSections`]: /methods/site/mainsections
[`MainSections`]: /methods/site/mainsections/
```go-html-template
{{ $pages := where .Site.RegularPages "Section" "in" .Site.MainSections }}
@@ -403,7 +403,7 @@ To exclude a page with an undefined field from a boolean _inequality_ test:
2. Create a collection using a nil comparison
3. Subtract the second collection from the first collection using the [`collections.Complement`] function.
[`collections.Complement`]: /functions/collections/complement
[`collections.Complement`]: /functions/collections/complement/
This template:
+1 -1
View File
@@ -21,7 +21,7 @@ When the second argument is the boolean `false` value, the `default` function re
To set a default value based on truthiness, use the [`or`] operator instead.
[`or`]: /functions/go-template/or
[`or`]: /functions/go-template/or/
{{% /note %}}
The `default` function returns the second argument if set:
+4 -4
View File
@@ -146,7 +146,7 @@ Consider using the [`resources.GetRemote`] function with [`transform.Unmarshal`]
{{ end }}
```
[`Resources.Get`]: methods/page/Resources
[`resources.GetRemote`]: /functions/resources/getremote
[`resources.Get`]: /functions/resources/get
[`transform.Unmarshal`]: /functions/transform/unmarshal
[`Resources.Get`]: /methods/page/resources/
[`resources.GetRemote`]: /functions/resources/getremote/
[`resources.Get`]: /functions/resources/get/
[`transform.Unmarshal`]: /functions/transform/unmarshal/
+4 -4
View File
@@ -148,7 +148,7 @@ Consider using the [`resources.GetRemote`] function with [`transform.Unmarshal`]
{{ end }}
```
[`Resources.Get`]: methods/page/Resources
[`resources.GetRemote`]: /functions/resources/getremote
[`resources.Get`]: /functions/resources/get
[`transform.Unmarshal`]: /functions/transform/unmarshal
[`Resources.Get`]: /methods/page/resources/
[`resources.GetRemote`]: /functions/resources/getremote/
[`resources.Get`]: /functions/resources/get/
[`transform.Unmarshal`]: /functions/transform/unmarshal/
+1 -1
View File
@@ -14,7 +14,7 @@ toc: true
Useful in a code block [render hook], the `diagram.Goat` function converts ASCII art to an SVG diagram, returning a [GoAT] diagram object with the following methods:
[GoAT]: https://github.com/blampe/goat#readme
[render hook]: /render-hooks
[render hook]: /render-hooks/
Inner
: (`template.HTML`) Returns the SVG child elements without a wrapping `svg` element, allowing you to create your own wrapper.
+1 -1
View File
@@ -24,4 +24,4 @@ The `errorf` function evaluates the format string, then prints the result to the
Use the [`erroridf`] function to allow optional suppression of specific errors.
[`erroridf`]: /functions/fmt/erroridf
[`erroridf`]: /functions/fmt/erroridf/
+1 -1
View File
@@ -38,4 +38,4 @@ To suppress this message:
ignoreLogs = ["error-42"]
{{< /code-toggle >}}
[`errorf`]: /functions/fmt/errorf
[`errorf`]: /functions/fmt/errorf/
+1 -1
View File
@@ -31,4 +31,4 @@ To prevent suppression of duplicate messages when using `warnf` for debugging, m
{{ end }}
```
[`math.Counter`]: /functions/math/counter
[`math.Counter`]: /functions/math/counter/
+1 -1
View File
@@ -40,4 +40,4 @@ To suppress this message:
ignoreLogs = ["warning-42"]
{{< /code-toggle >}}
[`warnf`]: /functions/fmt/warnf
[`warnf`]: /functions/fmt/warnf/
+2 -2
View File
@@ -101,8 +101,8 @@ When you call the [`Summary`] method, Hugo renders the page content including sh
If Hugo renders the section page before a content page, the cached rendered shortcode will be incorrect. You cannot control the rendering sequence due to concurrency.
[`Summary`]: /methods/page/summary
[`partialCached`]: /functions/partials/includecached
[`Summary`]: /methods/page/summary/
[`partialCached`]: /functions/partials/includecached/
[content view]: /getting-started/glossary/#content-view
[partial]: /getting-started/glossary/#partial
[render hook]: /getting-started/glossary/#render-hook
+2 -2
View File
@@ -48,8 +48,8 @@ Use with the [`template`] function:
{{ end }}
```
[`block`]: /functions/go-template/block
[`template`]: /functions/go-template/block
[`block`]: /functions/go-template/block/
[`template`]: /functions/go-template/block/
[`partial`]: /functions/partials/include/
{{% include "functions/go-template/_common/text-template.md" %}}
+3 -3
View File
@@ -64,6 +64,6 @@ Use `else if` to check multiple conditions.
{{% include "functions/go-template/_common/text-template.md" %}}
[`if`]: /functions/go-template/if
[`with`]: /functions/go-template/with
[`range`]: /functions/go-template/range
[`if`]: /functions/go-template/if/
[`with`]: /functions/go-template/with/
[`range`]: /functions/go-template/range/
+5 -5
View File
@@ -58,8 +58,8 @@ Use with the [`define`] statement:
{{% include "functions/go-template/_common/text-template.md" %}}
[`block`]: /functions/go-template/block
[`define`]: /functions/go-template/define
[`if`]: /functions/go-template/if
[`range`]: /functions/go-template/range
[`with`]: /functions/go-template/with
[`block`]: /functions/go-template/block/
[`define`]: /functions/go-template/define/
[`if`]: /functions/go-template/if/
[`range`]: /functions/go-template/range/
[`with`]: /functions/go-template/with/
+1 -1
View File
@@ -51,4 +51,4 @@ Use `else if` to check multiple conditions.
{{% include "functions/go-template/_common/text-template.md" %}}
[`else`]: /functions/go-template/else
[`else`]: /functions/go-template/else/
+4 -4
View File
@@ -75,7 +75,7 @@ This template will render the page title three times:
Gaining a thorough understanding of context is critical for anyone writing template code.
{{% /note %}}
[`seq`]: functions/collections/seq/
[`seq`]: /functions/collections/seq/
[context]: /getting-started/glossary/#context
## Array or slice of scalars
@@ -194,6 +194,6 @@ Unlike ranging over an array or slice, Hugo sorts by key when ranging over a map
{{% include "functions/go-template/_common/text-template.md" %}}
[`else`]: /functions/go-template/else
[`break`]: /functions/go-template/break
[`continue`]: /functions/go-template/continue
[`else`]: /functions/go-template/else/
[`break`]: /functions/go-template/break/
[`continue`]: /functions/go-template/continue/
+1 -1
View File
@@ -46,4 +46,4 @@ The example above can be rewritten using an [inline partial] template:
[`partial`]: /functions/partials/include/
[inline partial]: /templates/partials/#inline-partials
[internal templates]: /templates/internal
[internal templates]: /templates/internal/
+1 -1
View File
@@ -84,4 +84,4 @@ Gaining a thorough understanding of context is critical for anyone writing templ
{{% include "functions/go-template/_common/text-template.md" %}}
[`else`]: /functions/go-template/else
[`else`]: /functions/go-template/else/
+3 -3
View File
@@ -27,10 +27,10 @@ Supported image formats include GIF, JPEG, PNG, TIFF, and WebP.
{{% note %}}
This is a legacy function, superseded by the [`Width`] and [`Height`] methods for [global], [page], and [remote] resources. See the [image processing] section for details.
[`Width`]: /methods/resource/width
[`Height`]: /methods/resource/height
[`Width`]: /methods/resource/width/
[`Height`]: /methods/resource/height/
[global]: /getting-started/glossary/#global-resource
[image processing]: /content-management/image-processing
[image processing]: /content-management/image-processing/
[page]: /getting-started/glossary/#page-resource
[remote]: /getting-started/glossary/#remote-resource
{{% /note %}}
+1 -1
View File
@@ -40,7 +40,7 @@ To apply two or more filters, executing from left to right:
You can also apply image filters using the [`Filter`] method on a `Resource` object.
[`Filter`]: /methods/resource/filter
[`Filter`]: /methods/resource/filter/
## Example
+1 -1
View File
@@ -32,7 +32,7 @@ Create the filter:
Combine with the [`Colors`] method to create a border with one of the image's most dominant colors:
[`Colors`]: /methods/resource/colors
[`Colors`]: /methods/resource/colors/
```go-html-template
{{ with resources.Get "images/original.jpg" }}
+1 -1
View File
@@ -18,7 +18,7 @@ toc: true
This filter has the same options as the [`Process`] method on a `Resource` object, but using it as a filter may be more effective if you need to apply multiple filters to an image.
[`Process`]: /methods/resource/process
[`Process`]: /methods/resource/process/
The process specification is a space-delimited, case-insensitive list of one or more of the following in any sequence:
@@ -4,7 +4,7 @@
Apply the filter using the [`images.Filter`] function:
[`images.Filter`]: /functions/images/filter
[`images.Filter`]: /functions/images/filter/
```go-html-template
{{ with resources.Get "images/original.jpg" }}
@@ -16,7 +16,7 @@ Apply the filter using the [`images.Filter`] function:
You can also apply the filter using the [`Filter`] method on a `Resource` object:
[`Filter`]: methods/resource/filter
[`Filter`]: /methods/resource/filter/
```go-html-template
{{ with resources.Get "images/original.jpg" }}
@@ -16,5 +16,3 @@ aliases: [/functions/singularize]
```go-html-template
{{ "cats" | singularize }} → cat
```
See also the `.Data.Singular` [taxonomy variable](/variables/taxonomy/) for singularizing taxonomy names.
@@ -31,4 +31,4 @@ For a simpler function that adapts to the current language, see [`lang.FormatNum
{{% include "functions/_common/locales.md" %}}
[`lang.FormatNumber`]: /functions/lang/formatnumber
[`lang.FormatNumber`]: /functions/lang/formatnumber/
+2 -2
View File
@@ -27,8 +27,8 @@ Use this function to:
- Create unique warnings as shown above; the [`warnf`] function suppresses duplicate messages
- Create unique target paths for the `resources.FromString` function where the target path is also the cache key
[`warnf`]: /functions/fmt/warnf
[`resources.FromString`]: /functions/resources/fromstring
[`warnf`]: /functions/fmt/warnf/
[`resources.FromString`]: /functions/resources/fromstring/
{{% note %}}
Due to concurrency, the value returned in a given template for a given page will vary from one build to the next. You cannot use this function to assign a static id to each page.
+3 -3
View File
@@ -17,7 +17,7 @@ aliases: [/functions/partial]
Without a [`return`] statement, the `partial` function returns a string of type `template.HTML`. With a `return` statement, the `partial` function can return any data type.
[`return`]: /functions/go-template/return
[`return`]: /functions/go-template/return/
In this example we have three partial templates:
@@ -79,7 +79,7 @@ To return a value from a partial template, it must contain only one `return` sta
See&nbsp;[details][`return`].
[`return`]: /functions/go-template/return
[`return`]: /functions/go-template/return/
[breadcrumb navigation]: /content-management/sections/#ancestors-and-descendants
[details]: /functions/go-template/return
[details]: /functions/go-template/return/
@@ -62,4 +62,4 @@ To return a value from a partial template, it must contain only one `return` sta
See&nbsp;[details][`return`].
[`return`]: /functions/go-template/return
[`return`]: /functions/go-template/return/
+1 -1
View File
@@ -28,7 +28,7 @@ This function operates on global resources. A global resource is a file within t
For page resources, use the [`Resources.ByType`] method on the Page object.
[`Resources.ByType`]: /methods/page/resources
[`Resources.ByType`]: /methods/page/resources/
{{% /note %}}
[media type]: https://en.wikipedia.org/wiki/Media_type
+3 -3
View File
@@ -15,9 +15,9 @@ The `resources.Concat` function returns a concatenated slice of resources, cachi
Hugo publishes the resource to the target path when you call its [`Publish`], [`Permalink`], or [`RelPermalink`] methods.
[media type]: https://en.wikipedia.org/wiki/Media_type
[`publish`]: /methods/resource/publish
[`permalink`]: /methods/resource/permalink
[`relpermalink`]: /methods/resource/relpermalink
[`publish`]: /methods/resource/publish/
[`permalink`]: /methods/resource/permalink/
[`relpermalink`]: /methods/resource/relpermalink/
```go-html-template
{{ $plugins := resources.Get "js/plugins.js" }}
@@ -15,9 +15,9 @@ The `resources.ExecuteAsTemplate` function returns a resource created from a Go
Hugo publishes the resource to the target path when you call its [`Publish`], [`Permalink`], or [`RelPermalink`] methods.
[`publish`]: /methods/resource/publish
[`permalink`]: /methods/resource/permalink
[`relpermalink`]: /methods/resource/relpermalink
[`publish`]: /methods/resource/publish/
[`permalink`]: /methods/resource/permalink/
[`relpermalink`]: /methods/resource/relpermalink/
Let's say you have a CSS file that you wish to populate with values from your site configuration:
+6 -6
View File
@@ -15,9 +15,9 @@ The `resources.FromString` function returns a resource created from a string, ca
Hugo publishes the resource to the target path when you call its [`Publish`], [`Permalink`], or [`RelPermalink`] methods.
[`publish`]: /methods/resource/publish
[`permalink`]: /methods/resource/permalink
[`relpermalink`]: /methods/resource/relpermalink
[`publish`]: /methods/resource/publish/
[`permalink`]: /methods/resource/permalink/
[`relpermalink`]: /methods/resource/relpermalink/
Let's say you need to publish a file named "site.json" in the root of your public directory, containing the build date, the Hugo version used to build the site, and the date that the content was last modified. For example:
@@ -72,6 +72,6 @@ Combine `resources.FromString` with [`resources.ExecuteAsTemplate`] if your stri
{{ end }}
```
[`dict`]: /functions/collections/dictionary
[`jsonify`]: /functions/encoding/jsonify
[`resources.ExecuteAsTemplate`]: /functions/resources/executeastemplate
[`dict`]: /functions/collections/dictionary/
[`jsonify`]: /functions/encoding/jsonify/
[`resources.ExecuteAsTemplate`]: /functions/resources/executeastemplate/
+1 -1
View File
@@ -26,5 +26,5 @@ This function operates on global resources. A global resource is a file within t
For page resources, use the [`Resources.Get`] method on the Page object.
[`Resources.Get`]: /methods/page/resources
[`Resources.Get`]: /methods/page/resources/
{{% /note %}}
+1 -1
View File
@@ -26,7 +26,7 @@ This function operates on global resources. A global resource is a file within t
For page resources, use the [`Resources.GetMatch`] method on the Page object.
[`Resources.GetMatch`]: /methods/page/resources
[`Resources.GetMatch`]: /methods/page/resources/
{{% /note %}}
Hugo determines a match using a case-insensitive [glob pattern].
+3 -3
View File
@@ -69,7 +69,7 @@ You can also change the request method and set the request body:
When retrieving remote data, use the [`transform.Unmarshal`] function to [unmarshal] the response.
[`transform.Unmarshal`]: /functions/transform/unmarshal
[`transform.Unmarshal`]: /functions/transform/unmarshal/
[unmarshal]: /getting-started/glossary/#unmarshal
```go-html-template
@@ -90,7 +90,7 @@ When retrieving remote data, use the [`transform.Unmarshal`] function to [unmars
The [`Err`] method on a resource returned by the `resources.GetRemote` function returns an error message if the HTTP request fails, else nil. If you do not handle the error yourself, Hugo will fail the build.
[`Err`]: /methods/resource/err
[`Err`]: /methods/resource/err/
```go-html-template
{{ $url := "https://broken-example.org/images/a.jpg" }}
@@ -124,7 +124,7 @@ To log an error as a warning instead of an error:
The [`Data`] method on a resource returned by the `resources.GetRemote` function returns information from the HTTP response.
[`Data`]: /methods/resource/data
[`Data`]: /methods/resource/data/
```go-html-template
{{ $url := "https://example.org/images/a.jpg" }}
+1 -1
View File
@@ -26,7 +26,7 @@ This function operates on global resources. A global resource is a file within t
For page resources, use the [`Resources.Match`] method on the Page object.
[`Resources.Match`]: /methods/page/resources
[`Resources.Match`]: /methods/page/resources/
{{% /note %}}
Hugo determines a match using a case-insensitive [glob pattern].
+1 -1
View File
@@ -21,4 +21,4 @@ In contrast with the [`strings.RuneCount`] function, which counts every rune in
{{ "Hello, 世界" | strings.CountRunes }} → 8
```
[`strings.RuneCount`]: /functions/strings/runecount
[`strings.RuneCount`]: /functions/strings/runecount/
+1 -1
View File
@@ -21,4 +21,4 @@ In contrast with the [`strings.CountRunes`] function, which excludes whitespace,
{{ "Hello, 世界" | strings.RuneCount }} → 9
```
[`strings.CountRunes`]: /functions/strings/countrunes
[`strings.CountRunes`]: /functions/strings/countrunes/
+1 -1
View File
@@ -22,5 +22,5 @@ Examples:
{{% note %}}
The `strings.Split` function essentially does the opposite of the [`collections.Delimit`] function. While `split` creates a slice from a string, `delimit` creates a string from a slice.
[`collections.Delimit`]: /functions/collections/delimit
[`collections.Delimit`]: /functions/collections/delimit/
{{% /note %}}
+1 -1
View File
@@ -20,5 +20,5 @@ Since Go templates are HTML-aware, `truncate` will intelligently handle normal s
{{% note %}}
If you have a raw string that contains HTML tags you want to remain treated as HTML, you will need to convert the string to HTML using the [`safeHTML`]function before sending the value to `truncate`. Otherwise, the HTML tags will be escaped when passed through the `truncate` function.
[`safeHTML`]: /functions/safe/html
[`safeHTML`]: /functions/safe/html/
{{% /note %}}
+1 -1
View File
@@ -43,4 +43,4 @@ microseconds|`microsecond`, `us`, `µs`
nanoseconds|`nanosecond`, `ns`
[`time.Duration`]: https://pkg.go.dev/time#Duration
[methods]: /methods/duration
[methods]: /methods/duration/
+1 -1
View File
@@ -43,6 +43,6 @@ The `time.Now` function returns a `time.Time` value, so you can chain any of the
{{ time.Now.Unix }} → 1697400955 (int64)
```
[`time.Format`]: /functions/time/format
[`time.Format`]: /functions/time/format/
[localize]: /getting-started/glossary/#localization
[time methods]: /methods/time/
+1 -1
View File
@@ -34,4 +34,4 @@ There are 86400 seconds in one day.
```
[`time.Duration`]: https://pkg.go.dev/time#Duration
[methods]: /methods/duration
[methods]: /methods/duration/
@@ -25,6 +25,6 @@ In most contexts Go's [html/template] package will escape special characters. To
{{ htmlUnescape "Lilo &amp; Stitch" | safeHTML }}
```
[`safehtml`]: /functions/safe/html
[`safehtml`]: /functions/safe/html/
[html entities]: https://developer.mozilla.org/en-us/docs/glossary/entity
[html/template]: https://pkg.go.dev/html/template
@@ -26,6 +26,6 @@ To keep the wrapping `p` tags for a single paragraph, use the [`RenderString`] m
{{% note %}}
Although the `markdownify` function honors [markdown render hooks] when rendering markdown to HTML, use the `RenderString` method instead of `markdownify` if a render hook accesses `.Page` context. See issue [#9692] for details.
[markdown render hooks]: /render-hooks
[markdown render hooks]: /render-hooks/
[#9692]: https://github.com/gohugoio/hugo/issues/9692
{{% /note %}}
+2 -2
View File
@@ -113,7 +113,7 @@ A remote resource is a file on a remote server, accessible via HTTP or HTTPS.
```
[resource]: /getting-started/glossary/#resource
[page bundle]: /content-management/page-bundles
[page bundle]: /content-management/page-bundles/
## Options
@@ -288,5 +288,5 @@ Hugo renders this to:
</ul>
```
[`index`]: /functions/collections/indexfunction
[`index`]: /functions/collections/indexfunction/
[identifiers]: https://go.dev/ref/spec#Identifiers
+1 -1
View File
@@ -27,4 +27,4 @@ aliases: [/functions/urls.joinpath]
Unlike the [`path.Join`] function, `urls.JoinPath` retains consecutive leading slashes.
[`path.Join`]: /functions/path/join
[`path.Join`]: /functions/path/join/
@@ -4,8 +4,8 @@
The [`anchorize`] and [`urlize`] functions are similar:
[`anchorize`]: /functions/urls/anchorize
[`urlize`]: /functions/urls/urlize
[`anchorize`]: /functions/urls/anchorize/
[`urlize`]: /functions/urls/urlize/
- Use the `anchorize` function to generate an HTML `id` attribute value
- Use the `urlize` function to sanitize a string for usage in a URL
+4 -4
View File
@@ -626,7 +626,7 @@ firstupper
none
: Disable transformation of automatic section titles, and disable the transformation performed by the `strings.Title` function. This is useful if you would prefer to manually capitalize section titles as needed, and to bypass opinionated theme usage of the `strings.Title` function.
[`strings.Title`]: /functions/strings/title
[`strings.Title`]: /functions/strings/title/
[Associated Press Stylebook]: https://www.apstylebook.com/
[Chicago Manual of Style]: https://www.chicagomanualofstyle.org/home.html
[site configuration]: /getting-started/configuration/#configure-title-case
@@ -779,9 +779,9 @@ If this is not set, Hugo will use, in order of preference:
If you want to know the current value of `cacheDir`, you can run `hugo config`, e.g: `hugo config | grep cachedir`.
[`time`]: /functions/time/astime
[`.Site.Params`]: /variables/site/
[directory structure]: /getting-started/directory-structure
[`time`]: /functions/time/astime/
[`.Site.Params`]: /method/site/params/
[directory structure]: /getting-started/directory-structure/
[lookup order]: /templates/lookup-order/
[Output Formats]: /templates/output-formats/
[templates]: /templates/
+10 -10
View File
@@ -116,7 +116,7 @@ When running the built-in development server with the `hugo server` command, the
To determine the current environment within a template, use the [`hugo.Environment`] function.
[`hugo.Environment`]: /functions/hugo/environment
[`hugo.Environment`]: /functions/hugo/environment/
###### field
@@ -151,10 +151,10 @@ Used within a [template action](#template-action), a function takes one or more
A file within the assets directory, or within any directory [mounted](/hugo-modules/configuration/#module-configuration-mounts) to the assets directory. Capture one or more global resources using the [`resources.Get`], [`resources.GetMatch`], [`resources.Match`], or [`resources.ByType`] functions.
[`resources.Get`]: /functions/resources/get
[`resources.GetMatch`]: /functions/resources/getmatch
[`resources.Match`]: /functions/resources/match
[`resources.ByType`]: /functions/resources/byType
[`resources.Get`]: /functions/resources/get/
[`resources.GetMatch`]: /functions/resources/getmatch/
[`resources.Match`]: /functions/resources/match/
[`resources.ByType`]: /functions/resources/byType/
###### identifier
@@ -234,8 +234,8 @@ A data structure with or without associated [methods](#method).
Created by invoking the [`Alphabetical`] or [`ByCount`] method on a [taxonomy object](#taxonomy-object), which is a [map](#map), an ordered taxonomy is a [slice](#slice), where each element is an object that contains the [term](#term) and a slice of its [weighted pages](#weighted-page).
[`Alphabetical`]: /methods/taxonomy/alphabetical
[`ByCount`]: /methods/taxonomy/bycount
[`Alphabetical`]: /methods/taxonomy/alphabetical/
[`ByCount`]: /methods/taxonomy/bycount/
###### output format
@@ -329,9 +329,9 @@ A single value, one of [string](#string), [integer](#integer), [floating point](
Conceptually, a [map](#map) with [methods](#method) to set, get, update, and delete values. Attach the data structure to a `Page` object using the [`Scratch`] or [`Store`] methods, or created a locally scoped scratch pad using the [`newScratch`] function.
[`Scratch`]: /methods/page/scratch
[`Store`]: /methods/page/store
[`newScratch`]: /functions/collections/newscratch
[`Scratch`]: /methods/page/scratch/
[`Store`]: /methods/page/store/
[`newScratch`]: /functions/collections/newscratch/
###### section
+2 -2
View File
@@ -216,13 +216,13 @@ Hugo's [forum] is an active community of users and developers who answer questio
For other resources to help you learn Hugo, including books and video tutorials, see the [external learning resources](/getting-started/external-learning-resources/) page.
[Ananke]: https://github.com/theNewDynamic/gohugo-theme-ananke
[directory structure]: /getting-started/directory-structure
[directory structure]: /getting-started/directory-structure/
[draft, future, and expired content]: /getting-started/usage/#draft-future-and-expired-content
[draft, future, or expired content]: /getting-started/usage/#draft-future-and-expired-content
[external learning resources]:/getting-started/external-learning-resources/
[forum]: https://discourse.gohugo.io/
[forum]: https://discourse.gohugo.io/
[front matter]: /content-management/front-matter
[front matter]: /content-management/front-matter/
[Git submodule]: https://git-scm.com/book/en/v2/Git-Tools-Submodules
[hosting and deployment]: /hosting-and-deployment/
[Install Git]: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
@@ -16,7 +16,7 @@ Please consult your operating system documentation if you need help setting file
If you do not see a prebuilt binary for the desired edition, operating system, and architecture, install Hugo using one of the methods described below.
[commit information]: /variables/git
[commit information]: /methods/page/gitinfo/
[Git]: https://git-scm.com/
[Go]: https://go.dev/
[Hugo Modules]: /hugo-modules/
@@ -9,10 +9,10 @@ The `Next` and `Prev` methods on a `Pages` object are more flexible than the `Ne
[`PAGES.Next`] and [`PAGES.Prev`]|locally defined|✔️
[`PAGE.Next`] and [`PAGE.Prev`]|globally defined|❌
[`PAGES.Next`]: /methods/pages/next
[`PAGES.Prev`]: /methods/pages/prev
[`PAGE.Next`]: /methods/page/next
[`PAGE.Prev`]: /methods/page/prev
[`PAGES.Next`]: /methods/pages/next/
[`PAGES.Prev`]: /methods/pages/prev/
[`PAGE.Next`]: /methods/page/next/
[`PAGE.Prev`]: /methods/page/prev/
locally defined
: Build the page collection every time you call `PAGES.Next` and `PAGES.Prev`. Navigation between pages is relative to the current page's position within the local collection, independent of the global collection.
@@ -31,7 +31,7 @@ With a global collection, the navigation sort order is fixed, using Hugo's defau
For example, with a global collection sorted by title, the navigation sort order will use Hugo's default sort order. This is probably not what you want or expect. For this reason, the `Next` and `Prev` methods on a `Pages` object are generally a better choice.
[date]: /methods/page/date
[weight]: /methods/page/weight
[linkTitle]: /methods/page/linktitle
[title]: /methods/page/title
[date]: /methods/page/date/
[weight]: /methods/page/weight/
[linkTitle]: /methods/page/linktitle/
[title]: /methods/page/title/
+1 -1
View File
@@ -36,4 +36,4 @@ This example uses the `KeyName` method when querying the translation table on a
In the example above, we need to pass the value returned by `.KeyName` through the [`lower`] function because the keys in the translation table are lowercase.
[`lower`]: functions/strings/tolower
[`lower`]: /functions/strings/tolower/
+2 -2
View File
@@ -19,6 +19,6 @@ action:
Use this method with the [`IsMenuCurrent`] and [`HasMenuCurrent`] methods on a `Page` object to set "active" and "ancestor" classes on a rendered entry. See [this example].
[`HasMenuCurrent`]: /methods/page/hasmenucurrent
[`IsMenuCurrent`]: /methods/page/ismenucurrent
[`HasMenuCurrent`]: /methods/page/hasmenucurrent/
[`IsMenuCurrent`]: /methods/page/ismenucurrent/
[this example]: /templates/menu-templates/#example
+2 -2
View File
@@ -13,8 +13,8 @@ If you define the menu entry [automatically], the `Name` method returns the page
If you define the menu entry [in front matter] or [in site configuration], the `Name` method returns the `name` property, falling back to the pages `LinkTitle`, then to its `Title`.
[`LinkTitle`]: /methods/page/linktitle
[`Title`]: /methods/page/title
[`LinkTitle`]: /methods/page/linktitle/
[`Title`]: /methods/page/title/
[automatically]: /content-management/menus/#define-automatically
[in front matter]: /content-management/menus/#define-in-front-matter
[in site configuration]: /content-management/menus/#define-in-site-configuration
+3 -3
View File
@@ -46,8 +46,8 @@ If the entry is not associated with a page, we use its `url` and `name` properti
See the [menu templates] section for more information.
[`LinkTitle`]: /methods/page/linktitle
[`RelPermalink`]: /methods/page/relpermalink
[`LinkTitle`]: /methods/page/linktitle/
[`RelPermalink`]: /methods/page/relpermalink/
[define menu entries]: /content-management/menus/
[menu templates]: /templates/menu-templates/#page-references
[methods]: /methods/page
[methods]: /methods/page/
+2 -2
View File
@@ -13,8 +13,8 @@ If you define the menu entry [automatically], the `Title` method returns the pag
If you define the menu entry [in front matter] or [in site configuration], the `Name` method returns the `title` property, falling back to the pages `LinkTitle`, then to its `Title`.
[`LinkTitle`]: /methods/page/linktitle
[`Title`]: /methods/page/title
[`LinkTitle`]: /methods/page/linktitle/
[`Title`]: /methods/page/title/
[automatically]: /content-management/menus/#define-automatically
[in front matter]: /content-management/menus/#define-in-front-matter
[in site configuration]: /content-management/menus/#define-in-site-configuration
+1 -1
View File
@@ -20,4 +20,4 @@ For menu entries associated with a page, the `URL` method returns the page's [`R
</ul>
```
[`RelPermalink`]: /methods/page/relpermalink
[`RelPermalink`]: /methods/page/relpermalink/
+1 -1
View File
@@ -13,7 +13,7 @@ If you define the menu entry [automatically], the `Weight` method returns the pa
If you define the menu entry [in front matter] or [in site configuration], the `Weight` method returns the `weight` property, falling back to the pages `Weight`.
[`Weight`]: /methods/page/weight
[`Weight`]: /methods/page/weight/
[automatically]: /content-management/menus/#define-automatically
[in front matter]: /content-management/menus/#define-in-front-matter
[in site configuration]: /content-management/menus/#define-in-site-configuration
+1 -1
View File
@@ -62,4 +62,4 @@ You can also sort menu entries using the [`sort`] function. For example, to sort
When using the sort function with menu entries, specify any of the following keys: `Identifier`, `Name`, `Parent`, `Post`, `Pre`, `Title`, `URL`, or `Weight`.
[`sort`]: /functions/collections/sort
[`sort`]: /functions/collections/sort/
+1 -1
View File
@@ -73,4 +73,4 @@ You can also sort menu entries using the [`sort`] function. For example, to sort
When using the sort function with menu entries, specify any of the following keys: `Identifier`, `Name`, `Parent`, `Post`, `Pre`, `Title`, `URL`, or `Weight`.
[`sort`]: /functions/collections/sort
[`sort`]: /functions/collections/sort/
+1 -1
View File
@@ -63,4 +63,4 @@ Render the code owners for each content page:
Combine this method with [`resources.GetRemote`] to retrieve names and avatars from your Git provider by querying their API.
[`resources.GetRemote`]: functions/resources/getremote
[`resources.GetRemote`]: /functions/resources/getremote/
+1 -1
View File
@@ -74,7 +74,7 @@ Terms
{{% note %}}
Once you have captured the taxonomy object, use any of the [taxonomy methods] to sort, count, or capture a subset of its weighted pages.
[taxonomy methods]: /methods/taxonomy
[taxonomy methods]: /methods/taxonomy/
{{% /note %}}
Learn more about [taxonomy templates].
+2 -2
View File
@@ -33,7 +33,7 @@ The date is a [time.Time] value. Format and localize the value with the [`time.F
In the example above we explicitly set the date in front matter. With Hugo's default configuration, the `Date` method returns the front matter value. This behavior is configurable, allowing you to set fallback values if the date is not defined in front matter. See&nbsp;[details].
[`time.Format`]: /functions/time/format
[`time.Format`]: /functions/time/format/
[details]: /getting-started/configuration/#configure-dates
[time methods]: /methods/time
[time methods]: /methods/time/
[time.Time]: https://pkg.go.dev/time#Time
+1 -1
View File
@@ -25,4 +25,4 @@ description = 'Instructions for making spicy tuna hand rolls.'
</head>
{{< /code >}}
[content summary]: /content-management/summaries
[content summary]: /content-management/summaries/
+2 -2
View File
@@ -29,7 +29,7 @@ The expiry date is a [time.Time] value. Format and localize the value with the [
In the example above we explicitly set the expiry date in front matter. With Hugo's default configuration, the `ExpiryDate` method returns the front matter value. This behavior is configurable, allowing you to set fallback values if the expiry date is not defined in front matter. See&nbsp;[details].
[`time.Format`]: /functions/time/format
[`time.Format`]: /functions/time/format/
[details]: /getting-started/configuration/#configure-dates
[time methods]: /methods/time
[time methods]: /methods/time/
[time.Time]: https://pkg.go.dev/time#Time
+2 -2
View File
@@ -100,7 +100,7 @@ When using the `Fragments` methods within a shortcode, call the shortcode using
[fragment]: /getting-started/glossary/#fragment
[markdown attribute]: /getting-started/glossary/#markdown-attribute
[setext]: https://spec.commonmark.org/0.30/#setext-headings
[table of contents]: /methods/page/tableofcontents
[table of contents]: /methods/page/tableofcontents/
[walking]: /getting-started/glossary/#walk
[`tableofcontents`]: /methods/page/tableofcontents
[`tableofcontents`]: /methods/page/tableofcontents/
[render hook]: /getting-started/glossary/#render-hook
+1 -1
View File
@@ -17,4 +17,4 @@ action:
To get the exact word count, use the [`WordCount`] method.
[`WordCount`]: /methods/page/wordcount
[`WordCount`]: /methods/page/wordcount/
+1 -1
View File
@@ -13,7 +13,7 @@ aliases: [/functions/getpage]
The `GetPage` method is also available on a `Site` object. See&nbsp;[details].
[details]: /methods/site/getpage
[details]: /methods/site/getpage/
When using the `GetPage` method on the `Page` object, specify a path relative to the current directory or relative to the content directory.
+1 -1
View File
@@ -14,5 +14,5 @@ action:
Use in conjunction with the [`Related`] method on a [`Pages`] object. See&nbsp;[details].
[`Pages`]: /methods/pages/
[`Related`]: /methods/pages/related
[`Related`]: /methods/pages/related/
[details]: /content-management/related/#index-content-headings-in-related-content
+2 -2
View File
@@ -98,5 +98,5 @@ Gaining a thorough understanding of context is critical for anyone writing templ
{{% /note %}}
[context]: /getting-started/glossary/#context
[`with`]: /functions/go-template/with
[`else`]: /functions/go-template/else
[`with`]: /functions/go-template/with/
[`else`]: /functions/go-template/else/
+2 -2
View File
@@ -96,5 +96,5 @@ Gaining a thorough understanding of context is critical for anyone writing templ
{{% /note %}}
[context]: /getting-started/glossary/#context
[`with`]: /functions/go-template/with
[`else`]: /functions/go-template/else
[`with`]: /functions/go-template/with/
[`else`]: /functions/go-template/else/
+2 -2
View File
@@ -95,5 +95,5 @@ Gaining a thorough understanding of context is critical for anyone writing templ
{{% /note %}}
[context]: /getting-started/glossary/#context
[`with`]: /functions/go-template/with
[`else`]: /functions/go-template/else
[`with`]: /functions/go-template/with/
[`else`]: /functions/go-template/else/
+3 -3
View File
@@ -11,7 +11,7 @@ action:
By default, Hugo evaluates the keywords when creating collections of [related content].
[related content]: /content-management/related
[related content]: /content-management/related/
{{< code-toggle file=content/recipes/sushi.md fm=true >}}
title = 'How to make spicy tuna hand rolls'
@@ -32,7 +32,7 @@ Or use the [delimit] function:
{{ delimit .Keywords ", " ", and " }} → tuna, sriracha, nori, and rice
```
[delimit]: /functions/collections/delimit
[delimit]: /functions/collections/delimit/
Keywords are also a useful [taxonomy]:
@@ -43,4 +43,4 @@ keyword = 'keywords'
category = 'categories'
{{< /code-toggle >}}
[taxonomy]: /content-management/taxonomies
[taxonomy]: /content-management/taxonomies/
+1 -1
View File
@@ -61,5 +61,5 @@ Weight
{{ .Language.Weight }} → 2
```
[details]: /methods/site/language
[details]: /methods/site/language/
[RFC 5646]: https://datatracker.ietf.org/doc/html/rfc5646
+3 -3
View File
@@ -33,8 +33,8 @@ In the example above we explicitly set the last modification date in front matte
Learn more about [date configuration].
[`gitinfo`]: /methods/page/gitinfo
[`time.format`]: /functions/time/format
[`gitinfo`]: /methods/page/gitinfo/
[`time.format`]: /functions/time/format/
[date configuration]: /getting-started/configuration/#configure-dates
[time methods]: /methods/time
[time methods]: /methods/time/
[time.time]: https://pkg.go.dev/time#time
+1 -1
View File
@@ -12,7 +12,7 @@ action:
The `LinkTitle` method returns the `linkTitle` field as defined in front matter, falling back to the value returned by the [`Title`] method.
[`Title`]: /methods/page/title
[`Title`]: /methods/page/title/
{{< code-toggle file=content/articles/healthy-desserts.md fm=true >}}
title = 'Seventeen delightful recipes for healthy desserts'
+4 -4
View File
@@ -65,7 +65,7 @@ With the `PrevInSection` and `NextInSection` methods, the navigation sort order
For example, with a page collection sorted by title, the navigation sort order will use Hugos default sort order. This is probably not what you want or expect. For this reason, the Next and Prev methods on a Pages object are generally a better choice.
[date]: /methods/page/date
[weight]: /methods/page/weight
[linkTitle]: /methods/page/linktitle
[title]: /methods/page/title
[date]: /methods/page/date/
[weight]: /methods/page/weight/
[linkTitle]: /methods/page/linktitle/
[title]: /methods/page/title/
+1 -1
View File
@@ -75,7 +75,7 @@ In the last example, the collection includes pages in the resources subdirectory
{{% note %}}
When used with a `Site` object, the `Pages` method recursively returns all pages within the site. See&nbsp;[details].
[details]: /methods/site/pages
[details]: /methods/site/pages/
{{% /note %}}
```go-html-template
+1 -1
View File
@@ -28,7 +28,7 @@ Although simple to invoke, with the `Paginator` method you can neither filter no
The [`Paginate`] method is more flexible, and strongly recommended.
[`paginate`]: /methods/page/paginate
[`paginate`]: /methods/page/paginate/
{{% /note %}}
{{% note %}}
+1 -1
View File
@@ -39,6 +39,6 @@ In the template example above, each of the keys is a valid identifier. For examp
{{ index .Params "key-with-hyphens" }} → 2023
```
[`index`]: /functions/collections/indexfunction
[`index`]: /functions/collections/indexfunction/
[chaining]: /getting-started/glossary/#chain
[identifiers]: /getting-started/glossary/#identifier

Some files were not shown because too many files have changed in this diff Show More