mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-24 07:18:54 +00:00
Merge commit 'e7afabb927a79b179ae57013fd5f49e32829671e'
This commit is contained in:
+1
-1
@@ -7,7 +7,7 @@
|
||||
skip = *.ai,chroma.css,chroma_dark.css,.cspell.json,./data/docs.yaml
|
||||
|
||||
# Comma separated list of words to be ignored. Words must be lowercased.
|
||||
ignore-words-list = abl,edn,januar,te,trys,ue,womens
|
||||
ignore-words-list = abl,edn,ist,januar,te,trys,ue,womens
|
||||
|
||||
# Check file names as well.
|
||||
check-filenames = true
|
||||
|
||||
+26
-25
@@ -26,24 +26,24 @@
|
||||
"**/tools/*"
|
||||
],
|
||||
"ignoreRegExpList": [
|
||||
"# cspell: ignore fenced code blocks",
|
||||
// cspell: ignore fenced code blocks
|
||||
"^(\\s*`{3,}).*[\\s\\S]*?^\\1$",
|
||||
"# cspell: ignore words joined with dot",
|
||||
// cspell: ignore words joined with dot
|
||||
"\\w+\\.\\w+",
|
||||
"# cspell: ignore strings within backticks",
|
||||
// cspell: ignore strings within backticks
|
||||
"`.+`",
|
||||
"# cspell: ignore strings within double quotes",
|
||||
// cspell: ignore strings within double quotes
|
||||
"\".+\"",
|
||||
"# cspell: ignore strings within brackets",
|
||||
// cspell: ignore strings within brackets
|
||||
"\\[.+\\]",
|
||||
"# cspell: ignore strings within parentheses",
|
||||
// cspell: ignore strings within parentheses
|
||||
"\\(.+\\)",
|
||||
"# cspell: ignore words that begin with a slash",
|
||||
// cspell: ignore words that begin with a slash
|
||||
"/\\w+",
|
||||
"# cspell: ignore everything within action delimiters",
|
||||
// cspell: ignore everything within action delimiters
|
||||
"\\{\\{.+\\}\\}",
|
||||
"# cspell: ignore everything after a right arrow",
|
||||
"\\s+→\\s+.+"
|
||||
// cspell: ignore everything after a right arrow
|
||||
"\\s+→\\s+.+",
|
||||
],
|
||||
"language": "en",
|
||||
"words": [
|
||||
@@ -76,9 +76,9 @@
|
||||
"unmarshaled",
|
||||
"unmarshaling",
|
||||
"unmarshals",
|
||||
"# ----------------------------------------------------------------------",
|
||||
"# cspell: ignore hugo terminology",
|
||||
"# ----------------------------------------------------------------------",
|
||||
// ------------------------------------------------------------------------
|
||||
// cspell: ignore hugo terminology",
|
||||
// ------------------------------------------------------------------------
|
||||
"alignx",
|
||||
"aligny",
|
||||
"attrlink",
|
||||
@@ -101,9 +101,9 @@
|
||||
"unmarshal",
|
||||
"unpublishdate",
|
||||
"zgotmplz",
|
||||
"# ----------------------------------------------------------------------",
|
||||
"# cspell: ignore foreign language words",
|
||||
"# ----------------------------------------------------------------------",
|
||||
// ------------------------------------------------------------------------
|
||||
// cspell: ignore foreign language words",
|
||||
// ------------------------------------------------------------------------
|
||||
"bezpieczeństwo",
|
||||
"blatt",
|
||||
"buch",
|
||||
@@ -129,9 +129,9 @@
|
||||
"prywatność",
|
||||
"referenz",
|
||||
"régime",
|
||||
"# ----------------------------------------------------------------------",
|
||||
"# cspell: ignore names",
|
||||
"# ----------------------------------------------------------------------",
|
||||
// ------------------------------------------------------------------------
|
||||
// cspell: ignore names",
|
||||
// ------------------------------------------------------------------------
|
||||
"Atishay",
|
||||
"Cosette",
|
||||
"Eliott",
|
||||
@@ -142,14 +142,15 @@
|
||||
"Ninke",
|
||||
"Noll",
|
||||
"Pastorius",
|
||||
"Pontmercy",
|
||||
"Samsa",
|
||||
"Stucki",
|
||||
"Thénardier",
|
||||
"Vitter",
|
||||
"WASI",
|
||||
"# ----------------------------------------------------------------------",
|
||||
"# cspell: ignore operating systems and software packages",
|
||||
"# ----------------------------------------------------------------------",
|
||||
// ------------------------------------------------------------------------
|
||||
// cspell: ignore operating systems and software packages",
|
||||
// ------------------------------------------------------------------------
|
||||
"asciidoctor",
|
||||
"brotli",
|
||||
"cifs",
|
||||
@@ -171,9 +172,9 @@
|
||||
"pkgin",
|
||||
"rclone",
|
||||
"xubuntu",
|
||||
"# ----------------------------------------------------------------------",
|
||||
"# cspell: ignore miscellaneous",
|
||||
"# ----------------------------------------------------------------------",
|
||||
// ------------------------------------------------------------------------
|
||||
// cspell: ignore miscellaneous",
|
||||
// ------------------------------------------------------------------------
|
||||
"achristie",
|
||||
"ccpa",
|
||||
"cpra",
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
_comment: Do not remove front matter.
|
||||
---
|
||||
|
||||
Hugo uses Go's [text/template] and [html/template] packages.
|
||||
Hugo uses Go's [`text/template`][] and [`html/template`][] packages.
|
||||
|
||||
The text/template package implements data-driven templates for generating textual output, while the html/template package implements data-driven templates for generating HTML output safe against code injection.
|
||||
The `text/template` package implements data-driven templates for generating textual output, while the `html/template` package implements data-driven templates for generating HTML output safe against code injection.
|
||||
|
||||
By default, Hugo uses the html/template package when rendering HTML files.
|
||||
By default, Hugo uses the `html/template` package when rendering HTML files.
|
||||
|
||||
To generate HTML output that is safe against code injection, the html/template package escapes strings in certain contexts.
|
||||
To generate HTML output that is safe against code injection, the `html/template` package escapes strings in certain contexts.
|
||||
|
||||
[text/template]: https://pkg.go.dev/text/template
|
||||
[html/template]: https://pkg.go.dev/html/template
|
||||
[`text/template`]: https://pkg.go.dev/text/template
|
||||
[`html/template`]: https://pkg.go.dev/html/template
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
_comment: Do not remove front matter.
|
||||
---
|
||||
|
||||
See Go's [text/template] documentation for more information.
|
||||
See Go's [`text/template`][] documentation for more information.
|
||||
|
||||
[text/template]: https://pkg.go.dev/text/template
|
||||
[`text/template`]: https://pkg.go.dev/text/template
|
||||
|
||||
@@ -18,7 +18,7 @@ params
|
||||
Note that this is meant for small data sets, e.g., configuration settings. For larger data sets, please put/mount the files into `assets` and import them directly.
|
||||
|
||||
minify
|
||||
: (`bool`) Whether to let `js.Build` handle the minification.
|
||||
: (`bool`) Whether to minify the generated CSS code. Default is `false`.
|
||||
|
||||
loaders
|
||||
: {{< new-in 0.140.0 />}}
|
||||
@@ -77,11 +77,11 @@ drop
|
||||
: See <https://esbuild.github.io/api/#drop>
|
||||
|
||||
sourceMap
|
||||
: (`string`) Whether to generate `inline`, `linked`, or `external` source maps from esbuild. Linked and external source maps will be written to the target with the output file name + ".map". When `linked` a `sourceMappingURL` will also be written to the output file. By default, source maps are not created. Note that the `linked` option was added in Hugo 0.140.0.
|
||||
: (`string`) The type of source map to generate. One of `external`, `inline`, `linked`, or `none`. Default is `none`. Linked and external source maps will be written to the target with the output file name + ".map". When `linked` a `sourceMappingURL` will also be written to the output file.
|
||||
|
||||
sourcesContent
|
||||
: {{< new-in 0.140.0 />}}
|
||||
: (`bool`) Whether to include the content of the source files in the source map. By default, this is `true`.
|
||||
: (`bool`) Whether to include the content of the source files in the source map. Default is `true`.
|
||||
|
||||
JSX
|
||||
: (`string`) How to handle/transform JSX syntax. One of: `transform`, `preserve`, `automatic`. Default is `transform`. Notably, the `automatic` transform was introduced in React 17+ and will cause the necessary JSX helper functions to be imported automatically. See <https://esbuild.github.io/api/#jsx>.
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
---
|
||||
_comment: Do not remove front matter.
|
||||
---
|
||||
|
||||
## Image operations
|
||||
|
||||
Use these functions to determine which operations Hugo supports for a given resource. While Hugo classifies a variety of file types as image resources, its ability to process them or extract metadata varies by format.
|
||||
|
||||
- [`reflect.IsImageResource`][]: {{% get-page-desc "/functions/reflect/isimageresource" %}}
|
||||
- [`reflect.IsImageResourceProcessable`][]: {{% get-page-desc "/functions/reflect/isimageresourceprocessable" %}}
|
||||
- [`reflect.IsImageResourceWithMeta`][]: {{% get-page-desc "/functions/reflect/isimageresourcewithmeta" %}}
|
||||
|
||||
The table below shows the values these functions return for various file formats. Use it to determine which checks are required before calling specific methods in your templates.
|
||||
|
||||
|Format|IsImageResource|IsImageResourceProcessable|IsImageResourceWithMeta|
|
||||
|:-----|:--------------|:-------------------------|:----------------------|
|
||||
|AVIF |true |**false** |true |
|
||||
|BMP |true |true |true |
|
||||
|GIF |true |true |true |
|
||||
|HEIC |true |**false** |true |
|
||||
|HEIF |true |**false** |true |
|
||||
|ICO |true |**false** |**false** |
|
||||
|JPEG |true |true |true |
|
||||
|PNG |true |true |true |
|
||||
|SVG |true |**false** |**false** |
|
||||
|TIFF |true |true |true |
|
||||
|WebP |true |true |true |
|
||||
|
||||
This contrived example demonstrates how to iterate through resources and use these functions to apply the appropriate handling for each image format.
|
||||
|
||||
```go-html-template
|
||||
{{ range resources.Match "**" }}
|
||||
{{ if reflect.IsImageResource . }}
|
||||
{{ if reflect.IsImageResourceProcessable . }}
|
||||
{{ with .Process "resize 300x webp" }}
|
||||
<img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="">
|
||||
{{ end }}
|
||||
{{ else if reflect.IsImageResourceWithMeta . }}
|
||||
<img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="">
|
||||
{{ else }}
|
||||
<img src="{{ .RelPermalink }}" alt="">
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
[`reflect.IsImageResource`]: /functions/reflect/isimageresource/
|
||||
[`reflect.IsImageResourceProcessable`]: /functions/reflect/isimageresourceprocessable/
|
||||
[`reflect.IsImageResourceWithMeta`]: /functions/reflect/isimageresourcewithmeta/
|
||||
@@ -7,7 +7,7 @@ _comment: Do not remove front matter.
|
||||
To build the extended or extended/deploy edition from source you must:
|
||||
|
||||
1. Install [Git]
|
||||
1. Install [Go] version 1.24.0 or later
|
||||
1. Install [Go] version 1.25.0 or later
|
||||
1. Install a C compiler, either [GCC] or [Clang]
|
||||
1. Update your `PATH` environment variable as described in the [Go documentation]
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ action
|
||||
: Specify one of `crop`, `fill`, `fit`, or `resize`. This is applicable to the [`Process`][] method and the [`images.Process`][] filter. If you specify an action, you must also provide dimensions.
|
||||
|
||||
anchor
|
||||
: The focal point used when cropping or filling an image. Valid options include `TopLeft`, `Top`, `TopRight`, `Left`, `Center`, `Right`, `BottomLeft`, `Bottom`, `BottomRight`, or `Smart`. The `Smart` option utilizes the [`smartcrop.js`][] library to identify the most interesting area of the image. This defaults to the [`anchor`][] parameter in your project configuration.
|
||||
: The focal point used when cropping or filling an image. Valid options include `TopLeft`, `Top`, `TopRight`, `Left`, `Center`, `Right`, `BottomLeft`, `Bottom`, `BottomRight`, or `Smart`. The `Smart` option utilizes the [`muesli/smartcrop`][] package to identify the most interesting area of the image. This defaults to the [`anchor`][] parameter in your project configuration.
|
||||
|
||||
background color
|
||||
: The background color used when converting transparent images to formats that do not support transparency, such as PNG to JPEG. This color also fills the empty space created when rotating an image by a non-orthogonal angle if the space is not transparent and a background color is not specified in the processing specification. The value must be an RGB [hexadecimal color][]. This defaults to the [`bgColor`][] parameter in your project configuration.
|
||||
@@ -62,12 +62,12 @@ rotation
|
||||
[`bgcolor`]: /configuration/imaging/#bgcolor
|
||||
[`compression`]: /configuration/imaging/#compression
|
||||
[`cwebp`]: https://developers.google.com/speed/webp/docs/cwebp
|
||||
[`muesli/smartcrop`]: https://github.com/muesli/smartcrop
|
||||
[`hint`]: /configuration/imaging/#hint
|
||||
[`images.AutoOrient`]: /functions/images/autoorient/
|
||||
[`images.Process`]: /functions/images/process/
|
||||
[`Process`]: /methods/resource/process
|
||||
[`quality`]: /configuration/imaging/#quality
|
||||
[`resampleFilter`]: /configuration/imaging/#resamplefilter
|
||||
[`smartcrop.js`]: https://github.com/jwagner/smartcrop.js
|
||||
[hexadecimal color]: https://developer.mozilla.org/en-US/docs/Web/CSS/hex-color
|
||||
[source documentation]: https://github.com/disintegration/imaging#image-resizing
|
||||
|
||||
@@ -44,18 +44,12 @@ _comment: Do not remove front matter.
|
||||
: The `slug` as defined in front matter, else the `title` as defined in front matter, else the automatic title. Hugo generates titles automatically for section, taxonomy, and term pages that are not backed by a file.
|
||||
|
||||
`:filename`
|
||||
: The content's file name without extension, applicable to the `page` page kind.
|
||||
|
||||
{{< deprecated-in v0.144.0 >}}
|
||||
The `:filename` token has been deprecated. Use `:contentbasename` instead.
|
||||
{{< /deprecated-in >}}
|
||||
: {{< deprecated-in v0.144.0 />}}
|
||||
: Use `:contentbasename` instead.
|
||||
|
||||
`:slugorfilename`
|
||||
: The `slug` as defined in front matter, else the content's file name without extension, applicable to the `page` page kind.
|
||||
|
||||
{{< deprecated-in v0.144.0 >}}
|
||||
The `:slugorfilename` token has been deprecated. Use `:slugorcontentbasename` instead.
|
||||
{{< /deprecated-in >}}
|
||||
: {{< deprecated-in v0.144.0 />}}
|
||||
: Use `:slugorcontentbasename` instead.
|
||||
|
||||
`:contentbasename`
|
||||
: {{< new-in 0.144.0 />}}
|
||||
|
||||
@@ -15,7 +15,7 @@ weight: 20
|
||||
: Localize your project for each language and region, including translations, images, dates, currencies, numbers, percentages, and collation sequence. Hugo's multilingual framework supports single-host and multihost configurations.
|
||||
|
||||
[Output formats]
|
||||
: Render each page of your site to one or more output formats, with granular control by page kind, section, and path. While HTML is the default output format, you can add JSON, RSS, CSV, and more. For example, create a REST API to access content.
|
||||
: Render each page of your project to one or more output formats, with granular control by page kind, section, and path. While HTML is the default output format, you can add JSON, RSS, CSV, and more. For example, create a REST API to access content.
|
||||
|
||||
[Templates]
|
||||
: Create templates using variables, functions, and methods to transform your content, resources, and data into a published page. While HTML templates are the most common, you can create templates for any output format.
|
||||
@@ -24,10 +24,10 @@ weight: 20
|
||||
: Reduce development time and cost by using one of the hundreds of themes contributed by the Hugo community. Themes are available for corporate sites, documentation projects, image portfolios, landing pages, personal and professional blogs, resumes, CVs, and more.
|
||||
|
||||
[Modules]
|
||||
: Reduce development time and cost by creating or importing packaged combinations of archetypes, assets, content, data, templates, translation tables, static files, or configuration settings. A module may serve as the basis for a new site, or to augment an existing site.
|
||||
: Reduce development time and cost by creating or importing packaged combinations of archetypes, assets, content, data, templates, translation tables, static files, or configuration settings. A module may serve as the basis for a new project, or to augment an existing project.
|
||||
|
||||
[Privacy]
|
||||
: Configure your site to help comply with regional privacy regulations.
|
||||
: Configure your project to help comply with regional privacy regulations.
|
||||
|
||||
[Security]
|
||||
: Hugo's security model is based on the premise that template and configuration authors are trusted, but content authors are not. This model enables generation of HTML output safe against code injection. Other protections prevent "shelling out" to arbitrary applications, limit access to specific environment variables, prevent connections to arbitrary remote data sources, and more.
|
||||
@@ -98,7 +98,7 @@ weight: 20
|
||||
: Reduce build time and cost by rendering a _partial_ template once then cache the result, either globally or within a given context. For example, cache the result of an asset pipeline to prevent reprocessing on every rendered page.
|
||||
|
||||
[Segmentation]
|
||||
: Reduce build time and cost by partitioning your sites into segments. For example, render the home page and the "news section" every hour, and render the entire site once a week.
|
||||
: Reduce build time and cost by partitioning your sites into segments. For example, render the home page and the "news section" every hour, and render the entire project once a week.
|
||||
|
||||
[Minification]
|
||||
: Minify HTML, CSS, and JavaScript to reduce file size, bandwidth consumption, and loading times.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
title: Command line interface
|
||||
linkTitle: CLI
|
||||
description: Use the command line interface (CLI) to manage your site.
|
||||
description: Use the command line interface (CLI) to manage your project.
|
||||
categories: []
|
||||
keywords: []
|
||||
weight: 10
|
||||
|
||||
@@ -11,7 +11,7 @@ Generate CSS stylesheet for the Chroma code highlighter
|
||||
|
||||
Generate CSS stylesheet for the Chroma code highlighter for a given style. This stylesheet is needed if markup.highlight.noClasses is disabled in config.
|
||||
|
||||
See https://xyproto.github.io/splash/docs/all.html for a preview of the available styles
|
||||
See https://gohugo.io/quick-reference/syntax-highlighting-styles/ for a preview of the available styles.
|
||||
|
||||
```
|
||||
hugo gen chromastyles [flags] [args]
|
||||
@@ -26,7 +26,7 @@ hugo gen chromastyles [flags] [args]
|
||||
--lineNumbersTableStyle string foreground and background colors for table line numbers, e.g. --lineNumbersTableStyle "#fff000 bg:#000fff"
|
||||
--omitClassComments omit CSS class comment prefixes in the generated CSS
|
||||
--omitEmpty omit empty CSS rules (deprecated, no longer needed)
|
||||
--style string highlighter style (see https://xyproto.github.io/splash/docs/) (default "friendly")
|
||||
--style string highlighter style (default "friendly")
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
@@ -115,7 +115,7 @@ enableEmoji
|
||||
: (`bool`) Whether to allow emoji in Markdown. Default is `false`.
|
||||
|
||||
enableGitInfo
|
||||
: (`bool`) For sites under Git version control, whether to enable the [`GitInfo`][] object for each page. With the [default front matter configuration][], the `Lastmod` method on a `Page` object will return the Git author date. Default is `false`.
|
||||
: (`bool`) Whether to retrieve commit metadata from the Git history of your local project and any [modules](g). This enables the [`GitInfo`][] method on a `Page` object. With the default front matter configuration, the [`Lastmod`][] method on a `Page` object returns the Git author date of the last commit for that file. Default is `false`.
|
||||
|
||||
enableMissingTranslationPlaceholders
|
||||
: (`bool`) Whether to show a placeholder instead of the default value or an empty string if a translation is missing. Default is `false`.
|
||||
@@ -153,7 +153,7 @@ ignoreVendorPaths
|
||||
imaging
|
||||
: See [configure imaging][].
|
||||
|
||||
languageCode
|
||||
locale
|
||||
: (`string`) The site's language tag, conforming to the syntax described in [RFC 5646][]. This value does not affect translations or localization. Hugo uses this value to populate:
|
||||
|
||||
- The `language` element in the [embedded RSS template][]
|
||||
@@ -355,42 +355,46 @@ none
|
||||
|
||||
Some configuration settings, such as menus and custom parameters, can be defined separately for each language. See [configure languages][].
|
||||
|
||||
[`cacheDir`]: #cachedir
|
||||
[`defaultContentLanguage`]: #defaultcontentlanguage
|
||||
[`defaultContentLanguageInSubdir`]: #defaultcontentlanguageinsubdir
|
||||
[`defaultContentRole`]: #defaultcontentrole
|
||||
[`defaultContentRoleInSubdir`]: #defaultcontentroleinsubdir
|
||||
[`defaultContentVersion`]: #defaultcontentversion
|
||||
[`defaultContentVersionInSubdir`]: #defaultcontentversioninsubdir
|
||||
[`disabled`]: /configuration/languages/#disabled
|
||||
[`disableDefaultSiteRedirect`]: #disabledefaultsiteredirect
|
||||
[`erroridf`]: /functions/fmt/erroridf/
|
||||
[Associated Press Stylebook]: https://www.apstylebook.com/
|
||||
[Chicago Manual of Style]: https://www.chicagomanualofstyle.org/home.html
|
||||
[IANA Time Zone Database]: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
||||
[RFC 5646]: https://datatracker.ietf.org/doc/html/rfc5646#section-2.1
|
||||
[XDG base directory specification]: https://specifications.freedesktop.org/basedir-spec/latest/
|
||||
[`FuzzyWordCount`]: /methods/page/fuzzywordcount/
|
||||
[`GitInfo`]: /methods/page/gitinfo/
|
||||
[`Lastmod`]: /methods/page/lastmod/
|
||||
[`MainSections`]: /methods/site/mainsections/
|
||||
[`Summary`]: /methods/page/summary/
|
||||
[`WordCount`]: /methods/page/wordcount/
|
||||
[`cacheDir`]: #cachedir
|
||||
[`defaultContentLanguageInSubdir`]: #defaultcontentlanguageinsubdir
|
||||
[`defaultContentLanguage`]: #defaultcontentlanguage
|
||||
[`defaultContentRoleInSubdir`]: #defaultcontentroleinsubdir
|
||||
[`defaultContentRole`]: #defaultcontentrole
|
||||
[`defaultContentVersionInSubdir`]: #defaultcontentversioninsubdir
|
||||
[`defaultContentVersion`]: #defaultcontentversion
|
||||
[`disableDefaultSiteRedirect`]: #disabledefaultsiteredirect
|
||||
[`disabled`]: /configuration/languages/#disabled
|
||||
[`erroridf`]: /functions/fmt/erroridf/
|
||||
[`publishDir`]: #publishdir
|
||||
[`segments`]: /configuration/segments/
|
||||
[`staticDir`]: #staticdir
|
||||
[`strings.Title`]: /functions/strings/title/
|
||||
[`Summary`]: /methods/page/summary/
|
||||
[`time.AsTime`]: /functions/time/astime/
|
||||
[`time.Format`]: /functions/time/format/
|
||||
[`titleCaseStyle`]: #titlecasestyle
|
||||
[`warnidf`]: /functions/fmt/warnidf/
|
||||
[`WordCount`]: /methods/page/wordcount/
|
||||
[aliases_front_matter]: /content-management/front-matter/#aliases
|
||||
[aliases_page_method]: /methods/page/aliases/
|
||||
[Associated Press Stylebook]: https://www.apstylebook.com/
|
||||
[automatic summaries]: /content-management/summaries/#automatic-summary
|
||||
[Chicago Manual of Style]: https://www.chicagomanualofstyle.org/home.html
|
||||
[client-side redirection]: /content-management/urls/#client-side-redirection
|
||||
[composite characters]: https://en.wikipedia.org/wiki/Precomposed_character
|
||||
[configure HTTP cache]: /configuration/http-cache/
|
||||
[configure build]: /configuration/build/
|
||||
[configure cascade]: /configuration/cascade/
|
||||
[configure deployment]: /configuration/deployment/
|
||||
[configure file caches]: /configuration/caches/
|
||||
[configure front matter]: /configuration/front-matter/
|
||||
[configure HTTP cache]: /configuration/http-cache/
|
||||
[configure imaging]: /configuration/imaging/
|
||||
[configure languages]: /configuration/languages/
|
||||
[configure markup]: /configuration/markup/
|
||||
@@ -415,15 +419,11 @@ Some configuration settings, such as menus and custom parameters, can be defined
|
||||
[configure taxonomies]: /configuration/taxonomies/
|
||||
[configure ugly URLs]: /configuration/ugly-urls/
|
||||
[configure versions]: /configuration/versions/
|
||||
[default front matter configuration]: /configuration/front-matter/
|
||||
[duration]: https://pkg.go.dev/time#Duration
|
||||
[embedded alias template]: <{{% eturl alias %}}>
|
||||
[embedded Open Graph template]: <{{% eturl opengraph %}}>
|
||||
[embedded RSS template]: <{{% eturl rss %}}>
|
||||
[IANA Time Zone Database]: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
||||
[embedded alias template]: <{{% eturl alias %}}>
|
||||
[module mounts]: /configuration/module/#mounts
|
||||
[non-spacing marks]: https://www.compart.com/en/unicode/category/Mn
|
||||
[os.UserCacheDir]: https://pkg.go.dev/os#UserCacheDir
|
||||
[RFC 5646]: https://datatracker.ietf.org/doc/html/rfc5646#section-2.1
|
||||
[this configuration]: https://github.com/bep/hugo-sass-test/blob/6c3960a8f4b90e8938228688bc49bdcdd6b2d99e/.circleci/config.yml
|
||||
[XDG base directory specification]: https://specifications.freedesktop.org/basedir-spec/latest/
|
||||
|
||||
@@ -33,17 +33,17 @@ The `build.cachebusters` configuration option was added to support development u
|
||||
[build.buildStats]
|
||||
enable = true
|
||||
[[build.cachebusters]]
|
||||
source = "assets/watching/hugo_stats\\.json"
|
||||
target = "styles\\.css"
|
||||
source = 'assets/watching/hugo_stats\.json'
|
||||
target = 'styles\.css'
|
||||
[[build.cachebusters]]
|
||||
source = "(postcss|tailwind)\\.config\\.js"
|
||||
target = "css"
|
||||
source = '(postcss|tailwind)\.config\.js'
|
||||
target = 'css'
|
||||
[[build.cachebusters]]
|
||||
source = "assets/.*\\.(js|ts|jsx|tsx)"
|
||||
target = "js"
|
||||
source = 'assets/.*\.(js|ts|jsx|tsx)'
|
||||
target = 'js'
|
||||
[[build.cachebusters]]
|
||||
source = "assets/.*\\.(.*)$"
|
||||
target = "$1"
|
||||
source = 'assets/.*\.(.*)$'
|
||||
target = '$1'
|
||||
{{< /code-toggle >}}
|
||||
<!-- markdownlint-enable MD049 -->
|
||||
|
||||
|
||||
@@ -26,6 +26,9 @@ images
|
||||
misc
|
||||
: Caches miscellaneous data.
|
||||
|
||||
modulegitinfo
|
||||
: Caches Git information for modules.
|
||||
|
||||
modulequeries
|
||||
: Caches the results of module resolution queries.
|
||||
|
||||
|
||||
@@ -12,10 +12,10 @@ There are four methods on a `Page` object that return a date.
|
||||
|
||||
Method|Description
|
||||
:--|:--
|
||||
[`Date`]|Returns the date of the given page.
|
||||
[`ExpiryDate`]|Returns the expiry date of the given page.
|
||||
[`Lastmod`]|Returns the last modification date of the given page.
|
||||
[`PublishDate`]|Returns the publish date of the given page.
|
||||
[`Date`][]|Returns the date of the given page.
|
||||
[`ExpiryDate`][]|Returns the expiry date of the given page.
|
||||
[`Lastmod`][]|Returns the last modification date of the given page.
|
||||
[`PublishDate`][]|Returns the publish date of the given page.
|
||||
|
||||
[`Date`]: /methods/page/date
|
||||
[`ExpiryDate`]: /methods/page/expirydate
|
||||
@@ -76,12 +76,12 @@ Hugo provides the following [tokens](g) to help you configure your front matter:
|
||||
|
||||
Within the `YYYY-MM-DD-HH-MM-SS` format, the date and time values may be separated by any character including a space (e.g., `2025-02-01T14-30-00`).
|
||||
|
||||
Hugo resolves the extracted date to the [`timeZone`] defined in your project configuration, falling back to the system time zone. After extracting the date, Hugo uses the remaining part of the file name to generate the page's [`slug`], but only if you haven't already specified a slug in the page's front matter.
|
||||
Hugo resolves the extracted date to the [`timeZone`][] defined in your project configuration, falling back to the system time zone. After extracting the date, Hugo uses the remaining part of the file name to generate the page's [`slug`][], but only if you haven't already specified a slug in the page's front matter.
|
||||
|
||||
For example, if you name your file `2025-02-01-article.md`, Hugo will set the date to `2025-02-01` and the slug to `article`.
|
||||
|
||||
`:git`
|
||||
: The Git author date for the file's last revision. To enable access to the Git author date, set [`enableGitInfo`] to `true`, or use the `--enableGitInfo` flag when building your project.
|
||||
: The Git author date for the file's last revision. To enable access to the Git author date, set [`enableGitInfo`][] to `true`.
|
||||
|
||||
## Example
|
||||
|
||||
|
||||
@@ -6,21 +6,16 @@ categories: []
|
||||
keywords: []
|
||||
---
|
||||
|
||||
## Processing options
|
||||
|
||||
These are the default settings for processing images:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[imaging]
|
||||
anchor = 'Smart'
|
||||
bgColor = '#ffffff'
|
||||
compression = 'lossy'
|
||||
quality = 75
|
||||
resampleFilter = 'box'
|
||||
{{< /code-toggle >}}
|
||||
{{< code-toggle config=imaging />}}
|
||||
|
||||
## Top-level options
|
||||
|
||||
These global settings define how Hugo handles the fundamental aspects of image manipulation, such as cropping logic, background colors, and general output quality.
|
||||
|
||||
anchor
|
||||
: (`string`) The focal point used when cropping or filling an image. Valid options include `TopLeft`, `Top`, `TopRight`, `Left`, `Center`, `Right`, `BottomLeft`, `Bottom`, `BottomRight`, or `Smart`. The `Smart` option utilizes the [`smartcrop.js`][] library to identify the most interesting area of the image. Default is `Smart`.
|
||||
: (`string`) The focal point used when cropping or filling an image. Valid case-insensitive options include `TopLeft`, `Top`, `TopRight`, `Left`, `Center`, `Right`, `BottomLeft`, `Bottom`, `BottomRight`, or `Smart`. The `Smart` option utilizes the [`muesli/smartcrop`][] package to identify the most interesting area of the image. Default is `smart`.
|
||||
|
||||
bgColor
|
||||
: (string) The background color used when converting transparent images to formats that do not support transparency, such as PNG to JPEG. This color also fills the empty space created when rotating an image by a non-orthogonal angle if the space is not transparent and a background color is not specified in the processing specification. The value must be an RGB [hexadecimal color][]. Default is `#ffffff`.
|
||||
@@ -46,18 +41,32 @@ resampleFilter
|
||||
|
||||
Refer to the [source documentation][] for a complete list of available resampling filters. If you wish to improve image quality at the expense of performance, you may wish to experiment with the alternative filters.
|
||||
|
||||
## Exif method
|
||||
|
||||
{{< deprecated-in 0.155.0 >}}
|
||||
Use [`Meta`](/methods/resource/meta/) instead.
|
||||
{{< /deprecated-in >}}
|
||||
|
||||
## Meta method
|
||||
|
||||
{{< new-in 0.155.0 />}}
|
||||
|
||||
The following parameters allow you to control how Hugo extracts and filters metadata when using the [`Meta`][] method, helping you balance data granularity with build performance.
|
||||
|
||||
fields
|
||||
: (`[]string`) A [glob slice](g) matching the fields to include when extracting metadata. If empty, a default set excluding technical metadata is used. Set to `['**']` to include all fields.
|
||||
|
||||
> [!note]
|
||||
> By default, to improve performance and decrease cache size, Hugo excludes the following fields: `ColorSpace`, `Contrast`, `Exif`, `ExposureBias`, `ExposureMode`, `ExposureProgram`, `Flash`, `GPS`, `JPEG`, `Metering`, `Resolution`, `Saturation`, `Sensing`, `Sharp`, and `WhiteBalance`.
|
||||
|
||||
sources
|
||||
: (`[]string`) The metadata sources to include, one or more of `exif`, `iptc`, or `xmp`. Default is `['exif', 'iptc']`. The XMP metadata is excluded by default to improve performance.
|
||||
|
||||
## WebP images
|
||||
|
||||
{{< new-in 0.155.0 />}}
|
||||
|
||||
These are the default settings specific to processing WebP images:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[imaging.webp]
|
||||
hint = 'photo'
|
||||
method = 4
|
||||
useSharpYuv = true
|
||||
{{< /code-toggle >}}
|
||||
These specialized settings provide granular control over the WebP encoding process, allowing you to optimize compression based on the specific visual characteristics of your imagery.
|
||||
|
||||
hint
|
||||
: (`string`) The encoding preset used when processing WebP images, equivalent to the `-preset` flag for the [`cwebp`][] CLI. Valid options include `drawing`, `icon`, `photo`, `picture`, or `text`. Default is `photo`.
|
||||
@@ -71,62 +80,12 @@ hint
|
||||
`text`|Image that is primarily text
|
||||
|
||||
method
|
||||
: (`int`) The effort level of the compression algorithm. Expressed as a whole number from `0` to `6`, inclusive, equivalent to the `-m` flag for the [`cwebp`][] CLI. Lower numbers prioritize processing speed, while higher numbers prioritize compression efficiency. Default is `4`.
|
||||
: (`int`) The effort level of the compression algorithm. Expressed as a whole number from `0` to `6`, inclusive, equivalent to the `-m` flag for the [`cwebp`][] CLI. Lower numbers prioritize processing speed, while higher numbers prioritize compression efficiency. Default is `2`.
|
||||
|
||||
useSharpYuv
|
||||
: (`bool`) The conversion method used for RGB-to-YUV encoding, equivalent to the `-sharp_yuv` flag for the [`cwebp`][] CLI. Enabling this prioritizes image sharpness at the expense of processing speed. Default is `true`.
|
||||
|
||||
## Exif method
|
||||
|
||||
These are the default settings for the [`Exif`] method on an image `Resource` object:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[imaging.exif]
|
||||
disableDate = false
|
||||
disableLatLong = false
|
||||
excludeFields = ""
|
||||
includeFields = ""
|
||||
{{< /code-toggle >}}
|
||||
|
||||
disableDate
|
||||
: (`bool`) Whether to disable the [`Date`][] method by returning its zero value. Default is `false`.
|
||||
|
||||
disableLatLong
|
||||
: (`bool`) Whether to disable the [`Lat`][] and [`Long`][] methods by returning their zero values. Default is `false`.
|
||||
|
||||
excludeFields
|
||||
: (`string`) A [regular expression](g) matching the fields to exclude when extracting metadata.
|
||||
|
||||
> [!note]
|
||||
> By default, to improve performance and decrease cache size, Hugo excludes the following fields: `ColorSpace`, `Contrast`, `Exif`, `ExposureBias`, `ExposureMode`, `ExposureProgram`, `Flash`, `GPS`, `JPEG`, `Metering`, `Resolution`, `Saturation`, `Sensing`, `Sharp`, and `WhiteBalance`.
|
||||
|
||||
includeFields
|
||||
: (`string`) A [regular expression](g) matching the fields to include when extracting metadata. If empty, a default set excluding technical metadata is used. Set to `'.*'` to include all fields.
|
||||
|
||||
## Meta method
|
||||
|
||||
{{< new-in 0.155.0 />}}
|
||||
|
||||
These are the default settings for the [`Meta`] method on an image `Resource` object:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[imaging.meta]
|
||||
fields = []
|
||||
sources = ['exif', 'iptc']
|
||||
{{< /code-toggle >}}
|
||||
|
||||
fields
|
||||
: (`[]string`) A [glob slice](g) matching the fields to include when extracting metadata. If empty, a default set excluding technical metadata is used. Set to `['**']` to include all fields.
|
||||
|
||||
> [!note]
|
||||
> By default, to improve performance and decrease cache size, Hugo excludes the following fields: `ColorSpace`, `Contrast`, `Exif`, `ExposureBias`, `ExposureMode`, `ExposureProgram`, `Flash`, `GPS`, `JPEG`, `Metering`, `Resolution`, `Saturation`, `Sensing`, `Sharp`, and `WhiteBalance`.
|
||||
|
||||
sources
|
||||
: (`[]string`) The metadata sources to include, one or more of `exif`, `iptc`, or `xmp`. Default is `['exif', 'iptc']`. The XMP metadata is excluded by default to improve performance.
|
||||
: (`bool`) The conversion method used for RGB-to-YUV encoding, equivalent to the `-sharp_yuv` flag for the [`cwebp`][] CLI. Enabling this prioritizes image sharpness at the expense of processing speed. Default is `false`.
|
||||
|
||||
[`cwebp`]: https://developers.google.com/speed/webp/docs/cwebp
|
||||
[`Exif`]: /methods/resource/exif/
|
||||
[`Meta`]: /methods/resource/meta/
|
||||
[`smartcrop.js`]: https://github.com/jwagner/smartcrop.js
|
||||
[`muesli/smartcrop`]: https://github.com/muesli/smartcrop
|
||||
[hexadecimal color]: https://developer.mozilla.org/en-US/docs/Web/CSS/hex-color
|
||||
[source documentation]: https://github.com/disintegration/imaging#image-resizing
|
||||
|
||||
@@ -8,11 +8,11 @@ weight: 10
|
||||
|
||||
## Sensible defaults
|
||||
|
||||
Hugo offers many configuration options, but its defaults are often sufficient. A new site requires only these settings:
|
||||
Hugo offers many configuration options, but its defaults are often sufficient. A new project requires only these settings:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
baseURL = 'https://example.org/'
|
||||
languageCode = 'en-us'
|
||||
locale = 'en-us'
|
||||
title = 'My New Hugo Site'
|
||||
{{< /code-toggle >}}
|
||||
|
||||
@@ -37,7 +37,7 @@ A simple example:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
baseURL = 'https://example.org/'
|
||||
languageCode = 'en-us'
|
||||
locale = 'en-us'
|
||||
title = 'ABC Widgets, Inc.'
|
||||
[params]
|
||||
subtitle = 'The Best Widgets on Earth'
|
||||
@@ -191,7 +191,7 @@ and this project-level configuration:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
baseURL = 'https://example.org/'
|
||||
languageCode = 'en-us'
|
||||
locale = 'en-us'
|
||||
title = 'My New Hugo Site'
|
||||
theme = ['theme-a','theme-b']
|
||||
{{< /code-toggle >}}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
---
|
||||
title: Configure languages
|
||||
linkTitle: Languages
|
||||
description: Configure the languages in your multilingual site.
|
||||
description: Configure the languages in your multilingual project.
|
||||
categories: []
|
||||
keywords: []
|
||||
---
|
||||
|
||||
## Base settings
|
||||
|
||||
Configure the following base settings within the site's root configuration:
|
||||
Configure the following base settings:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
defaultContentLanguage = 'en'
|
||||
@@ -38,10 +38,28 @@ Configure each language under the `languages` key:
|
||||
|
||||
In the above, `en` is the [language key](#language-keys).
|
||||
|
||||
direction
|
||||
: (`string`) The language direction, either left-to-right (`ltr`) or right-to-left (`rtl`). Use this value in your templates with the global [`dir`][] HTML attribute. Access this value from a template using the [`Language.Direction`][] method on a `Site` or `Page` object. Default is `ltr`.
|
||||
|
||||
disabled
|
||||
: (`bool`) Whether to disable this language when building the site. Default is `false`.
|
||||
|
||||
label
|
||||
: (`string`) The language name, typically used when rendering a language switcher. Access this value from a template using the [`Language.Label`][] method on a `Site` or `Page` object.
|
||||
|
||||
languageCode
|
||||
: {{<deprecated-in 0.158.0 />}}
|
||||
: Use [`locale`](#locale) instead.
|
||||
|
||||
languageDirection
|
||||
: {{<deprecated-in 0.158.0 />}}
|
||||
: Use [`direction`](#direction) instead.
|
||||
|
||||
languageName
|
||||
: {{<deprecated-in 0.158.0 />}}
|
||||
: Use [`label`](#label) instead.
|
||||
|
||||
locale
|
||||
: (`string`) The language tag as described in [RFC 5646][]. This is the primary value used by the [`language.Translate`][] function to select a translation table, falling back to the language key if a matching translation table does not exist.
|
||||
|
||||
Hugo also uses this value to populate:
|
||||
@@ -53,19 +71,13 @@ languageCode
|
||||
> [!note]
|
||||
> This value does not affect localization of dates, numbers, and currencies, nor does it affect the site's URL structure. These are controlled by the [language key](#language-keys).
|
||||
|
||||
Access this value from a template using the [`Language.LanguageCode`][] method on a `Site` or `Page` object.
|
||||
|
||||
languageDirection
|
||||
: (`string`) The language direction, either left-to-right (`ltr`) or right-to-left (`rtl`). Use this value in your templates with the global [`dir`][] HTML attribute. Access this value from a template using the [`Language.LanguageDirection`][] method on a `Site` or `Page` object. Default is `ltr`.
|
||||
|
||||
languageName
|
||||
: (`string`) The language name, typically used when rendering a language switcher. Access this value from a template using the [`Language.LanguageName`][] method on a `Site` or `Page` object.
|
||||
Access this value from a template using the [`Language.Locale`][] method on a `Site` or `Page` object.
|
||||
|
||||
title
|
||||
: (`string`) The site title for this language. Access this value from a template using the [`Title`][] method on a `Site` object.
|
||||
|
||||
weight
|
||||
: (`int`) The language [weight](g). When set to a non-zero value, this is the primary sort criteria for this language. Access this value from a template using the [`Language.Weight`][] method on a `Site` or `Page` object.
|
||||
: (`int`) The language [weight](g). When set to a non-zero value, this is the primary sort criteria for this language.
|
||||
|
||||
## Sort order
|
||||
|
||||
@@ -77,11 +89,11 @@ Some configuration settings can be defined separately for each language. For exa
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[languages.en]
|
||||
languageCode = 'en-US'
|
||||
languageName = 'English'
|
||||
weight = 1
|
||||
title = 'Project Documentation'
|
||||
label = 'English'
|
||||
locale = 'en-US'
|
||||
timeZone = 'America/New_York'
|
||||
title = 'Project Documentation'
|
||||
weight = 1
|
||||
[languages.en.pagination]
|
||||
path = 'page'
|
||||
[languages.en.params]
|
||||
@@ -101,11 +113,11 @@ Language keys must conform to the syntax described in [RFC 5646][]. For example:
|
||||
{{< code-toggle file=hugo >}}
|
||||
defaultContentLanguage = 'de'
|
||||
[languages.de]
|
||||
weight = 1
|
||||
weight = 1
|
||||
[languages.en-US]
|
||||
weight = 2
|
||||
weight = 2
|
||||
[languages.pt-BR]
|
||||
weight = 3
|
||||
weight = 3
|
||||
{{< /code-toggle >}}
|
||||
|
||||
Artificial languages with private use subtags as defined in [RFC 5646 § 2.2.7][] are also supported. Omit the `art-x-` prefix from the language key. For example:
|
||||
@@ -130,10 +142,10 @@ disableDefaultLanguageRedirect = false
|
||||
|
||||
[languages.de]
|
||||
contentDir = 'content/de'
|
||||
direction = 'ltr'
|
||||
disabled = false
|
||||
languageCode = 'de-DE'
|
||||
languageDirection = 'ltr'
|
||||
languageName = 'Deutsch'
|
||||
label = 'Deutsch'
|
||||
locale = 'de-DE'
|
||||
title = 'Projekt Dokumentation'
|
||||
weight = 1
|
||||
|
||||
@@ -142,10 +154,10 @@ subtitle = 'Referenz, Tutorials und Erklärungen'
|
||||
|
||||
[languages.en]
|
||||
contentDir = 'content/en'
|
||||
direction = 'ltr'
|
||||
disabled = false
|
||||
languageCode = 'en-US'
|
||||
languageDirection = 'ltr'
|
||||
languageName = 'English'
|
||||
label = 'English'
|
||||
locale = 'en-US'
|
||||
title = 'Project Documentation'
|
||||
weight = 2
|
||||
|
||||
@@ -167,17 +179,16 @@ For example:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
defaultContentLanguage = 'fr'
|
||||
[languages]
|
||||
[languages.en]
|
||||
baseURL = 'https://en.example.org/'
|
||||
languageName = 'English'
|
||||
title = 'In English'
|
||||
weight = 2
|
||||
[languages.fr]
|
||||
baseURL = 'https://fr.example.org'
|
||||
languageName = 'Français'
|
||||
title = 'En Français'
|
||||
weight = 1
|
||||
[languages.en]
|
||||
baseURL = 'https://en.example.org/'
|
||||
label = 'English'
|
||||
title = 'In English'
|
||||
weight = 2
|
||||
[languages.fr]
|
||||
baseURL = 'https://fr.example.org'
|
||||
label = 'Français'
|
||||
title = 'En Français'
|
||||
weight = 1
|
||||
{{</ code-toggle >}}
|
||||
|
||||
With the above, Hugo publishes two sites, each with their own root:
|
||||
@@ -188,20 +199,19 @@ public
|
||||
└── fr
|
||||
```
|
||||
|
||||
[`defaultContentLanguage`]: #defaultcontentlanguage
|
||||
[`defaultContentLanguageInSubdir`]: #defaultcontentlanguageinsubdir
|
||||
[`dir`]: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/dir
|
||||
[`disableDefaultSiteRedirect`]: /configuration/all/#disabledefaultsiteredirect
|
||||
[`Language.LanguageCode`]: /methods/site/language/#languagecode
|
||||
[`Language.LanguageDirection`]: /methods/site/language/#languagedirection
|
||||
[`Language.LanguageName`]: /methods/site/language/#languagename
|
||||
[`language.Translate`]: /functions/lang/translate/
|
||||
[`Language.Weight`]: /methods/site/language/#weight
|
||||
[`Title`]: /methods/site/title/
|
||||
[embedded alias template]: <{{% eturl alias %}}>
|
||||
[embedded OpenGraph template]: <{{% eturl opengraph %}}>
|
||||
[embedded RSS template]: <{{% eturl rss %}}>
|
||||
[language keys]: #language-keys
|
||||
[RFC 5646 § 2.2.7]: https://datatracker.ietf.org/doc/html/rfc5646#section-2.2.7
|
||||
[RFC 5646]: https://datatracker.ietf.org/doc/html/rfc5646#section-2.1
|
||||
[`Language.Direction`]: /methods/site/language/#direction
|
||||
[`Language.Label`]: /methods/site/language/#label
|
||||
[`Language.Locale`]: /methods/site/language/#locale
|
||||
[`Title`]: /methods/site/title/
|
||||
[`defaultContentLanguageInSubdir`]: #defaultcontentlanguageinsubdir
|
||||
[`defaultContentLanguage`]: #defaultcontentlanguage
|
||||
[`dir`]: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/dir
|
||||
[`disableDefaultSiteRedirect`]: /configuration/all/#disabledefaultsiteredirect
|
||||
[`language.Translate`]: /functions/lang/translate/
|
||||
[embedded OpenGraph template]: <{{% eturl opengraph %}}>
|
||||
[embedded RSS template]: <{{% eturl rss %}}>
|
||||
[embedded alias template]: <{{% eturl alias %}}>
|
||||
[language keys]: #language-keys
|
||||
[translating by file name]: /content-management/multilingual/#translation-by-file-name
|
||||
|
||||
@@ -134,10 +134,10 @@ Markdown|Replaced by|Description
|
||||
Most of the Goldmark settings above are self-explanatory, but some require explanation.
|
||||
|
||||
duplicateResourceFiles
|
||||
: (`bool`) Whether to duplicate shared page resources for each language on multilingual single-host sites. See [multilingual page resources] for details. Default is `false`.
|
||||
: (`bool`) Whether to duplicate shared page resources for each language on multilingual single-host projects. See [multilingual page resources] for details. Default is `false`.
|
||||
|
||||
> [!note]
|
||||
> With multilingual single-host sites, setting this parameter to `false` will enable Hugo's [embedded link render hook] and [embedded image render hook]. This is the default configuration for multilingual single-host sites.
|
||||
> With multilingual single-host projects, setting this parameter to `false` will enable Hugo's [embedded link render hook] and [embedded image render hook]. This is the default configuration for multilingual single-host projects.
|
||||
|
||||
parser.wrapStandAloneImageWithinParagraph
|
||||
: (`bool`) Whether to wrap image elements without adjacent content within a `p` element when rendered. This is the default Markdown behavior. Set to `false` when using an [image render hook] to render standalone images as `figure` elements. Default is `true`.
|
||||
@@ -243,11 +243,11 @@ workingFolderCurrent
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[markup.asciidocExt]
|
||||
extensions = ["asciidoctor-html5s", "asciidoctor-diagram"]
|
||||
workingFolderCurrent = true
|
||||
[markup.asciidocExt.attributes]
|
||||
my-base-url = "https://example.com/"
|
||||
my-attribute-name = "my value"
|
||||
extensions = ['asciidoctor-html5s','asciidoctor-diagram']
|
||||
workingFolderCurrent = true
|
||||
[markup.asciidocExt.attributes]
|
||||
my-base-url = 'https://example.com/'
|
||||
my-attribute-name = 'my value'
|
||||
{{< /code-toggle >}}
|
||||
|
||||
### Syntax highlighting
|
||||
|
||||
@@ -61,21 +61,21 @@ Occasionally, you may need to create a media type without a suffix or delimiter.
|
||||
To support these custom output formats, register a custom media type with no suffix or delimiter:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[mediaTypes."text/netlify"]
|
||||
delimiter = ""
|
||||
[mediaTypes.'text/netlify']
|
||||
delimiter = ''
|
||||
{{< /code-toggle >}}
|
||||
|
||||
The custom output format definitions would look something like this:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[outputFormats.redir]
|
||||
baseName = "_redirects"
|
||||
baseName = '_redirects'
|
||||
isPlainText = true
|
||||
mediatype = "text/netlify"
|
||||
mediatype = 'text/netlify'
|
||||
[outputFormats.headers]
|
||||
baseName = "_headers"
|
||||
baseName = '_headers'
|
||||
isPlainText = true
|
||||
mediatype = "text/netlify"
|
||||
mediatype = 'text/netlify'
|
||||
notAlternative = true
|
||||
{{< /code-toggle >}}
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@ This is the default configuration:
|
||||
|
||||
{{< code-toggle config=minify />}}
|
||||
|
||||
See the [tdewolff/minify] project page for details, but note the following:
|
||||
See the [`tdewolff/minify`][] project page for details, but note the following:
|
||||
|
||||
- `css.inline` is for internal use. Changing this setting has no effect.
|
||||
- `html.keepConditionalComments` has been deprecated. Use `html.keepSpecialComments` instead.
|
||||
|
||||
[tdewolff/minify]: https://github.com/tdewolff/minify
|
||||
[`tdewolff/minify`]: https://github.com/tdewolff/minify
|
||||
|
||||
@@ -30,13 +30,13 @@ auth
|
||||
: (`string`) Configures `GOAUTH` when running the Go command for module operations. This is a semicolon-separated list of authentication commands for go-import and HTTPS module mirror interactions. This is useful for private repositories. See `go help goauth` for more information.
|
||||
|
||||
noProxy
|
||||
: (`string`) A comma-separated list of [glob patterns](g),s matching paths that should not use the [configured proxy server](#proxy).
|
||||
: (`string`) A comma-separated list of [glob patterns](g), matching paths that should not use the [configured proxy server](#proxy).
|
||||
|
||||
noVendor
|
||||
: (`string`) A [glob pattern](g) matching module paths to skip when vendoring.
|
||||
|
||||
private
|
||||
: (`string`) A comma-separated list of [glob patterns](g),s matching paths that should be treated as private.
|
||||
: (`string`) A comma-separated list of [glob patterns](g), matching paths that should be treated as private.
|
||||
|
||||
proxy
|
||||
: (`string`) The proxy server to use to download remote modules. Default is `direct`, which means `git clone` and similar.
|
||||
@@ -99,9 +99,9 @@ min
|
||||
disable = false
|
||||
ignoreConfig = false
|
||||
ignoreImports = false
|
||||
path = "github.com/gohugoio/hugoTestModules1_linux/modh1_2_1v"
|
||||
path = 'github.com/gohugoio/hugoTestModules1_linux/modh1_2_1v'
|
||||
[[module.imports]]
|
||||
path = "my-shortcodes"
|
||||
path = 'my-shortcodes'
|
||||
{{< /code-toggle >}}
|
||||
|
||||
disable
|
||||
@@ -152,7 +152,6 @@ target
|
||||
: (`string`) Where the mount will reside within Hugo's [unified file system](g). It must begin with one of Hugo's [component](g) directories: archetypes, assets, content, data, i18n, layouts, or static. For example, content/blog.
|
||||
|
||||
disableWatch
|
||||
: {{< new-in 0.128.0 />}}
|
||||
: (`bool`) Whether to disable watching in watch mode for this mount. Default is `false`.
|
||||
|
||||
files
|
||||
@@ -168,15 +167,15 @@ sites
|
||||
{{< code-toggle file=hugo >}}
|
||||
[module]
|
||||
[[module.mounts]]
|
||||
source="content"
|
||||
target="content"
|
||||
files=["! docs/*"]
|
||||
source = 'content'
|
||||
target = 'content'
|
||||
files = ['! docs/*']
|
||||
[[module.mounts]]
|
||||
source="node_modules"
|
||||
target="assets"
|
||||
source = 'node_modules'
|
||||
target = 'assets'
|
||||
[[module.mounts]]
|
||||
source="assets"
|
||||
target="assets"
|
||||
source = 'assets'
|
||||
target = 'assets'
|
||||
{{< /code-toggle >}}
|
||||
|
||||
[`archetypeDir`]: /configuration/all/#archetypedir
|
||||
|
||||
@@ -44,7 +44,7 @@ isHTML
|
||||
: (`bool`) Whether to classify the output format as HTML. This value determines when the LiveReload script is injected and, in conjunction with [`permalinkable`](#permalinkable), whether [alias redirects][] are generated. Default is `false`.
|
||||
|
||||
isPlainText
|
||||
: (`bool`) Whether to parse templates for this output format with Go's [text/template][] package instead of the [html/template][] package. Default is `false`.
|
||||
: (`bool`) Whether to parse templates for this output format with Go's [`text/template`][] package instead of the [`html/template`][] package. Default is `false`.
|
||||
|
||||
mediaType
|
||||
: (`string`) The [media type](g) of the published file. This must match one of the [configured media types][].
|
||||
@@ -128,7 +128,7 @@ Step 3
|
||||
See [configure outputs][] for more information.
|
||||
|
||||
Step 4
|
||||
: Create a template to render the output format. Since Atom feeds are lists, you need to create a list template. Consult the [template lookup order] to find the correct template path:
|
||||
: Create a template to render the output format. Since Atom feeds are lists, you need to create a list template. Consult the [template lookup order][] to find the correct template path:
|
||||
|
||||
```text
|
||||
layouts/list.atom.atom
|
||||
@@ -202,6 +202,6 @@ Output format|Template path
|
||||
[configured media types]: /configuration/media-types/
|
||||
[default media types]: /configuration/media-types/
|
||||
[embedded RSS template]: <{{% eturl rss %}}>
|
||||
[html/template]: https://pkg.go.dev/html/template
|
||||
[`html/template`]: https://pkg.go.dev/html/template
|
||||
[template lookup order]: /templates/lookup-order/
|
||||
[text/template]: https://pkg.go.dev/text/template
|
||||
[`text/template`]: https://pkg.go.dev/text/template
|
||||
|
||||
@@ -19,14 +19,14 @@ pagerSize
|
||||
path
|
||||
: (`string`) The segment of each pager URL indicating that the target page is a pager. Default is `page`.
|
||||
|
||||
With multilingual sites you can define the pagination behavior for each language:
|
||||
With multilingual projects you can define the pagination behavior for each language:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[languages.en]
|
||||
contentDir = 'content/en'
|
||||
languageCode = 'en-US'
|
||||
languageDirection = 'ltr'
|
||||
languageName = 'English'
|
||||
direction = 'ltr'
|
||||
label = 'English'
|
||||
locale = 'en-US'
|
||||
weight = 1
|
||||
[languages.en.pagination]
|
||||
disableAliases = true
|
||||
@@ -34,9 +34,9 @@ pagerSize = 10
|
||||
path = 'page'
|
||||
[languages.de]
|
||||
contentDir = 'content/de'
|
||||
languageCode = 'de-DE'
|
||||
languageDirection = 'ltr'
|
||||
languageName = 'Deutsch'
|
||||
direction = 'ltr'
|
||||
label = 'Deutsch'
|
||||
locale = 'de-DE'
|
||||
weight = 2
|
||||
[languages.de.pagination]
|
||||
disableAliases = true
|
||||
|
||||
@@ -10,8 +10,8 @@ Use the `params` key for custom parameters:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
baseURL = 'https://example.org/'
|
||||
locale = 'en-US'
|
||||
title = 'Project Documentation'
|
||||
languageCode = 'en-US'
|
||||
[params]
|
||||
subtitle = 'Reference, Tutorials, and Explanations'
|
||||
[params.contact]
|
||||
@@ -43,18 +43,18 @@ But you cannot do this:
|
||||
{{ .Site.params.kebab-case.foo }}
|
||||
```
|
||||
|
||||
## Multilingual sites
|
||||
## Multilingual projects
|
||||
|
||||
For multilingual sites, create a `params` key under each language:
|
||||
For multilingual projects, create a `params` key under each language:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
baseURL = 'https://example.org/'
|
||||
defaultContentLanguage = 'en'
|
||||
|
||||
[languages.de]
|
||||
languageCode = 'de-DE'
|
||||
languageDirection = 'ltr'
|
||||
languageName = 'Deutsch'
|
||||
direction = 'ltr'
|
||||
label = 'Deutsch'
|
||||
locale = 'de-DE'
|
||||
title = 'Projekt Dokumentation'
|
||||
weight = 1
|
||||
|
||||
@@ -66,9 +66,9 @@ email = 'info@de.example.org'
|
||||
phone = '+49 30 1234567'
|
||||
|
||||
[languages.en]
|
||||
languageCode = 'en-US'
|
||||
languageDirection = 'ltr'
|
||||
languageName = 'English'
|
||||
direction = 'ltr'
|
||||
label = 'English'
|
||||
locale = 'en-US'
|
||||
title = 'Project Documentation'
|
||||
weight = 2
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ To create a date-based hierarchy for regular pages in the content root:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[permalinks.page]
|
||||
"/" = "/:year/:month/:slug/"
|
||||
'/' = '/:year/:month/:slug/'
|
||||
{{< /code-toggle >}}
|
||||
|
||||
Use the same approach with taxonomy terms. For example, to omit the taxonomy segment of the URL:
|
||||
@@ -105,29 +105,29 @@ defaultContentLanguageInSubdir = true
|
||||
|
||||
[languages.en]
|
||||
contentDir = 'content/en'
|
||||
languageCode = 'en-US'
|
||||
languageDirection = 'ltr'
|
||||
languageName = 'English'
|
||||
direction = 'ltr'
|
||||
label = 'English'
|
||||
locale = 'en-US'
|
||||
weight = 1
|
||||
|
||||
[languages.en.permalinks.page]
|
||||
books = "/books/:slug/"
|
||||
books = '/books/:slug/'
|
||||
|
||||
[languages.en.permalinks.section]
|
||||
books = "/books/"
|
||||
books = '/books/'
|
||||
|
||||
[languages.es]
|
||||
contentDir = 'content/es'
|
||||
languageCode = 'es-ES'
|
||||
languageDirection = 'ltr'
|
||||
languageName = 'Español'
|
||||
direction = 'ltr'
|
||||
label = 'Español'
|
||||
locale = 'es-ES'
|
||||
weight = 2
|
||||
|
||||
[languages.es.permalinks.page]
|
||||
books = "/libros/:slug/"
|
||||
books = '/libros/:slug/'
|
||||
|
||||
[languages.es.permalinks.section]
|
||||
books = "/libros/"
|
||||
books = '/libros/'
|
||||
{{< /code-toggle >}}
|
||||
|
||||
The structure of the published site will be:
|
||||
|
||||
@@ -20,7 +20,7 @@ Hugo's privacy settings can assist in compliance efforts.
|
||||
|
||||
## Embedded templates
|
||||
|
||||
Hugo provides [embedded templates](g) to simplify site and content creation. Some of these templates interact with external services. For example, the `youtube` shortcode connects with YouTube's servers to embed videos on your site.
|
||||
Hugo provides [embedded templates](g) to simplify project and content creation. Some of these templates interact with external services. For example, the `youtube` shortcode connects with YouTube's servers to embed videos.
|
||||
|
||||
Some of these templates include settings to enhance privacy.
|
||||
|
||||
|
||||
@@ -48,14 +48,14 @@ Place broad filters, such as those for language or output format, in the exclude
|
||||
{{< code-toggle file=hugo >}}
|
||||
[segments.segment1]
|
||||
[[segments.segment1.excludes]]
|
||||
lang = "n*"
|
||||
lang = 'n*'
|
||||
[[segments.segment1.excludes]]
|
||||
lang = "en"
|
||||
output = "rss"
|
||||
lang = 'en'
|
||||
output = 'rss'
|
||||
[[segments.segment1.includes]]
|
||||
kind = "{home,term,taxonomy}"
|
||||
kind = '{home,term,taxonomy}'
|
||||
[[segments.segment1.includes]]
|
||||
path = "{/docs,/docs/**}"
|
||||
path = '{/docs,/docs/**}'
|
||||
{{< /code-toggle >}}
|
||||
|
||||
## Rendering segments
|
||||
|
||||
@@ -53,14 +53,14 @@ Include headers in every server response to facilitate testing, particularly for
|
||||
|
||||
{{< code-toggle file=config/development/server >}}
|
||||
[[headers]]
|
||||
for = "/**"
|
||||
for = '/**'
|
||||
|
||||
[headers.values]
|
||||
X-Frame-Options = "DENY"
|
||||
X-XSS-Protection = "1; mode=block"
|
||||
X-Content-Type-Options = "nosniff"
|
||||
Referrer-Policy = "strict-origin-when-cross-origin"
|
||||
Content-Security-Policy = "script-src localhost:1313"
|
||||
X-Frame-Options = 'DENY'
|
||||
X-XSS-Protection = '1; mode=block'
|
||||
X-Content-Type-Options = 'nosniff'
|
||||
Referrer-Policy = 'strict-origin-when-cross-origin'
|
||||
Content-Security-Policy = 'script-src localhost:1313'
|
||||
{{< /code-toggle >}}
|
||||
|
||||
## Redirects
|
||||
@@ -69,8 +69,8 @@ You can define simple redirect rules.
|
||||
|
||||
{{< code-toggle file=config/development/server >}}
|
||||
[[redirects]]
|
||||
from = "/myspa/**"
|
||||
to = "/myspa/"
|
||||
from = '/myspa/**'
|
||||
to = '/myspa/'
|
||||
status = 200
|
||||
force = false
|
||||
{{< /code-toggle >}}
|
||||
@@ -90,12 +90,12 @@ If you've already defined other redirects, you must explicitly add the 404 redir
|
||||
{{< code-toggle file=config/development/server >}}
|
||||
[[redirects]]
|
||||
force = false
|
||||
from = "/**"
|
||||
to = "/404.html"
|
||||
from = '/**'
|
||||
to = '/404.html'
|
||||
status = 404
|
||||
{{< /code-toggle >}}
|
||||
|
||||
For multilingual sites, ensure the default language 404 redirect is defined last:
|
||||
For multilingual projects, ensure the default language 404 redirect is defined last:
|
||||
|
||||
{{< code-toggle file=config/development/server >}}
|
||||
defaultContentLanguage = 'en'
|
||||
|
||||
@@ -273,9 +273,9 @@ Step 4
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
## Multilingual sites
|
||||
## Multilingual projects
|
||||
|
||||
With multilingual sites you can:
|
||||
With multilingual projects you can:
|
||||
|
||||
1. Create one content adapter for all languages using the [`EnableAllLanguages`](#enablealllanguages) method as described above.
|
||||
1. Create content adapters unique to each language. See the examples below.
|
||||
|
||||
@@ -293,9 +293,9 @@ kind = 'page'
|
||||
{{< /code-toggle >}}
|
||||
|
||||
> [!note]
|
||||
> For multilingual sites, defining cascade values in your project configuration is often more efficient. This avoids repeating the same cascade values on the home, section, taxonomy, or term page for each language. See [details](/configuration/cascade/).
|
||||
> For multilingual projects, defining cascade values in your project configuration is often more efficient. This avoids repeating the same cascade values on the home, section, taxonomy, or term page for each language. See [details](/configuration/cascade/).
|
||||
>
|
||||
> If you choose to define cascade values in front matter for a multilingual site, you must create a corresponding home, section, taxonomy, or term page for every language.
|
||||
> If you choose to define cascade values in front matter for a multilingual project, you must create a corresponding home, section, taxonomy, or term page for every language.
|
||||
|
||||
## Emacs Org Mode
|
||||
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
---
|
||||
title: Image processing
|
||||
description: Process, transform, and analyze images.
|
||||
description: Transform images to change their size, shape, and appearance.
|
||||
categories: []
|
||||
keywords: []
|
||||
---
|
||||
|
||||
Hugo provides methods to transform and analyze images during the build process. The results are cached to ensure subsequent builds remain fast.
|
||||
Hugo provides methods to transform and analyze images during the build process. While Hugo can manage any image format as a resource, only [processable images](g) can be transformed using the methods below. The results are cached to ensure subsequent builds remain fast.
|
||||
|
||||
> [!note]
|
||||
> Use the [`reflect.IsImageResourceProcessable`][] function to verify that an image can be processed.
|
||||
|
||||
## Resources
|
||||
|
||||
@@ -98,6 +101,8 @@ Example 4: Skip rendering if there's problem accessing a remote resource.
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
{{% include "/_common/functions/reflect/image-reflection-functions.md" %}}
|
||||
|
||||
## Processing
|
||||
|
||||
To transform an image, apply a processing method to the image resource. Hugo generates the processed image on demand, caches the result, and returns a new resource object.
|
||||
@@ -111,24 +116,17 @@ To transform an image, apply a processing method to the image resource. Hugo gen
|
||||
```
|
||||
|
||||
> [!note]
|
||||
> Metadata is not preserved during image transformation. Use the `Exif` or `Meta` methods with the _original_ image resource to extract metadata from JPEG, PNG, TIFF, and WebP images.
|
||||
> Metadata is not preserved during image transformation. Use the [`Meta`][] method with the original image resource to extract metadata from supported formats.
|
||||
|
||||
Each method serves a specific transformation or metadata requirement:
|
||||
Select a method from the table below for syntax and usage examples, depending on your specific transformation or metadata requirements:
|
||||
|
||||
Method|Description
|
||||
:--|:--
|
||||
[`Colors`]|Returns a slice of the most dominant colors using a simple histogram method.
|
||||
[`Crop`]|Returns a new image resource cropped according to the given processing specification.
|
||||
[`Exif`]|Applicable to JPEG, PNG, TIFF, and WebP images, returns an object containing Exif metadata.
|
||||
[`Fill`]|Returns a new image resource cropped and resized according to the given processing specification.
|
||||
[`Filter`]|Applies one or more image filters to the given image resource.
|
||||
[`Fit`]|Returns a new image resource downscaled to fit according to the given processing specification.
|
||||
[`Meta`]|Applicable to JPEG, PNG, TIFF, and WebP images, returns an object containing Exif, IPTC, and XMP metadata.
|
||||
[`Process`]|Returns a new image resource processed according to the given processing specification.
|
||||
[`Resize`]|Returns a new image resource resized according to the given processing specification.
|
||||
{class="!mt-0"}
|
||||
|
||||
Select a method from the table above for syntax and usage examples.
|
||||
{{% render-table-of-pages-in-section
|
||||
path=/methods/resource
|
||||
filter=methods_resource_image_processing
|
||||
filterType=include
|
||||
headingColumn1=Method
|
||||
headingColumn2=Description
|
||||
%}}{class="!mt-0"}
|
||||
|
||||
## Performance
|
||||
|
||||
@@ -162,17 +160,10 @@ If your source images are much larger than the maximum size you intend to publis
|
||||
|
||||
See [configure imaging](/configuration/imaging).
|
||||
|
||||
[`Colors`]: /methods/resource/colors/
|
||||
[`Crop`]: /methods/resource/crop/
|
||||
[`Exif`]: /methods/resource/exif/
|
||||
[`Fill`]: /methods/resource/fill/
|
||||
[`Filter`]: /methods/resource/filter/
|
||||
[`Fit`]: /methods/resource/fit/
|
||||
[`Height`]: /methods/resource/height/
|
||||
[`Meta`]: /methods/resource/meta/
|
||||
[`Permalink`]: /methods/resource/permalink/
|
||||
[`Process`]: /methods/resource/process/
|
||||
[`RelPermalink`]: /methods/resource/relpermalink/
|
||||
[`Resize`]: /methods/resource/resize/
|
||||
[`Width`]: /methods/resource/width/
|
||||
[`reflect.IsImageResourceProcessable`]: /functions/reflect/isimageresourceprocessable/
|
||||
[file cache]: /configuration/caches/
|
||||
|
||||
@@ -30,7 +30,7 @@ There are three ways to define menu entries:
|
||||
To automatically define a menu entry for each top-level [section](g) of your site, enable the section pages menu in your project configuration.
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
sectionPagesMenu = "main"
|
||||
sectionPagesMenu = 'main'
|
||||
{{< /code-toggle >}}
|
||||
|
||||
This creates a menu structure that you can access with `site.Menus.main` in your templates. See [menu templates] for details.
|
||||
|
||||
@@ -37,15 +37,15 @@ By having the same path and base file name, the content pieces are linked togeth
|
||||
This system uses different content directories for each of the languages. Each language's `content` directory is set using the `contentDir` parameter.
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
languages:
|
||||
en:
|
||||
weight: 10
|
||||
languageName: "English"
|
||||
contentDir: "content/english"
|
||||
fr:
|
||||
weight: 20
|
||||
languageName: "Français"
|
||||
contentDir: "content/french"
|
||||
[languages.en]
|
||||
contentDir = 'content/english'
|
||||
label = "English"
|
||||
weight = 10
|
||||
|
||||
[languages.fr]
|
||||
contentDir = 'content/french'
|
||||
label = "Français"
|
||||
weight = 20
|
||||
{{< /code-toggle >}}
|
||||
|
||||
The value of `contentDir` can be any valid path -- even absolute path references. The only restriction is that the content directories cannot overlap.
|
||||
@@ -110,46 +110,13 @@ If, across the linked bundles, two or more files share the same basename, only o
|
||||
> [!note]
|
||||
> Page Bundle resources follow the same language assignment logic as content files, both by file name (`image.jpg`, `image.fr.jpg`) and by directory (`english/about/header.jpg`, `french/about/header.jpg`).
|
||||
|
||||
## Reference translated content
|
||||
|
||||
To create a list of links to translated content, use a template similar to the following:
|
||||
|
||||
```go-html-template {file="layouts/_partials/i18nlist.html"}
|
||||
{{ if .IsTranslated }}
|
||||
<h4>{{ i18n "translations" }}</h4>
|
||||
<ul>
|
||||
{{ range .Translations }}
|
||||
<li>
|
||||
<a href="{{ .RelPermalink }}">{{ .Language.Lang }}: {{ .LinkTitle }}{{ if .IsPage }} ({{ i18n "wordCount" . }}){{ end }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
The above can be put in a _partial_ template then included in any template. It will not print anything if there are no translations for a given page.
|
||||
|
||||
The above also uses the [`i18n` function][i18func] described in the next section.
|
||||
|
||||
### List all available languages
|
||||
|
||||
`.AllTranslations` on a `Page` can be used to list all translations, including the page itself. On the home page it can be used to build a language navigator:
|
||||
|
||||
```go-html-template {file="layouts/_partials/allLanguages.html"}
|
||||
<ul>
|
||||
{{ range $.Site.Home.AllTranslations }}
|
||||
<li><a href="{{ .RelPermalink }}">{{ .Language.LanguageName }}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
```
|
||||
|
||||
## Translation of strings
|
||||
|
||||
See the [`lang.Translate`] template function.
|
||||
|
||||
## Localization
|
||||
|
||||
The following localization examples assume your site's primary language is English, with translations to French and German.
|
||||
The following localization examples assume your project's primary language is English, with translations to French and German.
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
defaultContentLanguage = 'en'
|
||||
@@ -157,15 +124,15 @@ defaultContentLanguage = 'en'
|
||||
[languages]
|
||||
[languages.en]
|
||||
contentDir = 'content/en'
|
||||
languageName = 'English'
|
||||
label = 'English'
|
||||
weight = 1
|
||||
[languages.fr]
|
||||
contentDir = 'content/fr'
|
||||
languageName = 'Français'
|
||||
label = 'Français'
|
||||
weight = 2
|
||||
[languages.de]
|
||||
contentDir = 'content/de'
|
||||
languageName = 'Deutsch'
|
||||
label = 'Deutsch'
|
||||
weight = 3
|
||||
|
||||
{{< /code-toggle >}}
|
||||
@@ -264,8 +231,8 @@ For a simple menu with a small number of entries, use a single configuration fil
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[languages.de]
|
||||
languageCode = 'de-DE'
|
||||
languageName = 'Deutsch'
|
||||
label = 'Deutsch'
|
||||
locale = 'de-DE'
|
||||
weight = 1
|
||||
|
||||
[[languages.de.menus.main]]
|
||||
@@ -279,8 +246,8 @@ pageRef = '/services'
|
||||
weight = 20
|
||||
|
||||
[languages.en]
|
||||
languageCode = 'en-US'
|
||||
languageName = 'English'
|
||||
label = 'English'
|
||||
locale = 'en-US'
|
||||
weight = 2
|
||||
|
||||
[[languages.en.menus.main]]
|
||||
@@ -419,11 +386,10 @@ hugo new content content/de/post/test.md
|
||||
[configuration directory]: /configuration/introduction/#configuration-directory
|
||||
[example menu template]: /templates/menu/#example
|
||||
[front matter]: /content-management/menus/#define-in-front-matter
|
||||
[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.FormatNumber]: /functions/lang/formatnumber/
|
||||
[lang.FormatPercent]: /functions/lang/formatpercent/
|
||||
[lang.Merge]: /functions/lang/merge/
|
||||
[project configuration]: /content-management/menus/#define-in-project-configuration
|
||||
|
||||
@@ -175,11 +175,11 @@ For example, if a bundle has the resources `photo_specs.pdf`, `other_specs.pdf`,
|
||||
{{< code-toggle file=content/inspections/engine/index.md fm=true >}}
|
||||
title = 'Engine inspections'
|
||||
[[resources]]
|
||||
src = "*specs.pdf"
|
||||
title = "Specification #:counter"
|
||||
src = '*specs.pdf'
|
||||
title = 'Specification #:counter'
|
||||
[[resources]]
|
||||
src = "**.pdf"
|
||||
name = "pdf-file-:counter"
|
||||
src = '**.pdf'
|
||||
name = 'pdf-file-:counter'
|
||||
{{</ code-toggle >}}
|
||||
|
||||
the `Name` and `Title` will be assigned to the resource files as follows:
|
||||
@@ -193,7 +193,7 @@ the `Name` and `Title` will be assigned to the resource files as follows:
|
||||
|
||||
## Multilingual
|
||||
|
||||
By default, with a multilingual single-host site, Hugo does not duplicate shared page resources when building the site.
|
||||
By default, with a multilingual single-host project, Hugo does not duplicate shared page during the build.
|
||||
|
||||
> [!note]
|
||||
> This behavior is limited to Markdown content. Shared page resources for other [content formats] are copied into each language bundle.
|
||||
@@ -205,13 +205,13 @@ defaultContentLanguage = 'de'
|
||||
defaultContentLanguageInSubdir = true
|
||||
|
||||
[languages.de]
|
||||
languageCode = 'de-DE'
|
||||
languageName = 'Deutsch'
|
||||
label = 'Deutsch'
|
||||
locale = 'de-DE'
|
||||
weight = 1
|
||||
|
||||
[languages.en]
|
||||
languageCode = 'en-US'
|
||||
languageName = 'English'
|
||||
label = 'English'
|
||||
locale = 'en-US'
|
||||
weight = 2
|
||||
{{< /code-toggle >}}
|
||||
|
||||
@@ -274,7 +274,7 @@ This approach reduces build times, storage requirements, bandwidth consumption,
|
||||
> [!important]
|
||||
> To resolve Markdown link and image destinations to the correct location, you must use link and image render hooks that capture the page resource with the [`Resources.Get`] method, and then invoke its [`RelPermalink`] method.
|
||||
>
|
||||
> In its default configuration, Hugo automatically uses the [embedded link render hook] and the [embedded image render hook] for multilingual single-host sites, specifically when the [duplication of shared page resources] feature is disabled. This is the default behavior for such sites. If custom link or image render hooks are defined by your project, modules, or themes, these will be used instead.
|
||||
> In its default configuration, Hugo automatically uses the [embedded link render hook] and the [embedded image render hook] for multilingual single-host projects, specifically when the [duplication of shared page resources] feature is disabled. This is the default behavior for such projects. If custom link or image render hooks are defined by your project, modules, or themes, these will be used instead.
|
||||
>
|
||||
> You can also configure Hugo to `always` use the embedded link or image render hook, use it only as a `fallback`, or `never` use it. See [details](/configuration/markup/#renderhookslinkuseembedded).
|
||||
|
||||
|
||||
@@ -62,8 +62,8 @@ threshold = 20
|
||||
includeNewer = true
|
||||
toLower = false
|
||||
[[related.indices]]
|
||||
name = "fragmentrefs"
|
||||
type = "fragments"
|
||||
name = 'fragmentrefs'
|
||||
type = 'fragments'
|
||||
applyFilter = true
|
||||
weight = 80
|
||||
{{< /code-toggle >}}
|
||||
|
||||
@@ -16,7 +16,7 @@ There are three types of shortcodes: embedded, custom, and inline.
|
||||
|
||||
Hugo's embedded shortcodes are pre-defined templates within the application. Refer to each shortcode's documentation for specific usage instructions and available arguments.
|
||||
|
||||
{{% list-pages-in-section path=/shortcodes %}}
|
||||
{{% render-list-of-pages-in-section path=/shortcodes %}}
|
||||
|
||||
## Custom
|
||||
|
||||
@@ -34,7 +34,7 @@ Then call the shortcode from within markup:
|
||||
{{</* audio src=/audio/test.mp3 */>}}
|
||||
```
|
||||
|
||||
Learn more about creating shortcodes in the [shortcode templates] section.
|
||||
Learn more about creating shortcodes in the [shortcode templates][] section.
|
||||
|
||||
## Inline
|
||||
|
||||
@@ -51,7 +51,7 @@ enableInlineShortcodes = true
|
||||
|
||||
For more information see [configure security](/configuration/security).
|
||||
|
||||
The following example demonstrates an inline shortcode, `date.inline`, that accepts a single positional argument: a date/time [layout string].
|
||||
The following example demonstrates an inline shortcode, `date.inline`, that accepts a single positional argument: a date/time [layout string][].
|
||||
|
||||
```text {file="content/example.md"}
|
||||
Today is
|
||||
@@ -69,12 +69,12 @@ In the example above, the inline shortcode is executed twice: once upon definiti
|
||||
<p>Today is Thursday, January 30, 2025</p>
|
||||
```
|
||||
|
||||
Inline shortcodes process their inner content within the same context as regular _shortcode_ templates, allowing you to use any available [shortcode method].
|
||||
Inline shortcodes process their inner content within the same context as regular _shortcode_ templates, allowing you to use any available [shortcode method][].
|
||||
|
||||
> [!note]
|
||||
> You cannot [nest](#nesting) inline shortcodes.
|
||||
|
||||
Learn more about creating shortcodes in the [shortcode templates] section.
|
||||
Learn more about creating shortcodes in the [shortcode templates][] section.
|
||||
|
||||
## Calling
|
||||
|
||||
@@ -82,7 +82,7 @@ Shortcode calls involve three syntactical elements: tags, arguments, and notatio
|
||||
|
||||
### Tags
|
||||
|
||||
Some shortcodes expect content between opening and closing tags. For example, the embedded [`details`] shortcode requires an opening and closing tag:
|
||||
Some shortcodes expect content between opening and closing tags. For example, the embedded [`details`][] shortcode requires an opening and closing tag:
|
||||
|
||||
```text
|
||||
{{</* details summary="See the details" */>}}
|
||||
@@ -90,13 +90,13 @@ This is a **bold** word.
|
||||
{{</* /details */>}}
|
||||
```
|
||||
|
||||
Some shortcodes do not accept content. For example, the embedded [`instagram`] shortcode requires a single _positional_ argument:
|
||||
Some shortcodes do not accept content. For example, the embedded [`instagram`][] shortcode requires a single _positional_ argument:
|
||||
|
||||
```text
|
||||
{{</* instagram CxOWiQNP2MO */>}}
|
||||
```
|
||||
|
||||
Some shortcodes optionally accept content. For example, you can call the embedded [`qr`] shortcode with content:
|
||||
Some shortcodes optionally accept content. For example, you can call the embedded [`qr`][] shortcode with content:
|
||||
|
||||
```text
|
||||
{{</* qr */>}}
|
||||
@@ -116,7 +116,7 @@ Refer to each shortcode's documentation for specific usage instructions and avai
|
||||
|
||||
Shortcode arguments can be either _named_ or _positional_.
|
||||
|
||||
Named arguments are passed as case-sensitive key-value pairs, as seen in this example with the embedded [`figure`] shortcode. The `src` argument, for instance, is required.
|
||||
Named arguments are passed as case-sensitive key-value pairs, as seen in this example with the embedded [`figure`][] shortcode. The `src` argument, for instance, is required.
|
||||
|
||||
```text
|
||||
{{</* figure src=/images/kitten.jpg */>}}
|
||||
@@ -173,7 +173,7 @@ Standard|`{{</* foo */>}} ## Section 2 {{</* /foo */>}}`
|
||||
|
||||
#### Markdown notation
|
||||
|
||||
Hugo processes the shortcode before the page content is rendered by the Markdown renderer. This means, for instance, that Markdown headings inside a Markdown-notation shortcode will be included when invoking the [`TableOfContents`] method on the `Page` object.
|
||||
Hugo processes the shortcode before the page content is rendered by the Markdown renderer. This means, for instance, that Markdown headings inside a Markdown-notation shortcode will be included when invoking the [`TableOfContents`][] method on the `Page` object.
|
||||
|
||||
#### Standard notation
|
||||
|
||||
|
||||
@@ -132,8 +132,8 @@ content/
|
||||
Then add front matter to each term page:
|
||||
|
||||
{{< code-toggle file=content/authors/jsmith/_index.md fm=true >}}
|
||||
title = "John Smith"
|
||||
affiliation = "University of Chicago"
|
||||
title = 'John Smith'
|
||||
affiliation = 'University of Chicago'
|
||||
{{< /code-toggle >}}
|
||||
|
||||
Then create a _taxonomy_ template specific to the "authors" taxonomy:
|
||||
|
||||
@@ -96,7 +96,7 @@ https://example.org/articles/my-first-article.html
|
||||
|
||||
#### Leading slashes
|
||||
|
||||
With monolingual sites, `url` values with or without a leading slash are relative to the [`baseURL`][]. With multilingual sites, `url` values with a leading slash are relative to the `baseURL`, and `url` values without a leading slash are relative to the `baseURL` plus the language prefix.
|
||||
With monolingual projects, `url` values with or without a leading slash are relative to the [`baseURL`][]. With multilingual projects, `url` values with a leading slash are relative to the `baseURL`, and `url` values without a leading slash are relative to the `baseURL` plus the language prefix.
|
||||
|
||||
Site type|Front matter `url`|Resulting URL
|
||||
:--|:--|:--
|
||||
@@ -112,9 +112,9 @@ multilingual|`about`|`https://example.org/de/about/`
|
||||
You can also use tokens when setting the `url` value. This is typically used in `cascade` sections:
|
||||
|
||||
{{< code-toggle file=content/foo/bar/_index.md fm=true >}}
|
||||
title ="Bar"
|
||||
title ='Bar'
|
||||
[[cascade]]
|
||||
url = "/:sections[last]/:slug"
|
||||
url = '/:sections[last]/:slug'
|
||||
{{< /code-toggle >}}
|
||||
|
||||
Use any of these tokens:
|
||||
@@ -218,7 +218,7 @@ Unless you provide a custom layout, Hugo uses its [embedded alias template][] to
|
||||
|
||||
```go-html-template
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ site.Language.LanguageCode }}">
|
||||
<html lang="{{ site.Language.Locale }}">
|
||||
<head>
|
||||
<title>{{ .Permalink }}</title>
|
||||
{{ with .OutputFormats.Canonical }}<link rel="{{ .Rel }}" href="{{ .Permalink }}">{{ end }}
|
||||
|
||||
@@ -32,7 +32,7 @@ For a complete guide to contributing to Hugo, see the [Contribution Guide].
|
||||
To build the extended or extended/deploy edition from source you must:
|
||||
|
||||
1. Install [Git]
|
||||
1. Install [Go] version 1.24.0 or later
|
||||
1. Install [Go] version 1.25.0 or later
|
||||
1. Install a C compiler, either [GCC] or [Clang]
|
||||
1. Update your `PATH` environment variable as described in the [Go documentation]
|
||||
|
||||
@@ -143,7 +143,7 @@ CGO_ENABLED=1 go install -tags extended github.com/gohugoio/hugo@latest
|
||||
To build and install a specific release:
|
||||
|
||||
```sh
|
||||
CGO_ENABLED=1 go install -tags extended github.com/gohugoio/hugo@v0.156.0
|
||||
CGO_ENABLED=1 go install -tags extended github.com/gohugoio/hugo@v0.158.0
|
||||
```
|
||||
|
||||
To build and install at the latest commit on the master branch:
|
||||
|
||||
@@ -77,6 +77,7 @@ Link to the [glossary] as needed and use terms consistently. Pay particular atte
|
||||
- "server side" (noun), "server-side" (adjective)
|
||||
- "Markdown" (capitalized)
|
||||
- "open-source" (hyphenated adjective)
|
||||
- "Node.js" (first mention per page), "Node" (subsequent mentions), "node" (for the executable), "npm" (always lowercase)
|
||||
|
||||
### Template types
|
||||
|
||||
@@ -207,10 +208,10 @@ When available, the "See also" sidebar displays related pages using Hugo's [rela
|
||||
If the title in the "See also" sidebar is ambiguous or the same as another page, you can define an alternate title in the front matter:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
title = "Long descriptive title"
|
||||
linkTitle = "Short title"
|
||||
title = 'Long descriptive title'
|
||||
linkTitle = 'Short title'
|
||||
[params]
|
||||
alt_title = "Whatever you want"
|
||||
alt_title = 'Whatever you want'
|
||||
{{< /code-toggle >}}
|
||||
|
||||
Use of the alternate title is limited to the "See also" sidebar.
|
||||
@@ -298,7 +299,7 @@ Use the [code-toggle shortcode](#code-toggle) to include project configuration e
|
||||
```text
|
||||
{{</* code-toggle file=hugo */>}}
|
||||
baseURL = 'https://example.org/'
|
||||
languageCode = 'en-US'
|
||||
locale = 'en-US'
|
||||
title = 'My Site'
|
||||
{{</* /code-toggle */>}}
|
||||
```
|
||||
@@ -394,7 +395,7 @@ skipHeader
|
||||
```text
|
||||
{{</* code-toggle file=hugo copy=true */>}}
|
||||
baseURL = 'https://example.org/'
|
||||
languageCode = 'en-US'
|
||||
locale = 'en-US'
|
||||
title = 'My Site'
|
||||
{{</* /code-toggle */>}}
|
||||
```
|
||||
@@ -403,12 +404,15 @@ title = 'My Site'
|
||||
|
||||
Use the `deprecated-in` shortcode to indicate that a feature is deprecated:
|
||||
|
||||
```text
|
||||
{{</* deprecated-in 0.144.0 /*/>}}
|
||||
```
|
||||
|
||||
You can also include details:
|
||||
|
||||
```text
|
||||
{{</* deprecated-in 0.144.0 */>}}
|
||||
|
||||
Use [`hugo.IsServer`] instead.
|
||||
|
||||
[`hugo.IsServer`]: /functions/hugo/isserver/
|
||||
Use [`hugo.IsServer`](/functions/hugo/isserver/) instead.
|
||||
{{</* /deprecated-in */>}}
|
||||
```
|
||||
|
||||
@@ -456,34 +460,22 @@ This is a new feature.
|
||||
|
||||
## New features
|
||||
|
||||
Use the [new-in shortcode](#new-in) to indicate a new feature:
|
||||
Use the [new-in](#new-in) shortcode to indicate a new feature.
|
||||
|
||||
```text
|
||||
{{</* new-in 0.144.0 */>}}
|
||||
```
|
||||
|
||||
The "new in" label will be hidden if the specified version is older than a predefined threshold, based on differences in major and minor versions. See [details](https://github.com/gohugoio/hugoDocs/blob/master/_vendor/github.com/gohugoio/gohugoioTheme/layouts/_shortcodes/new-in.html).
|
||||
The new-in shortcode will trigger a build warning if the specified version is older than a predefined threshold, based on differences in major and minor versions. This serves as a reminder to remove this shortcode call. See [details](https://github.com/gohugoio/hugoDocs/blob/master/layouts/_partials/layouts/blocks/feature-state.html).
|
||||
|
||||
## Deprecated features
|
||||
|
||||
Use the [deprecated-in shorcode](#deprecated-in) shortcode to indicate that a feature is deprecated:
|
||||
Use the [deprecated-in](#deprecated-in) shortcode to indicate that a feature is deprecated.
|
||||
|
||||
```text
|
||||
{{</* deprecated-in 0.144.0 */>}}
|
||||
Use [`hugo.IsServer`] instead.
|
||||
The deprecated-in shortcode will trigger a build warning if the specified version is older than a predefined threshold, based on differences in major and minor versions. This serves as a reminder to remove this shortcode call and the associated content. See [details](https://github.com/gohugoio/hugoDocs/blob/master/layouts/_partials/layouts/blocks/feature-state.html).
|
||||
|
||||
[`hugo.IsServer`]: /functions/hugo/isserver/
|
||||
{{</* /deprecated-in */>}}
|
||||
When deprecating a feature that has its own page, also set the `expiryDate` in front matter to two years from the date of deprecation. Include a brief comment to explain the setting:
|
||||
|
||||
```yaml
|
||||
expiryDate: 2028-03-03 # deprecated 2026-03-03 in v0.157.0
|
||||
```
|
||||
|
||||
When deprecating a function or method, add something like this to front matter:
|
||||
|
||||
{{< code-toggle file=content/something/foo.md fm=true >}}
|
||||
expiryDate: 2027-02-17 # deprecated 2025-02-17 in v0.144.0
|
||||
{{< /code-toggle >}}
|
||||
|
||||
Set the `expiryDate` to two years from the date of deprecation, and add a brief front matter comment to explain the setting.
|
||||
|
||||
## GitHub workflow
|
||||
|
||||
> [!note]
|
||||
|
||||
@@ -51,14 +51,14 @@ The examples below assume this project configuration:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[params.authors.a]
|
||||
firstName = "Marius"
|
||||
lastName = "Pontmercy"
|
||||
firstName = 'Marius'
|
||||
lastName = 'Pontmercy'
|
||||
[params.authors.b]
|
||||
firstName = "Victor"
|
||||
lastName = "Hugo"
|
||||
firstName = 'Victor'
|
||||
lastName = 'Hugo'
|
||||
[params.authors.c]
|
||||
firstName = "Jean"
|
||||
lastName = "Valjean"
|
||||
firstName = 'Jean'
|
||||
lastName = 'Valjean'
|
||||
{{< /code-toggle >}}
|
||||
|
||||
> [!note]
|
||||
|
||||
@@ -274,7 +274,7 @@ If `mainSections` is not defined in your project configuration, the `MainSection
|
||||
|
||||
## Boolean/undefined comparison
|
||||
|
||||
Consider this site content:
|
||||
Consider this project structure:
|
||||
|
||||
```text
|
||||
content/
|
||||
|
||||
@@ -0,0 +1,256 @@
|
||||
---
|
||||
title: css.Build
|
||||
description: Bundle, transform, and minify CSS resources.
|
||||
categories: []
|
||||
keywords: []
|
||||
params:
|
||||
functions_and_methods:
|
||||
aliases: []
|
||||
returnType: resource.Resource
|
||||
signatures: ['css.Build [OPTIONS] RESOURCE']
|
||||
---
|
||||
|
||||
{{< new-in 0.158.0 />}}
|
||||
|
||||
Use the `css.Build` function to:
|
||||
|
||||
- Recursively replace `@import` statements in CSS files with the content of the imported files
|
||||
- Transform syntax for browser compatibility
|
||||
- Apply vendor prefixes for browser compatibility
|
||||
- Minify the bundled CSS code
|
||||
- Create a source map
|
||||
|
||||
If an `@import` statement includes a media query, a feature query, or a cascade layer assignment, the function wraps the imported content in the corresponding `@media`, `@supports`, or `@layer` rule.
|
||||
|
||||
## Usage
|
||||
|
||||
In this example, Hugo bundles the local files referenced by `@import` statements to create and publish a single resource with inline content.
|
||||
|
||||
```text
|
||||
assets/
|
||||
└── css/
|
||||
├── components/
|
||||
│ ├── a.css
|
||||
│ └── b.css
|
||||
└── main.css
|
||||
```
|
||||
|
||||
```css {file="assets/css/main.css" copy=true}
|
||||
@import url('https://cdn.jsdelivr.net/npm/the-new-css-reset/css/reset.min.css');
|
||||
|
||||
@import './components/a.css';
|
||||
@import './components/b.css';
|
||||
|
||||
.c {color: blue; }
|
||||
```
|
||||
|
||||
```css {file="assets/css/components/a.css" copy=true}
|
||||
.a { color: red; }
|
||||
```
|
||||
|
||||
```css {file="assets/css/components/b.css" copy=true}
|
||||
.b { color: green; }
|
||||
```
|
||||
|
||||
```go-html-template {file="layouts/_partials/css.html" copy=true}
|
||||
{{ with resources.Get "css/main.css" | css.Build }}
|
||||
{{ if hugo.IsDevelopment }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}">
|
||||
{{ else }}
|
||||
{{ with . | fingerprint }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
```go-html-template {file="layouts/baseof.html" copy=true}
|
||||
{{ partialCached "css.html" . }}
|
||||
```
|
||||
|
||||
The generated CSS code:
|
||||
|
||||
```css {file="public/css/main.css"}
|
||||
@import "https://cdn.jsdelivr.net/npm/the-new-css-reset/css/reset.min.css";
|
||||
|
||||
.a {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.b {
|
||||
color: green;
|
||||
}
|
||||
|
||||
.c {
|
||||
color: blue;
|
||||
}
|
||||
```
|
||||
|
||||
To minify the generated CSS code, use the [`minify`](#minify) option as described below.
|
||||
|
||||
## Options
|
||||
|
||||
The `css.Build` function takes an optional map of options based on the underlying [`esbuild`] package. Use these options to fine-tune bundling, minification, and browser compatibility.
|
||||
|
||||
externals
|
||||
: (`[]string`) A slice of path patterns to exclude from bundling. The `@import` statements for these patterns remain as-is in the generated CSS code. See [details][esb_external].
|
||||
|
||||
```go-html-template
|
||||
{{ $opts := dict "externals" (slice "./exclude-these/*" "./exclude-these-too/*") }}
|
||||
{{ $r := resources.Get "css/main.css" | css.Build $opts }}
|
||||
```
|
||||
|
||||
loaders
|
||||
: (`map`) A map of file extensions to loader types. This determines how files with a given extension are processed during bundling. By default, Hugo uses the `css` loader for `.css` files and the `file` loader for all others. Common loaders include:
|
||||
|
||||
- `css`: Processes the file as a CSS file
|
||||
- `dataurl`: Embeds the file as a base64-encoded data URL
|
||||
- `empty`: Excludes the file from the bundle
|
||||
- `file`: Copies the file to the output directory and rewrites the URL
|
||||
- `text`: Loads the file content as a string
|
||||
|
||||
See [details][esb_loader].
|
||||
|
||||
```go-html-template
|
||||
{{ $opts := dict "loaders" (dict ".png" "dataurl" ".svg" "dataurl") }}
|
||||
{{ $r := resources.Get "css/main.css" | css.Build $opts }}
|
||||
```
|
||||
|
||||
mainFields
|
||||
: (`[]string`) A prioritized slice of field names in a `package.json` file that determine the CSS entry point of a Node package. The default is `["style", "main"]`. See [details][esb_mainfields].
|
||||
|
||||
When an `@import` statement references a Node package, Hugo consults the metadata in the `package.json` file to find the stylesheet. Use this option to support packages that define a CSS entry point using non-standard fields.
|
||||
|
||||
```go-html-template
|
||||
{{ $opts := dict "mainFields" (slice "css" "style" "main") }}
|
||||
{{ $r := resources.Get "css/main.css" | css.Build $opts }}
|
||||
```
|
||||
|
||||
minify
|
||||
: (`bool`) Whether to minify the generated CSS code. Default is `false`. See [details][esb_minify].
|
||||
|
||||
```go-html-template
|
||||
{{ $opts := dict "minify" true }}
|
||||
{{ $r := resources.Get "css/main.css" | css.Build $opts }}
|
||||
```
|
||||
|
||||
sourceMap
|
||||
: (`string`) The type of source map to generate. One of `external`, `inline`, `linked`, or `none`. Default is `none`. See [details][esb_sourcemap].
|
||||
|
||||
```go-html-template
|
||||
{{ $opts := dict "sourceMap" "linked" }}
|
||||
{{ $r := resources.Get "css/main.css" | css.Build $opts }}
|
||||
```
|
||||
|
||||
sourcesContent
|
||||
: (`bool`) Whether to include the content of the source files in the source map. Default is `true`. See [details][esb_sourcesContent].
|
||||
|
||||
```go-html-template
|
||||
{{ $opts := dict "sourceMap" "linked" "sourcesContent" false }}
|
||||
{{ $r := resources.Get "css/main.css" | css.Build $opts }}
|
||||
```
|
||||
|
||||
target
|
||||
: (`[]string`) The target environment for the generated CSS code. This determines which syntax transformations to perform and which vendor prefixes to apply. If unset, no transformations or prefixing are performed. Each element consists of a target name and a version number. Supported targets include `chrome`, `edge`, `firefox`, `ie`, `ios`, `opera`, and `safari`. See [details][esb_target].
|
||||
|
||||
```go-html-template
|
||||
{{ $target := slice "chrome115" "edge115" "firefox116" "ios16.4" "opera101" "safari16.4" }}
|
||||
{{ $opts := dict "target" $target }}
|
||||
{{ $r := resources.Get "css/main.css" | css.Build $opts }}
|
||||
```
|
||||
|
||||
In the example above, the target environment is roughly equivalent to the [browserlist][] "baseline widely available" profile as of March 2026.
|
||||
|
||||
targetPath
|
||||
: (`string`) The path to the generated CSS file, relative to the project's [`publishDir`][]. If unset, this defaults to the asset's original path with a `.css` extension.
|
||||
|
||||
```go-html-template
|
||||
{{ $opts := dict "targetPath" "css/styles.css" }}
|
||||
{{ $r := resources.Get "css/main.css" | css.Build $opts }}
|
||||
```
|
||||
|
||||
## Example
|
||||
|
||||
The example below uses several of the [options](#options) described above to bundle, transform, and minify CSS code.
|
||||
|
||||
```go-html-template {file="layouts/_partials/css.html" copy=true}
|
||||
{{ with resources.Get "css/main.css" }}
|
||||
{{ $opts := dict
|
||||
"loaders" (dict ".png" "dataurl" ".svg" "dataurl")
|
||||
"minify" (cond hugo.IsDevelopment false true)
|
||||
"sourceMap" (cond hugo.IsDevelopment "linked" "none")
|
||||
"target" (slice "chrome115" "edge115" "firefox116" "ios16.4" "opera101" "safari16.4")
|
||||
}}
|
||||
{{ with . | css.Build $opts }}
|
||||
{{ if hugo.IsDevelopment }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}">
|
||||
{{ else }}
|
||||
{{ with . | fingerprint }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
Using the options above, Hugo does the following:
|
||||
|
||||
- Embeds PNG and SVG images as data URLs in the generated CSS code
|
||||
- Minifies the output in production but not in development
|
||||
- Generates an external source map in development but not in production
|
||||
- Transforms syntax for compatibility with the targeted browser versions
|
||||
- Adds vendor prefixes for compatibility with the targeted browser versions
|
||||
- Publishes the generated CSS code to `css/styles.css`
|
||||
- In production, adds an SRI hash and inserts a file hash into the filename
|
||||
|
||||
[`esbuild`]: https://github.com/evanw/esbuild
|
||||
[`publishDir`]: /configuration/all/#publishdir
|
||||
[browserlist]: https://browsersl.ist
|
||||
[esb_external]: https://esbuild.github.io/api/#external
|
||||
[esb_loader]: https://esbuild.github.io/api/#loader
|
||||
[esb_mainfields]: https://esbuild.github.io/api/#main-fields
|
||||
[esb_minify]: https://esbuild.github.io/api/#minify
|
||||
[esb_sourcemap]: https://esbuild.github.io/api/#sourcemap
|
||||
[esb_sourcesContent]: https://esbuild.github.io/api/#sources-content
|
||||
[esb_target]: https://esbuild.github.io/api/#target
|
||||
|
||||
## Common patterns
|
||||
|
||||
The examples below cover the most frequent use cases for referencing resources within your project or within Node packages. These patterns apply to both `@import` statements and the `url()` functional notation used for images and fonts.
|
||||
|
||||
All resources referenced by a path, including images, fonts, and stylesheets, must reside in the `assets` directory of the [unified file system](g), or within a Node package.
|
||||
|
||||
### Files in the assets directory
|
||||
|
||||
To include a stylesheet from the `assets` directory, you can use a bare path, a relative path, or a root-relative path. When you use a bare path, Hugo searches relative to the current stylesheet, then relative to the `assets` directory.
|
||||
|
||||
```css {file="/assets/css/main.css"}
|
||||
/* A bare path */
|
||||
@import "variables.css";
|
||||
|
||||
/* A relative path */
|
||||
@import "./theme.css";
|
||||
@import "../layout.css";
|
||||
|
||||
/* A root-relative path */
|
||||
@import "/css/grid.css";
|
||||
|
||||
/* A url() reference using the same resolution logic */
|
||||
.logo { background: url("/images/logo.svg"); }
|
||||
```
|
||||
|
||||
### Node packages
|
||||
|
||||
When referencing a Node package by name, Hugo consults the `package.json` file within that package to find the entry point.
|
||||
|
||||
```css {file="/assets/css/main.css"}
|
||||
@import "bootstrap";
|
||||
```
|
||||
|
||||
### Files within a package
|
||||
|
||||
To reference a specific file within a Node package, provide the path starting with the package name.
|
||||
|
||||
```css {file="/assets/css/main.css"}
|
||||
@import "bootstrap/dist/css/bootstrap-grid.css";
|
||||
```
|
||||
@@ -8,10 +8,9 @@ params:
|
||||
aliases: [postCSS]
|
||||
returnType: resource.Resource
|
||||
signatures: ['css.PostCSS [OPTIONS] RESOURCE']
|
||||
aliases: [/functions/resources/postcss/]
|
||||
---
|
||||
|
||||
{{< new-in 0.128.0 />}}
|
||||
|
||||
```go-html-template
|
||||
{{ with resources.Get "css/main.css" | postCSS }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}">
|
||||
@@ -26,7 +25,7 @@ Step 1
|
||||
: Install [Node.js].
|
||||
|
||||
Step 2
|
||||
: Install the required Node.js packages in the root of your project. For example, to add vendor prefixes to your CSS rules:
|
||||
: Install the required Node packages in the root of your project. For example, to add vendor prefixes to your CSS rules:
|
||||
|
||||
```sh
|
||||
npm i -D postcss postcss-cli autoprefixer
|
||||
@@ -72,7 +71,7 @@ inlineImports
|
||||
: (`bool`) Whether to enable inlining of import statements. It does so recursively, but will only import a file once. URL imports (e.g. `@import url('https://fonts.googleapis.com/css?family=Open+Sans&display=swap');`) and imports with media queries will be ignored. Note that this import routine does not care about the CSS spec, so you can have @import anywhere in the file. Hugo will look for imports relative to the module mount and will respect theme overrides. Default is `false`.
|
||||
|
||||
skipInlineImportsNotFound
|
||||
: (`bool`) Whether to allow the build process to continue despite unresolved import statements, preserving the original import declarations. If you have regular CSS imports in your CSS that you want to preserve, you can either use imports with URL or media queries (Hugo does not try to resolve those) or set this option to `true`. Default is `false`."
|
||||
: (`bool`) Whether to allow the build process to continue despite unresolved import statements, preserving the original import declarations. If you have regular CSS imports in your CSS that you want to preserve, you can either use imports with URL or media queries (Hugo does not try to resolve those) or set this option to `true`. Default is `false`.
|
||||
|
||||
```go-html-template
|
||||
{{ $opts := dict "config" "config-directory" "noMap" true }}
|
||||
|
||||
@@ -8,6 +8,7 @@ params:
|
||||
aliases: [toCSS]
|
||||
returnType: resource.Resource
|
||||
signatures: ['css.Sass [OPTIONS] RESOURCE']
|
||||
aliases: [/functions/resources/tocss/]
|
||||
---
|
||||
|
||||
Transpile Sass to CSS using the LibSass transpiler included in Hugo's extended and extended/deploy editions, or [install Dart Sass](#dart-sass) to use the latest features of the Sass language.
|
||||
|
||||
@@ -10,8 +10,6 @@ params:
|
||||
signatures: ['css.TailwindCSS [OPTIONS] RESOURCE']
|
||||
---
|
||||
|
||||
{{< new-in 0.128.0 />}}
|
||||
|
||||
Use the `css.TailwindCSS` function to process your Tailwind CSS files. This function uses the Tailwind CSS CLI to:
|
||||
|
||||
1. Scan your templates for Tailwind CSS utility class usage.
|
||||
|
||||
@@ -12,7 +12,7 @@ params:
|
||||
|
||||
{{< new-in 0.141.0 />}}
|
||||
|
||||
The `try` statement is a non-standard extension to Go's [text/template] package. It introduces a mechanism for handling errors within templates, mimicking the `try-catch` constructs found in other programming languages.
|
||||
The `try` statement is a non-standard extension to Go's [`text/template`][] package. It introduces a mechanism for handling errors within templates, mimicking the `try-catch` constructs found in other programming languages.
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -85,7 +85,7 @@ Hugo renders the above to:
|
||||
|
||||
## Example
|
||||
|
||||
Error handling is essential when using the [`resources.GetRemote`] function to capture remote resources such as data or images. When calling this function, if the HTTP request fails, Hugo will fail the build.
|
||||
Error handling is essential when using the [`resources.GetRemote`][] function to capture remote resources such as data or images. When calling this function, if the HTTP request fails, Hugo will fail the build.
|
||||
|
||||
Instead of failing the build, we can catch the error and emit a warning:
|
||||
|
||||
@@ -102,11 +102,11 @@ Instead of failing the build, we can catch the error and emit a warning:
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
In the above, note that the [context](g) within the last conditional block is the `TryValue` object returned by the `try` statement. At this point neither the `Err` nor `Value` methods returned anything, so the current context is not useful. Use the `$` to access the [template context] if needed.
|
||||
In the above, note that the [context](g) within the last conditional block is the `TryValue` object returned by the `try` statement. At this point neither the `Err` nor `Value` methods returned anything, so the current context is not useful. Use the `$` to access the [template context][] if needed.
|
||||
|
||||
> [!note]
|
||||
> Hugo does not classify an HTTP response with status code 404 as an error. In this case `resources.GetRemote` returns nil.
|
||||
|
||||
[`resources.GetRemote`]: /functions/resources/getremote/
|
||||
[template context]: /templates/introduction/#template-context
|
||||
[text/template]: https://pkg.go.dev/text/template
|
||||
[`text/template`]: https://pkg.go.dev/text/template
|
||||
|
||||
@@ -11,5 +11,5 @@ params:
|
||||
---
|
||||
|
||||
```go-html-template
|
||||
{{ hugo.Generator }} → <meta name="generator" content="Hugo 0.156.0">
|
||||
{{ hugo.Generator }} → <meta name="generator" content="Hugo 0.158.0">
|
||||
```
|
||||
|
||||
@@ -18,14 +18,14 @@ defaultContentLanguageInSubdir = true
|
||||
[languages]
|
||||
[languages.de]
|
||||
baseURL = 'https://de.example.org/'
|
||||
languageCode = 'de-DE'
|
||||
languageName = 'Deutsch'
|
||||
label = 'Deutsch'
|
||||
locale = 'de-DE'
|
||||
title = 'Projekt Dokumentation'
|
||||
weight = 1
|
||||
[languages.en]
|
||||
baseURL = 'https://en.example.org/'
|
||||
languageCode = 'en-US'
|
||||
languageName = 'English'
|
||||
label = 'English'
|
||||
locale = 'en-US'
|
||||
title = 'Project Documentation'
|
||||
weight = 2
|
||||
{{< /code-toggle >}}
|
||||
|
||||
@@ -17,13 +17,13 @@ defaultContentLanguage = 'de'
|
||||
defaultContentLanguageInSubdir = true
|
||||
[languages]
|
||||
[languages.de]
|
||||
languageCode = 'de-DE'
|
||||
languageName = 'Deutsch'
|
||||
label = 'Deutsch'
|
||||
locale = 'de-DE'
|
||||
title = 'Projekt Dokumentation'
|
||||
weight = 1
|
||||
[languages.en]
|
||||
languageCode = 'en-US'
|
||||
languageName = 'English'
|
||||
label = 'English'
|
||||
locale = 'en-US'
|
||||
title = 'Project Documentation'
|
||||
weight = 2
|
||||
{{< /code-toggle >}}
|
||||
|
||||
@@ -23,17 +23,17 @@ defaultContentVersionInSubdir = true
|
||||
|
||||
[languages.de]
|
||||
contentDir = 'content/de'
|
||||
languageCode = 'de-DE'
|
||||
languageDirection = 'ltr'
|
||||
languageName = 'Deutsch'
|
||||
direction = 'ltr'
|
||||
label = 'Deutsch'
|
||||
locale = 'de-DE'
|
||||
title = 'Projekt Dokumentation'
|
||||
weight = 1
|
||||
|
||||
[languages.en]
|
||||
contentDir = 'content/en'
|
||||
languageCode = 'en-US'
|
||||
languageDirection = 'ltr'
|
||||
languageName = 'English'
|
||||
direction = 'ltr'
|
||||
label = 'English'
|
||||
locale = 'en-US'
|
||||
title = 'Project Documentation'
|
||||
weight = 2
|
||||
|
||||
|
||||
@@ -11,5 +11,5 @@ params:
|
||||
---
|
||||
|
||||
```go-html-template
|
||||
{{ hugo.Version }} → 0.156.0
|
||||
{{ hugo.Version }} → 0.158.0
|
||||
```
|
||||
|
||||
@@ -11,7 +11,8 @@ params:
|
||||
aliases: [/functions/imageconfig]
|
||||
---
|
||||
|
||||
See [image processing] for an overview of Hugo's image pipeline.
|
||||
> [!note]
|
||||
> This is a legacy function, superseded by the [`Width`][] and [`Height`][] methods for [global resources](g), [page resources](g), and [remote resources](g). See the [image processing][] section for details.
|
||||
|
||||
```go-html-template
|
||||
{{ $ic := images.Config "/static/images/a.jpg" }}
|
||||
@@ -20,10 +21,7 @@ See [image processing] for an overview of Hugo's image pipeline.
|
||||
{{ $ic.Height }} → 400 (int)
|
||||
```
|
||||
|
||||
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 resources](g), [page resources](g), and [remote resources](g). See the [image processing] section for details.
|
||||
Supported image formats include AVIF, BMP, GIF, HEIC, HEIF, JPEG, PNG, TIFF, and WebP.
|
||||
|
||||
[`Height`]: /methods/resource/height/
|
||||
[`Width`]: /methods/resource/width/
|
||||
|
||||
@@ -7,10 +7,19 @@ params:
|
||||
functions_and_methods:
|
||||
aliases: []
|
||||
returnType: images.ImageResource
|
||||
signatures: [images.Filter FILTERS... IMAGE]
|
||||
signatures: [images.Filter FILTER... RESOURCE]
|
||||
---
|
||||
|
||||
Apply one or more [image filters](#image-filters) to the given image.
|
||||
{{% include "/_common/methods/resource/global-page-remote-resources.md" %}}
|
||||
|
||||
The `images.Filter` function returns a new resource from a [processable image](g) after applying one or more [image filters](#image-filters).
|
||||
|
||||
> [!note]
|
||||
> Use the [`reflect.IsImageResourceProcessable`][] function to verify that an image can be processed.
|
||||
|
||||
## Usage
|
||||
|
||||
Use the `images.Filter` function to apply effects such as blurring, sharpening, or grayscale conversion. You can pass a single filter or a slice of filters. When providing a slice, Hugo applies the filters from left to right.
|
||||
|
||||
To apply a single filter:
|
||||
|
||||
@@ -36,9 +45,7 @@ To apply two or more filters, executing from left to right:
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
You can also apply image filters using the [`Filter`] method on a `Resource` object.
|
||||
|
||||
[`Filter`]: /methods/resource/filter/
|
||||
You can also apply image filters using the [`Filter`][] method on a `Resource` object.
|
||||
|
||||
## Example
|
||||
|
||||
@@ -62,4 +69,7 @@ You can also apply image filters using the [`Filter`] method on a `Resource` obj
|
||||
|
||||
Use any of these filters with the `images.Filter` function, or with the `Filter` method on a `Resource` object.
|
||||
|
||||
{{% list-pages-in-section path=/functions/images filter=functions_images_no_filters filterType=exclude %}}
|
||||
{{% render-list-of-pages-in-section path=/functions/images filter=functions_images_no_filters filterType=exclude %}}
|
||||
|
||||
[`Filter`]: /methods/resource/filter/
|
||||
[`reflect.IsImageResourceProcessable`]: /functions/reflect/isimageresourceprocessable/
|
||||
|
||||
@@ -21,7 +21,7 @@ Returns an image filter that processes an image according to the given [processi
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
In the example above, `"crop 200x200 TopRight webp q50"` is the _processing specification_.
|
||||
In the example above, `"crop 200x200 TopRight webp q50"` is the processing specification.
|
||||
|
||||
{{% include "/_common/methods/resource/processing-spec.md" %}}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ params:
|
||||
aliases: [babel]
|
||||
returnType: resource.Resource
|
||||
signatures: ['js.Babel [OPTIONS] RESOURCE']
|
||||
aliases: [/functions/resources/babel/]
|
||||
---
|
||||
|
||||
```go-html-template
|
||||
@@ -35,7 +36,7 @@ Step 1
|
||||
: Install [Node.js](https://nodejs.org/en/download)
|
||||
|
||||
Step 2
|
||||
: Install the required Node.js packages in the root of your project.
|
||||
: Install the required Node packages in the root of your project.
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/core @babel/cli
|
||||
|
||||
@@ -21,9 +21,8 @@ The `js.Build` function uses the [evanw/esbuild] package to:
|
||||
```go-html-template
|
||||
{{ with resources.Get "js/main.js" }}
|
||||
{{$opts := dict
|
||||
"minify" (not hugo.IsDevelopment)
|
||||
"sourceMap" (cond hugo.IsDevelopment "external" "")
|
||||
"targetPath" "js/main.js"
|
||||
"minify" (cond hugo.IsDevelopment false true)
|
||||
"sourceMap" (cond hugo.IsDevelopment "linked" "none")
|
||||
}}
|
||||
{{ with . | js.Build $opts }}
|
||||
{{ if hugo.IsDevelopment }}
|
||||
@@ -49,7 +48,7 @@ format
|
||||
|
||||
## Import JS code from the assets directory
|
||||
|
||||
`js.Build` has full support for the virtual union file system in [Hugo Modules](/hugo-modules/). You can see some simple examples in this [test project](https://github.com/gohugoio/hugoTestProjectJSModImports), but in short this means that you can do this:
|
||||
`js.Build` has full support for Hugo's [unified file system](g). You can see some simple examples in this [test project](https://github.com/gohugoio/hugoTestProjectJSModImports), but in short this means that you can do this:
|
||||
|
||||
```js
|
||||
import { hello } from 'my/module';
|
||||
@@ -93,7 +92,7 @@ Hugo will, by default, generate a `assets/jsconfig.json` file that maps the impo
|
||||
|
||||
## Node.js dependencies
|
||||
|
||||
Use the `js.Build` function to include Node.js dependencies.
|
||||
Use the `js.Build` function to include Node dependencies.
|
||||
|
||||
Any imports in a file outside `assets` or that does not resolve to a component inside `assets` will be resolved by [esbuild](https://esbuild.github.io/) with the **project directory** as the resolve directory (used as the starting point when looking for `node_modules` etc.). Also see [hugo mod npm pack](/commands/hugo_mod_npm_pack/). If you have any imported npm dependencies in your project, you need to make sure to run `npm install` before you run `hugo build`.
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ i18n/en.toml
|
||||
i18n/pt-BR.toml
|
||||
```
|
||||
|
||||
The base name must match the [`languageCode`][] or [language key][] as defined in your project configuration. Hugo selects the translation table based on the `languageCode`, falling back to the language key if a matching translation table does not exist.
|
||||
The base name must match the [`locale`][] or [language key][] as defined in your project configuration. Hugo selects the translation table based on the `locale`, falling back to the language key if a matching translation table does not exist.
|
||||
|
||||
Artificial languages with private use subtags as defined in [RFC 5646 § 2.2.7][] are also supported. You may omit the `art-x-` prefix for brevity. For example:
|
||||
|
||||
@@ -45,7 +45,7 @@ i18n/hugolang.toml
|
||||
|
||||
## Simple translations
|
||||
|
||||
Let's say your multilingual site supports two languages, English and Polish. Create a translation table for each language in the `i18n` directory.
|
||||
Let's say your multilingual project supports two languages, English and Polish. Create a translation table for each language in the `i18n` directory.
|
||||
|
||||
```text
|
||||
i18n/
|
||||
@@ -86,7 +86,7 @@ When viewing the Polish language site:
|
||||
|
||||
## Translations with pluralization
|
||||
|
||||
Let's say your multilingual site supports two languages, English and Polish. Create a translation table for each language in the `i18n` directory.
|
||||
Let's say your multilingual project supports two languages, English and Polish. Create a translation table for each language in the `i18n` directory.
|
||||
|
||||
```text
|
||||
i18n/
|
||||
@@ -238,7 +238,7 @@ Then in your templates:
|
||||
|
||||
[`defaultContentLanguage`]: /configuration/all/#defaultcontentlanguage
|
||||
[`enableMissingTranslationPlaceholders`]: /configuration/all/#enablemissingtranslationplaceholders
|
||||
[`languageCode`]: /configuration/languages/#languagecode
|
||||
[`locale`]: /configuration/languages/#locale
|
||||
[`printI18nWarnings`]: /configuration/all/#printi18nwarnings
|
||||
[CLDR]: https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html
|
||||
[go-i18n]: https://github.com/nicksnyder/go-i18n
|
||||
|
||||
@@ -10,7 +10,7 @@ params:
|
||||
signatures: [math.Counter]
|
||||
---
|
||||
|
||||
The counter is global for both monolingual and multilingual sites, and its initial value for each build is 1.
|
||||
The counter is global for both monolingual and multilingual projects, and its initial value for each build is 1.
|
||||
|
||||
```go-html-template {file="layouts/page.html"}
|
||||
{{ warnf "page.html called %d times" math.Counter }}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: reflect.IsImageResource
|
||||
description: Reports whether the given value is a Resource object representing a processable image.
|
||||
description: Reports whether the given value is a Resource object representing an image as defined by its media type.
|
||||
categories: []
|
||||
keywords: []
|
||||
params:
|
||||
@@ -12,60 +12,18 @@ params:
|
||||
|
||||
{{< new-in 0.154.0 />}}
|
||||
|
||||
{{% glossary-term "processable image" %}}
|
||||
## Usage
|
||||
|
||||
With this project structure:
|
||||
This example iterates through all project resources and uses `reflect.IsImageResource` to decide whether to render an image tag or provide a download link for non-image files.
|
||||
|
||||
```text
|
||||
project/
|
||||
├── assets/
|
||||
│ ├── a.json
|
||||
│ ├── b.avif
|
||||
│ └── c.jpg
|
||||
└── content/
|
||||
└── example/
|
||||
├── index.md
|
||||
├── d.json
|
||||
├── e.avif
|
||||
└── f.jpg
|
||||
```
|
||||
|
||||
These are the values returned by the `reflect.IsImageResource` function:
|
||||
|
||||
```go-html-template {file="layouts/page.html"}
|
||||
{{ with resources.Get "a.json" }}
|
||||
{{ reflect.IsImageResource . }} → false
|
||||
{{ end }}
|
||||
|
||||
{{ with resources.Get "b.avif" }}
|
||||
{{ reflect.IsImageResource . }} → false
|
||||
{{ end }}
|
||||
|
||||
{{ with resources.Get "c.jpg" }}
|
||||
{{ reflect.IsImageResource . }} → true
|
||||
```go-html-template
|
||||
{{ range resources.Match "**" }}
|
||||
{{ if reflect.IsImageResource . }}
|
||||
<img src="{{ .RelPermalink }}" alt="Image">
|
||||
{{ else }}
|
||||
<a href="{{ .RelPermalink }}">Download</a>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
In the example above, the `b.avif` image is not a processable image because Hugo can neither decode nor encode the AVIF image format.
|
||||
|
||||
```go-html-template {file="layouts/page.html"}
|
||||
{{ with .Resources.Get "d.json" }}
|
||||
{{ reflect.IsImageResource . }} → false
|
||||
{{ end }}
|
||||
|
||||
{{ with .Resources.Get "e.avif" }}
|
||||
{{ reflect.IsImageResource . }} → false
|
||||
{{ end }}
|
||||
|
||||
{{ with .Resources.Get "f.jpg" }}
|
||||
{{ reflect.IsImageResource . }} → true
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
In the example above, the `e.avif` image is not a processable image because Hugo can neither decode nor encode the AVIF image format.
|
||||
|
||||
```go-html-template {file="layouts/page.html"}
|
||||
{{ with site.GetPage "/example" }}
|
||||
{{ reflect.IsImageResource . }} → false
|
||||
{{ end }}
|
||||
```
|
||||
{{% include "/_common/functions/reflect/image-reflection-functions.md" %}}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
---
|
||||
title: reflect.IsImageResourceProcessable
|
||||
description: Reports whether the given value is a Resource object representing an image from which Hugo can extract dimensions and perform processing such as converting, resizing, cropping, or filtering.
|
||||
categories: []
|
||||
keywords: []
|
||||
params:
|
||||
functions_and_methods:
|
||||
aliases: []
|
||||
returnType: bool
|
||||
signatures: [reflect.IsImageResourceProcessable INPUT]
|
||||
---
|
||||
|
||||
{{< new-in 0.157.0 />}}
|
||||
|
||||
{{% glossary-term "processable image" %}}
|
||||
|
||||
## Usage
|
||||
|
||||
This example iterates through all project resources and uses `reflect.IsImageResourceProcessable` to ensure the image pipeline can perform transformations like resizing before processing begins.
|
||||
|
||||
```go-html-template
|
||||
{{ range resources.Match "**" }}
|
||||
{{ if reflect.IsImageResourceProcessable . }}
|
||||
{{ with .Process "resize 300x webp" }}
|
||||
<img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="Processed Image">
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
{{% include "/_common/functions/reflect/image-reflection-functions.md" %}}
|
||||
@@ -0,0 +1,30 @@
|
||||
---
|
||||
title: reflect.IsImageResourceWithMeta
|
||||
description: Reports whether the given value is a Resource object representing an image from which Hugo can extract dimensions and, if present, Exif, IPTC, and XMP data.
|
||||
categories: []
|
||||
keywords: []
|
||||
params:
|
||||
functions_and_methods:
|
||||
aliases: []
|
||||
returnType: bool
|
||||
signatures: [reflect.IsImageResourceWithMeta INPUT]
|
||||
---
|
||||
|
||||
{{< new-in 0.157.0 />}}
|
||||
|
||||
## Usage
|
||||
|
||||
This example iterates through all project resources and uses `reflect.IsImageResourceWithMeta` to safely display image dimensions and metadata only for supported formats.
|
||||
|
||||
```go-html-template
|
||||
{{ range resources.Match "**" }}
|
||||
{{ if reflect.IsImageResourceWithMeta . }}
|
||||
<img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="Image with Meta">
|
||||
{{ with .Meta }}
|
||||
<p>Taken on: {{ .Date }}</p>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
{{% include "/_common/functions/reflect/image-reflection-functions.md" %}}
|
||||
@@ -1,18 +0,0 @@
|
||||
---
|
||||
title: resources.Babel
|
||||
description: Compiles the given JavaScript resource with Babel.
|
||||
categories: []
|
||||
keywords: []
|
||||
params:
|
||||
functions_and_methods:
|
||||
aliases: []
|
||||
returnType: resource.Resource
|
||||
signatures: ['resources.Babel [OPTIONS] RESOURCE']
|
||||
expiryDate: 2026-06-24 # deprecated 2024-06-24 in v0.128.0
|
||||
---
|
||||
|
||||
{{< deprecated-in 0.128.0 >}}
|
||||
Use [`js.Babel`] instead.
|
||||
|
||||
[`js.Babel`]: /functions/js/babel/
|
||||
{{< /deprecated-in >}}
|
||||
@@ -22,9 +22,9 @@ Let's say you need to publish a file named "site.json" in the root of your `publ
|
||||
|
||||
```json
|
||||
{
|
||||
"build_date": "2026-01-11T11:27:49-08:00",
|
||||
"hugo_version": "0.156.0",
|
||||
"last_modified": "2026-01-11T11:27:59-08:00"
|
||||
"build_date": "2026-03-16T13:56:25-07:00",
|
||||
"hugo_version": "0.158.0",
|
||||
"last_modified": "2026-02-16T12:04:52-07:00"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -45,17 +45,18 @@ key
|
||||
method
|
||||
: (`string`) The action to perform on the requested resource, typically one of `GET`, `POST`, or `HEAD`.
|
||||
|
||||
timeout
|
||||
: (`string`) Cancels the request if it does not complete within this duration (e.g. "30s").
|
||||
|
||||
responseHeaders
|
||||
: {{< new-in 0.143.0 />}}
|
||||
: (`[]string`) The headers to extract from the server's response, accessible through the resource's [`Data.Headers`] method. Header name matching is case-insensitive.[`Data.Headers`]: /methods/resource/data/#headers
|
||||
: (`[]string`) The headers to extract from the server's response, accessible through the resource's [`Data.Headers`][] method. Header name matching is case-insensitive.
|
||||
|
||||
timeout
|
||||
: {{< new-in 0.157.0 />}}
|
||||
: (`string`) The duration after which the request is cancelled if it does not complete, expressed as a [duration](g). If not specified, the request will timeout after 2 minutes.
|
||||
|
||||
## Options examples
|
||||
|
||||
> [!note]
|
||||
> For brevity, the examples below do not include [error handling].
|
||||
> For brevity, the examples below do not include [error handling][].
|
||||
|
||||
To include a header:
|
||||
|
||||
@@ -110,7 +111,7 @@ To extract specific headers from the server's response:
|
||||
{{ $resource := resources.GetRemote $url $opts }}
|
||||
```
|
||||
|
||||
To set a per-request timeout (e.g. when fetching many feeds where a few slow ones should not stall the build):
|
||||
Use the `timeout` option to prevent slow external requests from stalling the build when fetching multiple remote feeds:
|
||||
|
||||
```go-html-template
|
||||
{{ $url := "https://example.org/feed.rss" }}
|
||||
@@ -126,9 +127,7 @@ To set a per-request timeout (e.g. when fetching many feeds where a few slow one
|
||||
|
||||
## Remote data
|
||||
|
||||
When retrieving remote data, use the [`transform.Unmarshal`] function to [unmarshal](g) the response.
|
||||
|
||||
[`transform.Unmarshal`]: /functions/transform/unmarshal/
|
||||
When retrieving remote data, use the [`transform.Unmarshal`][] function to [unmarshal](g) the response.
|
||||
|
||||
```go-html-template
|
||||
{{ $data := dict }}
|
||||
@@ -145,7 +144,7 @@ When retrieving remote data, use the [`transform.Unmarshal`] function to [unmars
|
||||
```
|
||||
|
||||
> [!note]
|
||||
> When retrieving remote data, a misconfigured server may send a response header with an incorrect [Content-Type]. For example, the server may set the Content-Type header to `application/octet-stream` instead of `application/json`.
|
||||
> When retrieving remote data, a misconfigured server may send a response header with an incorrect [Content-Type][]. For example, the server may set the Content-Type header to `application/octet-stream` instead of `application/json`.
|
||||
>
|
||||
> In these cases, pass the resource `Content` through the `transform.Unmarshal` function instead of passing the resource itself. For example, in the above, do this instead:
|
||||
>
|
||||
@@ -153,7 +152,7 @@ When retrieving remote data, use the [`transform.Unmarshal`] function to [unmars
|
||||
|
||||
## Error handling
|
||||
|
||||
Use the [`try`] statement to capture HTTP request errors. If you do not handle the error yourself, Hugo will fail the build.
|
||||
Use the [`try`][] statement to capture HTTP request errors. If you do not handle the error yourself, Hugo will fail the build.
|
||||
|
||||
> [!note]
|
||||
> Hugo does not classify an HTTP response with status code 404 as an error. In this case `resources.GetRemote` returns nil.
|
||||
@@ -188,13 +187,11 @@ To log an error as a warning instead of an error:
|
||||
|
||||
## HTTP response
|
||||
|
||||
The [`Data`] method on a resource returned by the `resources.GetRemote` function returns information from the HTTP response.
|
||||
|
||||
[`Data`]: /methods/resource/data/
|
||||
The [`Data`][] method on a resource returned by the `resources.GetRemote` function returns information from the HTTP response.
|
||||
|
||||
## Caching
|
||||
|
||||
Resources returned from `resources.GetRemote` are cached to disk. See [configure file caches] for details.
|
||||
Resources returned from `resources.GetRemote` are cached to disk. See [configure file caches][] for details.
|
||||
|
||||
By default, Hugo derives the cache key from the arguments passed to the function. Override the cache key by setting a `key` in the options map. Use this approach to have more control over how often Hugo fetches a remote resource.
|
||||
|
||||
@@ -209,11 +206,11 @@ By default, Hugo derives the cache key from the arguments passed to the function
|
||||
|
||||
To protect against malicious intent, the `resources.GetRemote` function inspects the server response including:
|
||||
|
||||
- The [Content-Type] in the response header
|
||||
- The [Content-Type][] in the response header
|
||||
- The file extension, if any
|
||||
- The content itself
|
||||
|
||||
If Hugo is unable to resolve the media type to an entry in its [allowlist], the function throws an error:
|
||||
If Hugo is unable to resolve the media type to an entry in its [allowlist][], the function throws an error:
|
||||
|
||||
```text
|
||||
ERROR error calling resources.GetRemote: failed to resolve media type...
|
||||
@@ -233,6 +230,9 @@ Note that the entry above is:
|
||||
- An _addition_ to the allowlist; it does not _replace_ the allowlist
|
||||
- An array of [regular expressions](g)
|
||||
|
||||
[`Data.Headers`]: /methods/resource/data/#headers
|
||||
[`Data`]: /methods/resource/data/
|
||||
[`transform.Unmarshal`]: /functions/transform/unmarshal/
|
||||
[`try`]: /functions/go-template/try
|
||||
[allowlist]: https://en.wikipedia.org/wiki/Whitelist
|
||||
[configure file caches]: /configuration/caches/
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
---
|
||||
title: resources.PostCSS
|
||||
description: Processes the given resource with PostCSS using any PostCSS plugin.
|
||||
categories: []
|
||||
keywords: []
|
||||
params:
|
||||
functions_and_methods:
|
||||
aliases: []
|
||||
returnType: resource.Resource
|
||||
signatures: ['resources.PostCSS [OPTIONS] RESOURCE']
|
||||
expiryDate: 2026-06-24 # deprecated 2024-06-24 in v0.128.0
|
||||
---
|
||||
|
||||
{{< deprecated-in 0.128.0 >}}
|
||||
Use [`css.PostCSS`] instead.
|
||||
|
||||
[`css.PostCSS`]: /functions/css/postcss/
|
||||
{{< /deprecated-in >}}
|
||||
@@ -25,7 +25,7 @@ Step 1
|
||||
: Install [Node.js].
|
||||
|
||||
Step 2
|
||||
: Install the required Node.js packages in the root of your project:
|
||||
: Install the required Node packages in the root of your project:
|
||||
|
||||
```sh {copy=true}
|
||||
npm i -D postcss postcss-cli autoprefixer @fullhuman/postcss-purgecss
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
---
|
||||
title: resources.ToCSS
|
||||
description: Transpiles Sass to CSS.
|
||||
categories: []
|
||||
keywords: []
|
||||
params:
|
||||
functions_and_methods:
|
||||
aliases: []
|
||||
returnType: resource.Resource
|
||||
signatures: ['resources.ToCSS [OPTIONS] RESOURCE']
|
||||
expiryDate: 2026-06-24 # deprecated 2024-06-24 in v0.128.0
|
||||
---
|
||||
|
||||
{{< deprecated-in 0.128.0 >}}
|
||||
Use [`css.Sass`] instead.
|
||||
|
||||
[`css.Sass`]: /functions/css/sass/
|
||||
{{< /deprecated-in >}}
|
||||
@@ -0,0 +1,111 @@
|
||||
---
|
||||
title: strings.ReplacePairs
|
||||
description: Returns a copy of a string with multiple replacements performed in a single pass, using a slice of old and new string pairs.
|
||||
categories: []
|
||||
keywords: []
|
||||
params:
|
||||
functions_and_methods:
|
||||
aliases: []
|
||||
returnType: string
|
||||
signatures: ['strings.ReplacePairs OLD NEW [OLD NEW ...] INPUT']
|
||||
---
|
||||
|
||||
{{< new-in 0.158.0 />}}
|
||||
|
||||
Use the `strings.ReplacePairs` function to perform multiple replacements on a string in a single operation. This approach is faster than sequentially calling the [`strings.Replace`][] function.
|
||||
|
||||
Replacing strings sequentially requires multiple function calls and variable re-assignments.
|
||||
|
||||
```go-html-template
|
||||
{{ $s := "aabbcc" }}
|
||||
{{ $s = strings.Replace $s "a" "x" }}
|
||||
{{ $s = strings.Replace $s "b" "y" }}
|
||||
{{ $s = strings.Replace $s "c" "z" }}
|
||||
{{ $s }} → xxyyzz
|
||||
```
|
||||
|
||||
Using `strings.ReplacePairs` produces the same result with fewer function calls in less time.
|
||||
|
||||
```go-html-template
|
||||
{{ "aabbcc" | strings.ReplacePairs "a" "x" "b" "y" "c" "z" }} → xxyyzz
|
||||
```
|
||||
|
||||
Pairs may also be passed as a single slice:
|
||||
|
||||
```go-html-template
|
||||
{{ $pairs := slice
|
||||
"a" "x"
|
||||
"b" "y"
|
||||
"c" "z"
|
||||
}}
|
||||
{{ "aabbcc" | strings.ReplacePairs $pairs }} → xxyyzz
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
Observe that replacements are not applied recursively because the function scans the string only once.
|
||||
|
||||
```go-html-template
|
||||
{{ $pairs := slice
|
||||
"a" "b"
|
||||
"b" "c"
|
||||
}}
|
||||
{{ "a" | strings.ReplacePairs $pairs }} → b
|
||||
```
|
||||
|
||||
Apply the first match when multiple old strings could match at the same position.
|
||||
|
||||
```go-html-template
|
||||
{{ $pairs := slice
|
||||
"app" "pear"
|
||||
"apple" "orange"
|
||||
}}
|
||||
{{ "apple" | strings.ReplacePairs $pairs }} → pearle
|
||||
```
|
||||
|
||||
Delete specific strings by providing an empty string as the second value in a pair.
|
||||
|
||||
```go-html-template
|
||||
{{ $pairs := slice "b" "" }}
|
||||
{{ "abc" | strings.ReplacePairs $pairs }} → ac
|
||||
```
|
||||
|
||||
## Edge cases
|
||||
|
||||
The table below outlines how the function handles various input scenarios.
|
||||
|
||||
Scenario|Result
|
||||
:--|:--
|
||||
Fewer than two arguments|Error
|
||||
Odd number of slice elements|Error
|
||||
Empty slice|Returns the input string
|
||||
Empty input string|Returns an empty string
|
||||
Empty old string|Returns the input string [interleaved](g) with the new string
|
||||
|
||||
## Performance
|
||||
|
||||
While `strings.Replace` and `strings.ReplacePairs` can produce the same results, they handle data differently. Choosing the right one can noticeably reduce the time Hugo takes to build your project.
|
||||
|
||||
### Single pass vs. multiple passes
|
||||
|
||||
When using `strings.Replace`, Hugo must scan the text from start to finish to find a match. If you chain three replacements together, Hugo performs three separate passes over the entire string.
|
||||
|
||||
The `strings.ReplacePairs` function is more efficient because it performs a single pass. Hugo looks through the text once and applies all replacements simultaneously.
|
||||
|
||||
### Caching
|
||||
|
||||
Unlike `strings.Replace`, which performs a direct substitution, `strings.ReplacePairs` requires an initialization step to prepare the single-pass replacement logic. To make this efficient, Hugo manages this logic using a cache:
|
||||
|
||||
- During the initial call, Hugo initializes and stores the logic for that specific set of pairs.
|
||||
- During subsequent calls, Hugo retrieves the stored logic, skipping the initialization step and reducing the duration of the call.
|
||||
|
||||
### Choosing the right function
|
||||
|
||||
The efficiency of `strings.ReplacePairs` increases as the text gets longer or the number of pairs grows. Consider these scenarios when deciding which function to use:
|
||||
|
||||
- For a single replacement on a short string like a title, `strings.Replace` is efficient.
|
||||
- For multiple replacements or long strings like a long-form article, `strings.ReplacePairs` is much faster.
|
||||
|
||||
For a document with about 8000 characters, which is roughly the length of a long-form article, `strings.ReplacePairs` outperforms five sequential `strings.Replace` calls during the initial call. Once cached, it is the faster choice for almost any situation with two or more pairs.
|
||||
|
||||
[`strings.Replace`]: /functions/strings/replace/
|
||||
@@ -11,8 +11,6 @@ params:
|
||||
aliases: [/functions/templates.defer]
|
||||
---
|
||||
|
||||
{{< new-in 0.128.0 />}}
|
||||
|
||||
> [!note]
|
||||
> This feature should only be used in the main template, typically `layouts/baseof.html`. Using it in _shortcode_, _partial_, or _render hook_ templates may lead to unpredictable results. For further details, please refer to [this issue].
|
||||
|
||||
@@ -83,15 +81,15 @@ data (`map`)
|
||||
: Optional map to pass as data to the deferred template. This will be available in the deferred template as `.` or `$`.
|
||||
|
||||
```go-html-template
|
||||
Language Outside: {{ site.Language.Lang }}
|
||||
Language Outside: {{ site.Language.Name }}
|
||||
Page Outside: {{ .RelPermalink }}
|
||||
I18n Outside: {{ i18n "hello" }}
|
||||
{{ $data := (dict "page" . )}}
|
||||
{{ with (templates.Defer (dict "data" $data )) }}
|
||||
Language Inside: {{ site.Language.Lang }}
|
||||
Language Inside: {{ site.Language.Name }}
|
||||
Page Inside: {{ .page.RelPermalink }}
|
||||
I18n Inside: {{ i18n "hello" }}
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
The [output format](/configuration/output-formats/), [site](/methods/page/site/), and [language](/methods/site/language) will be the same, even if the execution is deferred. In the example above, this means that the `site.Language.Lang` and `.RelPermalink` will be the same on the inside and the outside of the deferred template.
|
||||
The [output format](/configuration/output-formats/), [site](/methods/page/site/), and [language](/methods/site/language) will be the same, even if the execution is deferred. In the example above, this means that the `site.Language.Name` and `.RelPermalink` will be the same on the inside and the outside of the deferred template.
|
||||
|
||||
@@ -11,14 +11,14 @@ params:
|
||||
aliases: [/functions/htmlunescape]
|
||||
---
|
||||
|
||||
The `transform.HTMLUnescape` function replaces [HTML entities] with their corresponding characters.
|
||||
The `transform.HTMLUnescape` function replaces [HTML entities][] with their corresponding characters.
|
||||
|
||||
```go-html-template
|
||||
{{ htmlUnescape "Lilo & Stitch" }} → Lilo & Stitch
|
||||
{{ htmlUnescape "7 > 6" }} → 7 > 6
|
||||
```
|
||||
|
||||
In most contexts Go's [html/template] package will escape special characters. To bypass this behavior, pass the unescaped string through the [`safeHTML`] function.
|
||||
In most contexts Go's [`html/template`][] package will escape special characters. To bypass this behavior, pass the unescaped string through the [`safeHTML`][] function.
|
||||
|
||||
```go-html-template
|
||||
{{ htmlUnescape "Lilo & Stitch" | safeHTML }}
|
||||
@@ -26,4 +26,4 @@ In most contexts Go's [html/template] package will escape special characters. To
|
||||
|
||||
[`safehtml`]: /functions/safe/html/
|
||||
[html entities]: https://developer.mozilla.org/en-us/docs/glossary/entity
|
||||
[html/template]: https://pkg.go.dev/html/template
|
||||
[`html/template`]: https://pkg.go.dev/html/template
|
||||
|
||||
@@ -24,7 +24,7 @@ Example 1
|
||||
```go-html-template
|
||||
{{ $s := `
|
||||
baseURL = 'https://example.org/'
|
||||
languageCode = 'en-US'
|
||||
locale = 'en-US'
|
||||
title = 'ABC Widgets'
|
||||
`}}
|
||||
<pre>{{ transform.Remarshal "json" $s }}</pre>
|
||||
@@ -35,7 +35,7 @@ Resulting HTML:
|
||||
```html
|
||||
<pre>{
|
||||
"baseURL": "https://example.org/",
|
||||
"languageCode": "en-US",
|
||||
"locale": "en-US",
|
||||
"title": "ABC Widgets"
|
||||
}
|
||||
</pre>
|
||||
@@ -46,7 +46,7 @@ Rendered in browser:
|
||||
```text
|
||||
{
|
||||
"baseURL": "https://example.org/",
|
||||
"languageCode": "en-US",
|
||||
"locale": "en-US",
|
||||
"title": "ABC Widgets"
|
||||
}
|
||||
```
|
||||
|
||||
@@ -10,7 +10,7 @@ params:
|
||||
signatures: [transform.XMLEscape INPUT]
|
||||
---
|
||||
|
||||
The `transform.XMLEscape` function removes [disallowed characters] as defined in the XML specification, then escapes the result by replacing the following characters with [HTML entities]:
|
||||
The `transform.XMLEscape` function removes [disallowed characters][] as defined in the XML specification, then escapes the result by replacing the following characters with [HTML entities]:
|
||||
|
||||
- `"` → `"`
|
||||
- `'` → `'`
|
||||
@@ -27,7 +27,7 @@ For example:
|
||||
{{ transform.XMLEscape "<p>abc</p>" }} → <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:
|
||||
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:
|
||||
|
||||
```xml {file="layouts/rss.xml"}
|
||||
<description>{{ .Summary | transform.XMLEscape | safeHTML }}</description>
|
||||
@@ -35,4 +35,4 @@ When using `transform.XMLEscape` in a template rendered by Go's [html/template]
|
||||
|
||||
[disallowed characters]: https://www.w3.org/TR/xml/#charsets
|
||||
[html entities]: https://developer.mozilla.org/en-us/docs/glossary/entity
|
||||
[html/template]: https://pkg.go.dev/html/template
|
||||
[`html/template`]: https://pkg.go.dev/html/template
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: urls.PathEscape
|
||||
description: Returns the given string, replacing all percent-encoded sequences with the corresponding unescaped characters.
|
||||
description: Returns the given string, applying percent-encoding to special characters and reserved delimiters so it can be safely used as a segment within a URL path.
|
||||
categories: []
|
||||
keywords: []
|
||||
params:
|
||||
@@ -14,7 +14,9 @@ params:
|
||||
The `urls.PathEscape` function does the inverse transformation of [`urls.PathUnescape`][].
|
||||
|
||||
```go-html-template
|
||||
{{ urls.PathEscape "A/b/c?d=é&f=g+h" }} → A%2Fb%2Fc%3Fd=%C3%A9&f=g+h
|
||||
{{ urls.PathEscape "my café" }} → my%20caf%C3%A9
|
||||
```
|
||||
|
||||
Use this function to escape a string so that it can be safely used as an individual segment within a URL path.
|
||||
|
||||
[`urls.PathUnescape`]: /functions/urls/PathUnescape/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: urls.PathUnescape
|
||||
description: Returns the given string, applying percent-encoding to special characters and reserved delimiters so it can be safely used as a segment within a URL path.
|
||||
description: Returns the given string, replacing all percent-encoded sequences with the corresponding unescaped characters.
|
||||
categories: []
|
||||
keywords: []
|
||||
params:
|
||||
@@ -17,4 +17,6 @@ The `urls.PathUnescape` function does the inverse transformation of [`urls.PathE
|
||||
{{ urls.PathUnescape "A%2Fb%2Fc%3Fd=%C3%A9&f=g+h" }} → A/b/c?d=é&f=g+h
|
||||
```
|
||||
|
||||
Use this function to decode an individual segment within a URL path.
|
||||
|
||||
[`urls.PathEscape`]: /functions/urls/PathEscape/
|
||||
|
||||
@@ -108,9 +108,9 @@ static
|
||||
themes
|
||||
: The `themes` directory contains one or more [themes](g), each in its own subdirectory.
|
||||
|
||||
## Union file system
|
||||
## Unified file system
|
||||
|
||||
Hugo creates a union file system, allowing you to mount two or more directories to the same location. For example, let's say your home directory contains a Hugo project in one directory, and shared content in another:
|
||||
Hugo creates a [unified file system](g), allowing you to mount two or more directories to the same location. For example, let's say your home directory contains a Hugo project in one directory, and shared content in another:
|
||||
|
||||
```text
|
||||
home/
|
||||
@@ -145,11 +145,11 @@ target = 'content'
|
||||
{{< /code-toggle >}}
|
||||
|
||||
> [!note]
|
||||
> When you overlay one directory on top of another, you must mount both directories.
|
||||
> Defining a custom mount replaces the default mounting for that [component](g). To overlay an external directory on top of the project default, you must explicitly mount both.
|
||||
>
|
||||
> Hugo does not follow symbolic links. If you need the functionality provided by symbolic links, use Hugo's union file system instead.
|
||||
> Hugo does not follow symbolic links. If you need the functionality provided by symbolic links, use Hugo's unified file system instead.
|
||||
|
||||
After mounting, the union file system has this structure:
|
||||
After mounting, the unified file system has this structure:
|
||||
|
||||
```text
|
||||
home/
|
||||
@@ -170,8 +170,7 @@ home/
|
||||
└── hugo.toml
|
||||
```
|
||||
|
||||
> [!note]
|
||||
> When two or more files have the same path, the order of precedence follows the order of the mounts. For example, if the shared content directory contains `books/book-1.md`, it will be ignored because the project's `content` directory was mounted first.
|
||||
When two or more files share the same path, the version in the highest layer takes precedence. In the example above, if the `shared-content` directory contains `books/book-1.md`, it is ignored because the project's `content` directory is the first (highest) mount.
|
||||
|
||||
You can mount directories to `archetypes`, `assets`, `content`, `data`, `i18n`, `layouts`, and `static`. See [details](/configuration/module/#mounts).
|
||||
|
||||
@@ -199,6 +198,6 @@ my-theme/
|
||||
└── hugo.toml
|
||||
```
|
||||
|
||||
Using the union file system described above, Hugo mounts each of these directories to the corresponding location in the project. When two files have the same path, the file in the project directory takes precedence. This allows you, for example, to override a theme's template by placing a copy in the same location within the project directory.
|
||||
Using the unified file system described above, Hugo mounts each of these directories to the corresponding location in the project. When two files have the same path, the file in the project directory takes precedence. This allows you, for example, to override a theme's template by placing a copy in the same location within the project directory.
|
||||
|
||||
If you are simultaneously using components from two or more themes or modules, and there's a path collision, the first mount takes precedence.
|
||||
|
||||
@@ -152,7 +152,7 @@ With your editor, open your [project configuration][] file (`hugo.toml`) in the
|
||||
|
||||
```text
|
||||
baseURL = 'https://example.org/'
|
||||
languageCode = 'en-us'
|
||||
locale = 'en-us'
|
||||
title = 'My New Hugo Project'
|
||||
theme = 'ananke'
|
||||
```
|
||||
@@ -160,7 +160,7 @@ theme = 'ananke'
|
||||
Make the following changes:
|
||||
|
||||
1. Set the `baseURL` for your project. This value must begin with the protocol and end with a slash, as shown above.
|
||||
1. Set the `languageCode` to your locale.
|
||||
1. Set the `locale` to your locale.
|
||||
1. Set the `title` for your project.
|
||||
|
||||
Start Hugo's development server to see your changes, remembering to include draft content.
|
||||
|
||||
@@ -18,7 +18,7 @@ hugo version
|
||||
You should see something like:
|
||||
|
||||
```text
|
||||
hugo v0.155.3-8a858213b73907e823e2be2b5640a0ce4c04d295+extended linux/amd64 BuildDate=2026-02-08T16:40:42Z VendorInfo=gohugoio
|
||||
hugo v0.158.0-f41be7959a44108641f1e081adf5c4be7fc1bb63+extended linux/amd64 BuildDate=2026-03-16T17:42:04Z VendorInfo=gohugoio
|
||||
```
|
||||
|
||||
## Display available commands
|
||||
|
||||
@@ -18,7 +18,7 @@ Please complete the following tasks before continuing:
|
||||
1. [Log in](https://github.com/login) to your GitHub account
|
||||
1. [Create](https://github.com/new) a GitHub repository for your project
|
||||
1. [Create](https://git-scm.com/docs/git-init) a local Git repository for your project with a [remote](https://git-scm.com/docs/git-remote) reference to your GitHub repository
|
||||
1. Create a Hugo site within your local Git repository and test it with the `hugo server` command
|
||||
1. Create a Hugo project within your local Git repository and test it with the `hugo server` command
|
||||
1. Commit the changes to your local Git repository and push to your GitHub repository.
|
||||
|
||||
## Procedure
|
||||
@@ -40,9 +40,9 @@ Step 2
|
||||
env:
|
||||
variables:
|
||||
# Application versions
|
||||
DART_SASS_VERSION: 1.97.3
|
||||
GO_VERSION: 1.26.0
|
||||
HUGO_VERSION: 0.156.0
|
||||
DART_SASS_VERSION: 1.98.0
|
||||
GO_VERSION: 1.26.1
|
||||
HUGO_VERSION: 0.158.0
|
||||
# Time zone
|
||||
TZ: Europe/Oslo
|
||||
# Cache
|
||||
|
||||
@@ -17,7 +17,7 @@ Please complete the following tasks before continuing:
|
||||
1. [Log in](https://github.com/login) to your GitHub account
|
||||
1. [Create](https://github.com/new) a GitHub repository for your project
|
||||
1. [Create](https://git-scm.com/docs/git-init) a local Git repository for your project with a [remote](https://git-scm.com/docs/git-remote) reference to your GitHub repository
|
||||
1. Create a Hugo site within your local Git repository and test it with the `hugo server` command
|
||||
1. Create a Hugo project within your local Git repository and test it with the `hugo server` command
|
||||
|
||||
## Procedure
|
||||
|
||||
@@ -25,15 +25,15 @@ Step 1
|
||||
: Create a `wrangler.toml` file in the root of your project.
|
||||
|
||||
```toml {file="wrangler.toml" copy=true}
|
||||
name = "hosting-cloudflare-worker"
|
||||
compatibility_date = "2025-07-31"
|
||||
name = 'hosting-cloudflare-worker'
|
||||
compatibility_date = '2025-07-31'
|
||||
|
||||
[build]
|
||||
command = "chmod a+x build.sh && ./build.sh"
|
||||
command = 'chmod a+x build.sh && ./build.sh'
|
||||
|
||||
[assets]
|
||||
directory = "./public"
|
||||
not_found_handling = "404-page"
|
||||
directory = './public'
|
||||
not_found_handling = '404-page'
|
||||
```
|
||||
|
||||
Step 2
|
||||
@@ -51,10 +51,10 @@ Step 2
|
||||
|
||||
main() {
|
||||
|
||||
DART_SASS_VERSION=1.97.3
|
||||
GO_VERSION=1.26.0
|
||||
HUGO_VERSION=0.156.0
|
||||
NODE_VERSION=24.13.1
|
||||
DART_SASS_VERSION=1.98.0
|
||||
GO_VERSION=1.26.1
|
||||
HUGO_VERSION=0.158.0
|
||||
NODE_VERSION=24.14.0
|
||||
|
||||
export TZ=Europe/Oslo
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ Please complete the following tasks before continuing:
|
||||
1. [Log in](https://github.com/login) to your GitHub account
|
||||
1. [Create](https://github.com/new) a GitHub repository for your project
|
||||
1. [Create](https://git-scm.com/docs/git-init) a local Git repository for your project with a [remote](https://git-scm.com/docs/git-remote) reference to your GitHub repository
|
||||
1. Create a Hugo site within your local Git repository and test it with the `hugo server` command
|
||||
1. Create a Hugo project within your local Git repository and test it with the `hugo server` command
|
||||
1. Commit the changes to your local Git repository and push to your GitHub repository
|
||||
|
||||
## Procedure
|
||||
@@ -40,7 +40,7 @@ Step 2
|
||||
|
||||
{{< code-toggle file=hugo copy=true >}}
|
||||
[caches.images]
|
||||
dir = ":cacheDir/images"
|
||||
dir = ':cacheDir/images'
|
||||
{{< /code-toggle >}}
|
||||
|
||||
See [configure file caches] for more information.
|
||||
@@ -77,10 +77,10 @@ Step 4
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
DART_SASS_VERSION: 1.97.3
|
||||
GO_VERSION: 1.26.0
|
||||
HUGO_VERSION: 0.156.0
|
||||
NODE_VERSION: 24.13.1
|
||||
DART_SASS_VERSION: 1.98.0
|
||||
GO_VERSION: 1.26.1
|
||||
HUGO_VERSION: 0.158.0
|
||||
NODE_VERSION: 24.14.0
|
||||
TZ: Europe/Oslo
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -185,17 +185,6 @@ Step 8
|
||||
|
||||
In the future, whenever you push a change from your local Git repository, GitHub Pages will rebuild and deploy your site.
|
||||
|
||||
## Customize the workflow
|
||||
|
||||
The example workflow above includes this step, which typically takes 10‑15 seconds:
|
||||
|
||||
```yaml
|
||||
- name: Install Dart Sass
|
||||
run: sudo snap install dart-sass
|
||||
```
|
||||
|
||||
You may remove this step if your site, themes, and modules do not transpile Sass to CSS using the [Dart Sass] transpiler.
|
||||
|
||||
## Other resources
|
||||
|
||||
- [Learn more about GitHub Actions](https://docs.github.com/en/actions)
|
||||
@@ -204,5 +193,4 @@ You may remove this step if your site, themes, and modules do not transpile Sass
|
||||
|
||||
[`cacheDir`]: /configuration/all/#cachedir
|
||||
[configure file caches]: /configuration/caches/
|
||||
[Dart Sass]: /functions/css/sass/#dart-sass
|
||||
[GitHub Pages documentation]: https://docs.github.com/en/pages/getting-started-with-github-pages/about-github-pages#types-of-github-pages-sites
|
||||
|
||||
@@ -24,9 +24,9 @@ Define your [CI/CD](g) jobs by creating a `.gitlab-ci.yml` file in the root of y
|
||||
```yaml {file=".gitlab-ci.yml" copy=true}
|
||||
variables:
|
||||
# Application versions
|
||||
DART_SASS_VERSION: 1.97.3
|
||||
HUGO_VERSION: 0.156.0
|
||||
NODE_VERSION: 24.13.1
|
||||
DART_SASS_VERSION: 1.98.0
|
||||
HUGO_VERSION: 0.158.0
|
||||
NODE_VERSION: 24.14.0
|
||||
# Git
|
||||
GIT_DEPTH: 0
|
||||
GIT_STRATEGY: clone
|
||||
@@ -35,69 +35,70 @@ variables:
|
||||
TZ: Europe/Oslo
|
||||
|
||||
image:
|
||||
name: golang:1.26.0-bookworm
|
||||
name: golang:1.26.1-bookworm
|
||||
|
||||
pages:
|
||||
stage: deploy
|
||||
script:
|
||||
# Create directory for user-specific executable files
|
||||
- echo "Creating directory for user-specific executable files..."
|
||||
- mkdir -p "${HOME}/.local"
|
||||
- |
|
||||
# Create directory for user-specific executable files
|
||||
echo "Creating directory for user-specific executable files..."
|
||||
mkdir -p "${HOME}/.local"
|
||||
|
||||
# Install utilities
|
||||
- echo "Installing utilities..."
|
||||
- apt-get update
|
||||
- apt-get install -y brotli xz-utils zstd
|
||||
# Install utilities
|
||||
echo "Installing utilities..."
|
||||
apt-get update
|
||||
apt-get install -y brotli xz-utils zstd
|
||||
|
||||
# Install Dart Sass
|
||||
- echo "Installing Dart Sass ${DART_SASS_VERSION}..."
|
||||
- curl -sLJO "https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz"
|
||||
- tar -C "${HOME}/.local" -xf "dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz"
|
||||
- rm "dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz"
|
||||
- export PATH="${HOME}/.local/dart-sass:${PATH}"
|
||||
# Install Dart Sass
|
||||
echo "Installing Dart Sass ${DART_SASS_VERSION}..."
|
||||
curl -sLJO "https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz"
|
||||
tar -C "${HOME}/.local" -xf "dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz"
|
||||
rm "dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz"
|
||||
export PATH="${HOME}/.local/dart-sass:${PATH}"
|
||||
|
||||
# Install Hugo
|
||||
- echo "Installing Hugo ${HUGO_VERSION}..."
|
||||
- curl -sLJO "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
|
||||
- mkdir "${HOME}/.local/hugo"
|
||||
- tar -C "${HOME}/.local/hugo" -xf "hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
|
||||
- rm "hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
|
||||
- export PATH="${HOME}/.local/hugo:${PATH}"
|
||||
# Install Hugo
|
||||
echo "Installing Hugo ${HUGO_VERSION}..."
|
||||
curl -sLJO "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_linux-amd64.tar.gz"
|
||||
mkdir -p "${HOME}/.local/hugo"
|
||||
tar -C "${HOME}/.local/hugo" -xf "hugo_${HUGO_VERSION}_linux-amd64.tar.gz"
|
||||
rm "hugo_${HUGO_VERSION}_linux-amd64.tar.gz"
|
||||
export PATH="${HOME}/.local/hugo:${PATH}"
|
||||
|
||||
# Install Node.js
|
||||
- echo "Installing Node.js ${NODE_VERSION}..."
|
||||
- curl -sLJO "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.xz"
|
||||
- tar -C "${HOME}/.local" -xf "node-v${NODE_VERSION}-linux-x64.tar.xz"
|
||||
- rm "node-v${NODE_VERSION}-linux-x64.tar.xz"
|
||||
- export PATH="${HOME}/.local/node-v${NODE_VERSION}-linux-x64/bin:${PATH}"
|
||||
# Install Node.js
|
||||
echo "Installing Node.js ${NODE_VERSION}..."
|
||||
curl -sLJO "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.xz"
|
||||
tar -C "${HOME}/.local" -xf "node-v${NODE_VERSION}-linux-x64.tar.xz"
|
||||
rm "node-v${NODE_VERSION}-linux-x64.tar.xz"
|
||||
export PATH="${HOME}/.local/node-v${NODE_VERSION}-linux-x64/bin:${PATH}"
|
||||
|
||||
# Verify installations
|
||||
- echo "Verifying installations..."
|
||||
- "echo Dart Sass: $(sass --version)"
|
||||
- "echo Go: $(go version)"
|
||||
- "echo Hugo: $(hugo version)"
|
||||
- "echo Node.js: $(node --version)"
|
||||
- "echo brotli: $(brotli --version)"
|
||||
- "echo xz: $(xz --version)"
|
||||
- "echo zstd: $(zstd --version)"
|
||||
# Verify installations
|
||||
echo "Verifying installations..."
|
||||
echo "Dart Sass: $(sass --version)"
|
||||
echo "Go: $(go version)"
|
||||
echo "Hugo: $(hugo version)"
|
||||
echo "Node.js: $(node --version)"
|
||||
echo "brotli: $(brotli --version)"
|
||||
echo "xz: $(xz --version)"
|
||||
echo "zstd: $(zstd --version)"
|
||||
|
||||
# Install Node.js dependencies
|
||||
- echo "Installing Node.js dependencies..."
|
||||
- "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci --prefer-offline || true"
|
||||
# Install Node.js dependencies
|
||||
echo "Installing Node.js dependencies..."
|
||||
[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci --prefer-offline || true
|
||||
|
||||
# Configure Git
|
||||
- echo "Configuring Git..."
|
||||
- git config core.quotepath false
|
||||
# Configure Git
|
||||
echo "Configuring Git..."
|
||||
git config core.quotepath false
|
||||
|
||||
# Build site
|
||||
- echo "Building site..."
|
||||
- hugo build --gc --minify --baseURL "${CI_PAGES_URL}"
|
||||
# Build site
|
||||
echo "Building site..."
|
||||
hugo --gc --minify --baseURL "${CI_PAGES_URL}"
|
||||
|
||||
# Compress published files
|
||||
- echo "Compressing published files..."
|
||||
- find public/ -type f -regextype posix-extended -regex '.+\.(css|html|js|json|mjs|svg|txt|xml)$' -print0 > files.txt
|
||||
- time xargs --null --max-procs=0 --max-args=1 brotli --quality=10 --force --keep < files.txt
|
||||
- time xargs --null --max-procs=0 --max-args=1 gzip -9 --force --keep < files.txt
|
||||
# Compress published files
|
||||
echo "Compressing published files..."
|
||||
find public/ -type f -regextype posix-extended -regex '.+\.(css|html|js|json|mjs|svg|txt|xml)$' -print0 > files.txt
|
||||
time xargs --null --max-procs=0 --max-args=1 brotli --quality=10 --force --keep < files.txt
|
||||
time xargs --null --max-procs=0 --max-args=1 gzip -9 --force --keep < files.txt
|
||||
artifacts:
|
||||
paths:
|
||||
- public
|
||||
|
||||
@@ -18,7 +18,7 @@ Please complete the following tasks before continuing:
|
||||
1. [Log in](https://github.com/login) to your GitHub account
|
||||
1. [Create](https://github.com/new) a GitHub repository for your project
|
||||
1. [Create](https://git-scm.com/docs/git-init) a local Git repository for your project with a [remote](https://git-scm.com/docs/git-remote) reference to your GitHub repository
|
||||
1. Create a Hugo site within your local Git repository and test it with the `hugo server` command
|
||||
1. Create a Hugo project within your local Git repository and test it with the `hugo server` command
|
||||
1. Commit the changes to your local Git repository and push to your GitHub repository.
|
||||
|
||||
## Procedure
|
||||
@@ -30,10 +30,10 @@ Step 1
|
||||
|
||||
```text {file="netlify.toml" copy=true}
|
||||
[build.environment]
|
||||
DART_SASS_VERSION = "1.97.3"
|
||||
GO_VERSION = "1.26.0"
|
||||
HUGO_VERSION = "0.156.0"
|
||||
NODE_VERSION = "24.13.1"
|
||||
DART_SASS_VERSION = "1.98.0"
|
||||
GO_VERSION = "1.26.1"
|
||||
HUGO_VERSION = "0.158.0"
|
||||
NODE_VERSION = "24.14.0"
|
||||
TZ = "Europe/Oslo"
|
||||
|
||||
[build]
|
||||
@@ -48,10 +48,10 @@ Step 1
|
||||
|
||||
```text {file="netlify.toml" copy=true}
|
||||
[build.environment]
|
||||
DART_SASS_VERSION = "1.97.3"
|
||||
GO_VERSION = "1.26.0"
|
||||
HUGO_VERSION = "0.156.0"
|
||||
NODE_VERSION = "24.13.1"
|
||||
DART_SASS_VERSION = "1.98.0"
|
||||
GO_VERSION = "1.26.1"
|
||||
HUGO_VERSION = "0.158.0"
|
||||
NODE_VERSION = "24.14.0"
|
||||
TZ = "Europe/Oslo"
|
||||
|
||||
[build]
|
||||
|
||||
@@ -18,7 +18,7 @@ Please complete the following tasks before continuing:
|
||||
1. [Log in](https://github.com/login) to your GitHub account
|
||||
1. [Create](https://github.com/new) a GitHub repository for your project
|
||||
1. [Create](https://git-scm.com/docs/git-init) a local Git repository for your project with a [remote](https://git-scm.com/docs/git-remote) reference to your GitHub repository
|
||||
1. Create a Hugo site within your local Git repository and test it with the `hugo server` command
|
||||
1. Create a Hugo project within your local Git repository and test it with the `hugo server` command
|
||||
|
||||
## Procedure
|
||||
|
||||
@@ -35,13 +35,13 @@ Step 1
|
||||
staticPublishPath: public
|
||||
envVars:
|
||||
- key: DART_SASS_VERSION
|
||||
value: 1.97.3
|
||||
value: 1.98.0
|
||||
- key: GO_VERSION
|
||||
value: 1.26.0
|
||||
value: 1.26.1
|
||||
- key: HUGO_VERSION
|
||||
value: 0.156.0
|
||||
value: 0.158.0
|
||||
- key: NODE_VERSION
|
||||
value: 24.13.1
|
||||
value: 24.14.0
|
||||
- key: TZ
|
||||
value: Europe/Oslo
|
||||
```
|
||||
|
||||
@@ -84,7 +84,7 @@ environment:
|
||||
site: <YourUsername>.srht.site
|
||||
tasks:
|
||||
- package: |
|
||||
DART_SASS_VERSION=1.97.1 # Latest version as of 20/12/2025
|
||||
DART_SASS_VERSION=1.98.0
|
||||
mkdir -p $HOME/.local
|
||||
curl -L https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64-musl.tar.gz -o dart-sass.tar.gz
|
||||
tar -xzf dart-sass.tar.gz -C $HOME/.local
|
||||
|
||||
@@ -17,7 +17,7 @@ Please complete the following tasks before continuing:
|
||||
1. [Log in](https://github.com/login) to your GitHub account
|
||||
1. [Create](https://github.com/new) a GitHub repository for your project
|
||||
1. [Create](https://git-scm.com/docs/git-init) a local Git repository for your project with a [remote](https://git-scm.com/docs/git-remote) reference to your GitHub repository
|
||||
1. Create a Hugo site within your local Git repository and test it with the `hugo server` command
|
||||
1. Create a Hugo project within your local Git repository and test it with the `hugo server` command
|
||||
|
||||
## Procedure
|
||||
|
||||
@@ -47,10 +47,10 @@ Step 2
|
||||
|
||||
main() {
|
||||
|
||||
DART_SASS_VERSION=1.97.3
|
||||
GO_VERSION=1.26.0
|
||||
HUGO_VERSION=0.156.0
|
||||
NODE_VERSION=24.13.1
|
||||
DART_SASS_VERSION=1.98.0
|
||||
GO_VERSION=1.26.1
|
||||
HUGO_VERSION=0.158.0
|
||||
NODE_VERSION=24.14.0
|
||||
|
||||
export TZ=Europe/Oslo
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ Workspaces simplify local development of sites with modules. Create a `.work` fi
|
||||
A `.work` file example:
|
||||
|
||||
```text
|
||||
go 1.24
|
||||
go 1.25
|
||||
|
||||
use .
|
||||
use ../my-hugo-module
|
||||
|
||||
@@ -25,7 +25,7 @@ pageRef = '/contact'
|
||||
weight = 20
|
||||
{{< /code-toggle >}}
|
||||
|
||||
This example uses the `Identifier` method when querying the translation table on a multilingual site, falling back the `name` property if a matching key in the translation table does not exist:
|
||||
This example uses the `Identifier` method when querying the translation table on a multilingual project, falling back the `name` property if a matching key in the translation table does not exist:
|
||||
|
||||
```go-html-template
|
||||
<ul>
|
||||
|
||||
@@ -24,7 +24,7 @@ pageRef = '/contact'
|
||||
weight = 20
|
||||
{{< /code-toggle >}}
|
||||
|
||||
This example uses the `KeyName` method when querying the translation table on a multilingual site, falling back the `name` property if a matching key in the translation table does not exist:
|
||||
This example uses the `KeyName` method when querying the translation table on a multilingual project, falling back the `name` property if a matching key in the translation table does not exist:
|
||||
|
||||
```go-html-template
|
||||
<ul>
|
||||
|
||||
@@ -67,16 +67,16 @@ defaultContentLanguage = 'en'
|
||||
defaultContentLanguageInSubdir = true
|
||||
|
||||
[languages.en]
|
||||
languageCode = 'en-US'
|
||||
languageDirection = 'ltr'
|
||||
languageName = 'English'
|
||||
locale = 'en-US'
|
||||
direction = 'ltr'
|
||||
name = 'English'
|
||||
weight = 1
|
||||
title = 'My Site in English'
|
||||
|
||||
[languages.de]
|
||||
languageCode = 'de-DE'
|
||||
languageDirection = 'ltr'
|
||||
languageName = 'Deutsch'
|
||||
locale = 'de-DE'
|
||||
direction = 'ltr'
|
||||
name = 'Deutsch'
|
||||
weight = 2
|
||||
title = 'My Site in German'
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: AllTranslations
|
||||
description: Returns all translations of the given page, including the current language, sorted by language weight.
|
||||
description: Returns all translations of the given page, including the current language, sorted by language weight then language name.
|
||||
categories: []
|
||||
keywords: []
|
||||
params:
|
||||
@@ -16,20 +16,20 @@ defaultContentLanguage = 'en'
|
||||
|
||||
[languages.en]
|
||||
contentDir = 'content/en'
|
||||
languageCode = 'en-US'
|
||||
languageName = 'English'
|
||||
label = 'English'
|
||||
locale = 'en-US'
|
||||
weight = 1
|
||||
|
||||
[languages.de]
|
||||
contentDir = 'content/de'
|
||||
languageCode = 'de-DE'
|
||||
languageName = 'Deutsch'
|
||||
label = 'Deutsch'
|
||||
locale = 'de-DE'
|
||||
weight = 2
|
||||
|
||||
[languages.fr]
|
||||
contentDir = 'content/fr'
|
||||
languageCode = 'fr-FR'
|
||||
languageName = 'Français'
|
||||
label = 'Français'
|
||||
locale = 'fr-FR'
|
||||
weight = 3
|
||||
{{< /code-toggle >}}
|
||||
|
||||
@@ -61,7 +61,7 @@ And this template:
|
||||
<ul>
|
||||
{{ range . }}
|
||||
<li>
|
||||
<a href="{{ .RelPermalink }}" hreflang="{{ .Language.LanguageCode }}">{{ .LinkTitle }} ({{ or .Language.LanguageName .Language.Lang }})</a>
|
||||
<a href="{{ .RelPermalink }}" hreflang="{{ .Language.Locale }}">{{ .LinkTitle }} ({{ or .Language.Label .Language.Name }})</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: GitInfo
|
||||
description: Returns Git information related to the last commit of the given page.
|
||||
description: Provides access to commit metadata for a given page.
|
||||
categories: []
|
||||
keywords: []
|
||||
params:
|
||||
@@ -9,47 +9,55 @@ params:
|
||||
signatures: [PAGE.GitInfo]
|
||||
---
|
||||
|
||||
The `GitInfo` method on a `Page` object returns an object with additional methods.
|
||||
The `GitInfo` method on a `Page` object provides access to commit metadata from your Git history, such as the author's name, the commit hash, and the commit message.
|
||||
|
||||
> [!note]
|
||||
> Hugo's Git integration is performant, but may increase build times on large sites.
|
||||
> Hugo's Git integration is performant, but may increase build times for large projects.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Install Git, create a repository, and commit your project files.
|
||||
|
||||
You must also allow Hugo to access your repository. In your project configuration:
|
||||
You must also allow Hugo to access your repository by adding this to your project configuration:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
enableGitInfo = true
|
||||
{{< /code-toggle >}}
|
||||
|
||||
Alternatively, use the command line flag when building your project:
|
||||
|
||||
```sh
|
||||
hugo build --enableGitInfo
|
||||
```
|
||||
|
||||
> [!note]
|
||||
> 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.
|
||||
> When you set [`enableGitInfo`][] to `true`, the last modification date for each content page will automatically be the Author Date of the last commit for that file.
|
||||
>
|
||||
> This is configurable. See [details].
|
||||
> This is configurable. See [details][].
|
||||
|
||||
## Scope
|
||||
|
||||
Commit metadata is available for content stored in your local repository and for content provided by [modules](g).
|
||||
|
||||
### Local content
|
||||
|
||||
Hugo retrieves commit metadata for files tracked within your project's local repository. This includes all content files managed by Git in your main project directory.
|
||||
|
||||
### Module content
|
||||
|
||||
{{< new-in 0.157.0 />}}
|
||||
|
||||
Hugo also retrieves commit metadata for content provided by modules. This allows you to display commit data for remote repositories that are mounted as content directories, such as when aggregating documentation from multiple sources.
|
||||
|
||||
## Methods
|
||||
|
||||
### AbbreviatedHash
|
||||
|
||||
(`string`) The abbreviated commit hash.
|
||||
(`string`) Returns the seven-character shortened version of the commit hash.
|
||||
|
||||
```go-html-template
|
||||
{{ with .GitInfo }}
|
||||
{{ .AbbreviatedHash }} → aab9ec0b3
|
||||
{{ .AbbreviatedHash }} → aab9ec0
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
### AuthorDate
|
||||
|
||||
(`time.Time`) The author date.
|
||||
(`time.Time`) Returns the date the author originally created the commit.
|
||||
|
||||
```go-html-template
|
||||
{{ with .GitInfo }}
|
||||
@@ -59,7 +67,7 @@ hugo build --enableGitInfo
|
||||
|
||||
### AuthorEmail
|
||||
|
||||
(`string`) The author's email address, respecting [gitmailmap].
|
||||
(`string`) Returns the author's email address, respecting [gitmailmap][].
|
||||
|
||||
```go-html-template
|
||||
{{ with .GitInfo }}
|
||||
@@ -69,7 +77,7 @@ hugo build --enableGitInfo
|
||||
|
||||
### AuthorName
|
||||
|
||||
(`string`) The author's name, respecting [gitmailmap].
|
||||
(`string`) Returns the author's name, respecting [gitmailmap][].
|
||||
|
||||
```go-html-template
|
||||
{{ with .GitInfo }}
|
||||
@@ -79,7 +87,7 @@ hugo build --enableGitInfo
|
||||
|
||||
### CommitDate
|
||||
|
||||
(`time.Time`) The commit date.
|
||||
(`time.Time`) Returns the date the commit was applied to the branch.
|
||||
|
||||
```go-html-template
|
||||
{{ with .GitInfo }}
|
||||
@@ -89,7 +97,7 @@ hugo build --enableGitInfo
|
||||
|
||||
### Hash
|
||||
|
||||
(`string`) The commit hash.
|
||||
(`string`) Returns the full SHA-1 commit hash.
|
||||
|
||||
```go-html-template
|
||||
{{ with .GitInfo }}
|
||||
@@ -99,7 +107,7 @@ hugo build --enableGitInfo
|
||||
|
||||
### Subject
|
||||
|
||||
(`string`) The commit message subject.
|
||||
(`string`) Returns the first line of the commit message (the summary).
|
||||
|
||||
```go-html-template
|
||||
{{ with .GitInfo }}
|
||||
@@ -109,17 +117,17 @@ hugo build --enableGitInfo
|
||||
|
||||
### Body
|
||||
|
||||
(`string`) The commit message body.
|
||||
(`string`) Returns the full content of the commit message, excluding the subject line.
|
||||
|
||||
```go-html-template
|
||||
{{ with .GitInfo }}
|
||||
{{ .Body }} → - Two new pages added.
|
||||
{{ .Body }} → Two new pages added.
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
### Ancestors
|
||||
|
||||
(`gitmap.GitInfos`) A slice of file-filtered ancestor commits, if any, ordered from most recent to least recent.
|
||||
(`gitmap.GitInfos`) Returns a list of previous commits for this specific file, ordered from most recent to oldest.
|
||||
|
||||
For example, to list the last 5 commits:
|
||||
|
||||
@@ -143,13 +151,13 @@ To reverse the order:
|
||||
|
||||
### Parent
|
||||
|
||||
(`*gitmap.GitInfo`) The first file-filtered ancestor commit, if any.
|
||||
(`*gitmap.GitInfo`) Returns the most recent ancestor commit for the file, if any.
|
||||
|
||||
## Last modified date
|
||||
|
||||
By default, when `enableGitInfo` is `true`, the `Lastmod` method on a `Page` object returns the Git AuthorDate of the last commit that included the file.
|
||||
|
||||
You can change this behavior in your [project configuration].
|
||||
You can change this behavior in your [project configuration][].
|
||||
|
||||
## Hosting considerations
|
||||
|
||||
@@ -180,6 +188,7 @@ Vercel|Shallow|Yes [^1]
|
||||
|
||||
[^3]: To perform a deep clone when hosting on GitLab Pages, set the `GIT_DEPTH` environment variable to `0` in the workflow file. See [example](/host-and-deploy/host-on-gitlab-pages/#configure-gitlab-cicd).
|
||||
|
||||
[`enableGitInfo`]: /configuration/all/#enablegitinfo
|
||||
[details]: /configuration/front-matter/#dates
|
||||
[gitmailmap]: https://git-scm.com/docs/gitmailmap
|
||||
[project configuration]: /configuration/front-matter/
|
||||
|
||||
@@ -16,14 +16,14 @@ defaultContentLanguage = 'en'
|
||||
|
||||
[languages.en]
|
||||
contentDir = 'content/en'
|
||||
languageCode = 'en-US'
|
||||
languageName = 'English'
|
||||
label = 'English'
|
||||
locale = 'en-US'
|
||||
weight = 1
|
||||
|
||||
[languages.de]
|
||||
contentDir = 'content/de'
|
||||
languageCode = 'de-DE'
|
||||
languageName = 'Deutsch'
|
||||
label = 'Deutsch'
|
||||
locale = 'de-DE'
|
||||
weight = 2
|
||||
{{< /code-toggle >}}
|
||||
|
||||
|
||||
@@ -15,16 +15,26 @@ You can also use the `Language` method on a `Site` object. See [details][].
|
||||
|
||||
## Methods
|
||||
|
||||
The examples below assume the following in your project configuration:
|
||||
The examples below assume the following language definition.
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[languages.de]
|
||||
languageCode = 'de-DE'
|
||||
languageDirection = 'ltr'
|
||||
languageName = 'Deutsch'
|
||||
direction = 'ltr'
|
||||
label = 'Deutsch'
|
||||
locale = 'de-DE'
|
||||
weight = 2
|
||||
{{< /code-toggle >}}
|
||||
|
||||
### Direction
|
||||
|
||||
{{< new-in 0.158.0 />}}
|
||||
|
||||
(`string`) Returns the [`direction`][] from the language definition.
|
||||
|
||||
```go-html-template
|
||||
{{ .Language.Direction }} → ltr
|
||||
```
|
||||
|
||||
### IsDefault
|
||||
|
||||
{{< new-in 0.153.0 />}}
|
||||
@@ -35,43 +45,55 @@ weight = 2
|
||||
{{ .Language.IsDefault }} → true
|
||||
```
|
||||
|
||||
### Lang
|
||||
### Label
|
||||
|
||||
(`string`) Returns the language tag as defined by [RFC 5646][]. This is the lowercased key from your project configuration.
|
||||
{{< new-in 0.158.0 />}}
|
||||
|
||||
(`string`) Returns the [`label`][] from the language definition.
|
||||
|
||||
```go-html-template
|
||||
{{ .Language.Lang }} → de
|
||||
{{ .Language.Label }} → Deutsch
|
||||
```
|
||||
|
||||
### Lang
|
||||
|
||||
{{<deprecated-in 0.158.0 />}}
|
||||
|
||||
Use [`Name`](#name) instead.
|
||||
|
||||
### LanguageCode
|
||||
|
||||
(`string`) Returns the [`languageCode`][] from your project configuration. Falls back to `Lang` if not defined.
|
||||
{{<deprecated-in 0.158.0 />}}
|
||||
|
||||
```go-html-template
|
||||
{{ .Language.LanguageCode }} → de-DE
|
||||
```
|
||||
Use [`Locale`](#locale) instead.
|
||||
|
||||
### LanguageDirection
|
||||
|
||||
(`string`) Returns the [`languageDirection`][] from your project configuration.
|
||||
{{<deprecated-in 0.158.0 />}}
|
||||
|
||||
```go-html-template
|
||||
{{ .Language.LanguageDirection }} → ltr
|
||||
```
|
||||
Use [`Direction`](#direction) instead.
|
||||
|
||||
### LanguageName
|
||||
|
||||
(`string`) Returns the [`languageName`][] from your project configuration.
|
||||
{{<deprecated-in 0.158.0 />}}
|
||||
|
||||
Use [`Label`](#label) instead.
|
||||
|
||||
### Locale
|
||||
|
||||
{{< new-in 0.158.0 />}}
|
||||
|
||||
(`string`) Returns the [`locale`][] from the language definition, falling back to [`Name`](#name).
|
||||
|
||||
```go-html-template
|
||||
{{ .Language.LanguageName }} → Deutsch
|
||||
{{ .Language.Locale }} → de-DE
|
||||
```
|
||||
|
||||
### Name
|
||||
|
||||
{{< new-in 0.153.0 />}}
|
||||
|
||||
(`string`) Returns the language tag as defined by [RFC 5646][]. This is the lowercased key from your project configuration. This is an alias for `Lang`.
|
||||
(`string`) Returns the language tag as defined by [RFC 5646][]. This is the lowercased key from the language definition.
|
||||
|
||||
```go-html-template
|
||||
{{ .Language.Name }} → de
|
||||
@@ -79,16 +101,35 @@ weight = 2
|
||||
|
||||
### Weight
|
||||
|
||||
(`int`) Returns the language [`weight`][] from your project configuration.
|
||||
{{<deprecated-in 0.158.0 />}}
|
||||
|
||||
```go-html-template
|
||||
{{ .Language.Weight }} → 2
|
||||
```
|
||||
|
||||
[`languageCode`]: /configuration/languages/#languagecode
|
||||
[`languageDirection`]: /configuration/languages/#languagedirection
|
||||
[`languageName`]: /configuration/languages/#languagename
|
||||
[`weight`]: /configuration/languages/#weight
|
||||
[default language]: /quick-reference/glossary/#default-language
|
||||
[details]: /methods/page/language/
|
||||
[RFC 5646]: https://datatracker.ietf.org/doc/html/rfc5646
|
||||
[`direction`]: /configuration/languages/#direction
|
||||
[`label`]: /configuration/languages/#label
|
||||
[`locale`]: /configuration/languages/#locale
|
||||
[default language]: /quick-reference/glossary/#default-language
|
||||
[details]: /methods/site/language/
|
||||
|
||||
## Example
|
||||
|
||||
Use the code below to create a language selector, allowing users to navigate between the different translated versions of the current page.
|
||||
|
||||
```go-html-template {file="layouts/_partials/language-selector.html" copy=true}
|
||||
{{ with .Rotate "language" }}
|
||||
<nav class="language-selector">
|
||||
<ul>
|
||||
{{ range . }}
|
||||
{{ if eq .Language $.Language }}
|
||||
<li class="active">
|
||||
<a aria-current="page" href="{{ .Permalink }}" hreflang="{{ .Language.Locale }}">{{ .Language.Label }}</a>
|
||||
</li>
|
||||
{{ else }}
|
||||
<li>
|
||||
<a href="{{ .Permalink }}" hreflang="{{ .Language.Locale }}">{{ .Language.Label }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
</nav>
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
@@ -26,7 +26,7 @@ The value returned by the `Path` method on a `Page` object is independent of con
|
||||
|
||||
## Examples
|
||||
|
||||
### Monolingual site
|
||||
### Monolingual project
|
||||
|
||||
Note that the logical path is independent of content format and URL modifiers.
|
||||
|
||||
|
||||
@@ -9,15 +9,15 @@ params:
|
||||
signatures: [PAGE.Plain]
|
||||
---
|
||||
|
||||
The `Plain` method on a `Page` object renders Markdown and [shortcodes](g) to HTML, then strips the HTML [tags]. It does not strip HTML [entities].
|
||||
The `Plain` method on a `Page` object renders Markdown and [shortcodes](g) to HTML, then strips the HTML [tags][]. It does not strip HTML [entities][].
|
||||
|
||||
To prevent Go's [html/template] package from escaping HTML entities, pass the result through the [`htmlUnescape`] function.
|
||||
To prevent Go's [`html/template`][] package from escaping HTML entities, pass the result through the [`htmlUnescape`][] function.
|
||||
|
||||
```go-html-template
|
||||
{{ .Plain | htmlUnescape }}
|
||||
```
|
||||
|
||||
[html/template]: https://pkg.go.dev/html/template
|
||||
[`html/template`]: https://pkg.go.dev/html/template
|
||||
[entities]: https://developer.mozilla.org/en-US/docs/Glossary/Entity
|
||||
[tags]: https://developer.mozilla.org/en-US/docs/Glossary/Tag
|
||||
[`htmlUnescape`]: /functions/transform/htmlunescape/
|
||||
|
||||
@@ -17,21 +17,21 @@ By default, Hugo assumes a reading speed of 212 words per minute. For CJK langua
|
||||
{{ printf "Estimated reading time: %d minutes" .ReadingTime }}
|
||||
```
|
||||
|
||||
Reading speed varies by language. Create language-specific estimated reading times on your multilingual site using site parameters.
|
||||
Reading speed varies by language. Create language-specific estimated reading times on your multilingual project using site parameters.
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[languages]
|
||||
[languages.de]
|
||||
contentDir = 'content/de'
|
||||
languageCode = 'de-DE'
|
||||
languageName = 'Deutsch'
|
||||
label = 'Deutsch'
|
||||
locale = 'de-DE'
|
||||
weight = 2
|
||||
[languages.de.params]
|
||||
reading_speed = 179
|
||||
[languages.en]
|
||||
contentDir = 'content/en'
|
||||
languageCode = 'en-US'
|
||||
languageName = 'English'
|
||||
label = 'English'
|
||||
locale = 'en-US'
|
||||
weight = 1
|
||||
[languages.en.params]
|
||||
reading_speed = 228
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Sitemap
|
||||
description: Returns the sitemap settings for the given page as defined in front matter, falling back to the sitemap settings as defined in the site configuration.
|
||||
description: Returns the sitemap settings for the given page as defined in front matter, falling back to the sitemap settings as defined in your project configuration.
|
||||
categories: []
|
||||
keywords: []
|
||||
params:
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user