From b3d87dd0fd746f07f9afa6e6a2969aea41da6a38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Thu, 24 Apr 2025 10:23:16 +0200 Subject: [PATCH] Squashed 'docs/' changes from dc7a9ae12..b654fcba0 b654fcba0 content: Fix links d44357418 content: Update GitLab Pages workflow example 33968c7e2 content: Update Netlify configuration file a6d0c8c50 content: Update GitHub Pages workflow example d1aabfa36 content: Fix broken link 7b50139a6 content: Miscellaneous edits a30e2c189 Menus: add forgotten link target 5c2aa88b4 content: Updates for v0.146.7 114413c18 netlify: Hugo 0.146.7 67e9261b1 netlify: Hugo 0.146.6 efa040229 content: Update templates/embedded.md b8f888c76 theme: Rename internal templates from partials/ to _partials/ 727178cbb content: Fix broken anchor links 0f12708f1 Fix typo 380b1c163 Update Current.md 8b500f3e5 netlify: Hugo 0.146.5 e3d6b6fad netlify: Hugo 0.146.4 ac1b92713 content: Fix text formatting in templates/partial.md 719329530 content: Clarify usage of template function a95eca524 theme: Misc adjustments for the themes site 8e6c26067 Add package.hugo.json 9691007fb netlify: Hugo 0.146.3 ec08acc59 netlify: Hugo 0.146.2 8f320a0b6 netlify: Hugo 0.146.1 d5e6cb618 content: Remove expired new-in badges b5779d7fc content: Update templates.Current function 5df1229d5 theme: Move templates to new structure a7a6a614d theme: Remove accidentally added template 195b368e8 content: Miscellaneous updates related to v0.146.0 0a906ad49 netlify: Hugo 0.146.0 git-subtree-dir: docs git-subtree-split: b654fcba0d4385da1e47179ef3763f277f044242 --- content/en/configuration/introduction.md | 2 +- content/en/content-management/menus.md | 2 +- content/en/contribute/documentation.md | 2 +- content/en/functions/collections/Where.md | 3 - content/en/functions/css/Sass.md | 148 +++++++---------- content/en/functions/go-template/template.md | 28 +++- content/en/functions/templates/Current.md | 155 ++++++++++++++++++ content/en/functions/time/In.md | 30 ++++ content/en/functions/transform/Unmarshal.md | 85 +++++++++- .../host-on-github-pages/index.md | 2 + .../host-and-deploy/host-on-gitlab-pages.md | 10 +- .../host-and-deploy/host-on-netlify/index.md | 11 +- content/en/installation/linux.md | 20 ++- content/en/news/_content.gotmpl | 3 +- content/en/quick-reference/glossary/iana.md | 6 + content/en/quick-reference/glossary/utc.md | 6 + content/en/shortcodes/ref.md | 7 +- content/en/shortcodes/relref.md | 5 +- content/en/shortcodes/vimeo.md | 16 +- content/en/shortcodes/youtube.md | 2 +- content/en/templates/embedded.md | 8 +- content/en/templates/partial.md | 2 +- content/en/templates/shortcode.md | 2 +- content/en/troubleshooting/inspection.md | 5 + data/embedded_template_urls.toml | 64 ++++---- .../_markup/render-blockquote.html | 0 .../_markup/render-codeblock.html | 0 .../{_default => }/_markup/render-link.html | 4 +- .../_markup/render-passthrough.html | 0 .../{_default => }/_markup/render-table.html | 0 .../docs/functions-aliases.html | 0 .../docs/functions-return-type.html | 0 .../docs/functions-signatures.html | 0 .../helpers/debug/list-item-metadata.html | 0 .../helpers/funcs/color-from-string.html | 0 .../helpers/funcs/get-github-info.html | 0 .../helpers/funcs/get-remote-data.html | 0 .../{partials => _partials}/helpers/gtag.html | 0 .../helpers/linkcss.html | 0 .../helpers/linkjs.html | 0 .../helpers/picture.html | 2 + .../helpers/validation/validate-keywords.html | 0 .../layouts/blocks/alert.html | 0 .../layouts/blocks/modal.html | 0 .../layouts/breadcrumbs.html | 0 .../{partials => _partials}/layouts/date.html | 0 .../layouts/docsheader.html | 0 .../layouts/explorer.html | 0 .../layouts/footer.html | 0 .../layouts/head/head-js.html | 0 .../layouts/head/head.html | 0 .../layouts/header/githubstars.html | 0 .../layouts/header/header.html | 0 .../layouts/header/qr.html | 2 +- .../layouts/header/theme.html | 0 .../layouts/home/features.html | 0 .../layouts/home/opensource.html | 0 .../layouts/home/sponsors.html | 0 .../layouts/hooks/body-end.html | 0 .../layouts/hooks/body-main-start.html | 0 .../layouts/hooks/body-start.html | 0 .../layouts/icons.html | 0 .../layouts/in-this-section.html | 0 .../layouts/page-edit.html | 0 .../layouts/related.html | 0 .../layouts/search/algolialogo.html | 0 .../layouts/search/button.html | 0 .../layouts/search/input.html | 0 .../layouts/search/results.html | 0 .../layouts/templates.html | 0 .../{partials => _partials}/layouts/toc.html | 0 .../opengraph/get-featured-image.html | 0 .../opengraph/opengraph.html | 0 .../chroma-lexers.html | 0 .../code-toggle.html | 0 .../datatable-filtered.html | 0 .../datatable.html | 0 .../deprecated-in.html | 0 .../{shortcodes => _shortcodes}/eturl.html | 0 .../glossary-term.html | 0 .../{shortcodes => _shortcodes}/glossary.html | 0 layouts/{shortcodes => _shortcodes}/hl.html | 0 layouts/{shortcodes => _shortcodes}/img.html | 2 +- .../{shortcodes => _shortcodes}/imgproc.html | 0 .../{shortcodes => _shortcodes}/include.html | 0 .../list-pages-in-section.html | 0 .../module-mounts-note.html | 0 .../{shortcodes => _shortcodes}/new-in.html | 0 .../per-lang-config-keys.html | 4 +- .../quick-reference.html | 0 .../root-configuration-keys.html | 0 .../syntax-highlighting-styles.html | 0 layouts/{_default => }/baseof.html | 2 + layouts/{index.headers => home.headers} | 0 layouts/{index.html => home.html} | 0 layouts/{index.redir => home.redir} | 0 layouts/{_default => }/list.html | 0 layouts/{_default => }/list.rss.xml | 0 layouts/{_default => }/single.html | 0 netlify.toml | 2 +- package.hugo.json | 25 +++ 101 files changed, 503 insertions(+), 164 deletions(-) create mode 100644 content/en/functions/templates/Current.md create mode 100644 content/en/functions/time/In.md create mode 100644 content/en/quick-reference/glossary/iana.md create mode 100644 content/en/quick-reference/glossary/utc.md rename layouts/{_default => }/_markup/render-blockquote.html (100%) rename layouts/{_default => }/_markup/render-codeblock.html (100%) rename layouts/{_default => }/_markup/render-link.html (98%) rename layouts/{_default => }/_markup/render-passthrough.html (100%) rename layouts/{_default => }/_markup/render-table.html (100%) rename layouts/{partials => _partials}/docs/functions-aliases.html (100%) rename layouts/{partials => _partials}/docs/functions-return-type.html (100%) rename layouts/{partials => _partials}/docs/functions-signatures.html (100%) rename layouts/{partials => _partials}/helpers/debug/list-item-metadata.html (100%) rename layouts/{partials => _partials}/helpers/funcs/color-from-string.html (100%) rename layouts/{partials => _partials}/helpers/funcs/get-github-info.html (100%) rename layouts/{partials => _partials}/helpers/funcs/get-remote-data.html (100%) rename layouts/{partials => _partials}/helpers/gtag.html (100%) rename layouts/{partials => _partials}/helpers/linkcss.html (100%) rename layouts/{partials => _partials}/helpers/linkjs.html (100%) rename layouts/{partials => _partials}/helpers/picture.html (92%) rename layouts/{partials => _partials}/helpers/validation/validate-keywords.html (100%) rename layouts/{partials => _partials}/layouts/blocks/alert.html (100%) rename layouts/{partials => _partials}/layouts/blocks/modal.html (100%) rename layouts/{partials => _partials}/layouts/breadcrumbs.html (100%) rename layouts/{partials => _partials}/layouts/date.html (100%) rename layouts/{partials => _partials}/layouts/docsheader.html (100%) rename layouts/{partials => _partials}/layouts/explorer.html (100%) rename layouts/{partials => _partials}/layouts/footer.html (100%) rename layouts/{partials => _partials}/layouts/head/head-js.html (100%) rename layouts/{partials => _partials}/layouts/head/head.html (100%) rename layouts/{partials => _partials}/layouts/header/githubstars.html (100%) rename layouts/{partials => _partials}/layouts/header/header.html (100%) rename layouts/{partials => _partials}/layouts/header/qr.html (96%) rename layouts/{partials => _partials}/layouts/header/theme.html (100%) rename layouts/{partials => _partials}/layouts/home/features.html (100%) rename layouts/{partials => _partials}/layouts/home/opensource.html (100%) rename layouts/{partials => _partials}/layouts/home/sponsors.html (100%) rename layouts/{partials => _partials}/layouts/hooks/body-end.html (100%) rename layouts/{partials => _partials}/layouts/hooks/body-main-start.html (100%) rename layouts/{partials => _partials}/layouts/hooks/body-start.html (100%) rename layouts/{partials => _partials}/layouts/icons.html (100%) rename layouts/{partials => _partials}/layouts/in-this-section.html (100%) rename layouts/{partials => _partials}/layouts/page-edit.html (100%) rename layouts/{partials => _partials}/layouts/related.html (100%) rename layouts/{partials => _partials}/layouts/search/algolialogo.html (100%) rename layouts/{partials => _partials}/layouts/search/button.html (100%) rename layouts/{partials => _partials}/layouts/search/input.html (100%) rename layouts/{partials => _partials}/layouts/search/results.html (100%) rename layouts/{partials => _partials}/layouts/templates.html (100%) rename layouts/{partials => _partials}/layouts/toc.html (100%) rename layouts/{partials => _partials}/opengraph/get-featured-image.html (100%) rename layouts/{partials => _partials}/opengraph/opengraph.html (100%) rename layouts/{shortcodes => _shortcodes}/chroma-lexers.html (100%) rename layouts/{shortcodes => _shortcodes}/code-toggle.html (100%) rename layouts/{shortcodes => _shortcodes}/datatable-filtered.html (100%) rename layouts/{shortcodes => _shortcodes}/datatable.html (100%) rename layouts/{shortcodes => _shortcodes}/deprecated-in.html (100%) rename layouts/{shortcodes => _shortcodes}/eturl.html (100%) rename layouts/{shortcodes => _shortcodes}/glossary-term.html (100%) rename layouts/{shortcodes => _shortcodes}/glossary.html (100%) rename layouts/{shortcodes => _shortcodes}/hl.html (100%) rename layouts/{shortcodes => _shortcodes}/img.html (99%) rename layouts/{shortcodes => _shortcodes}/imgproc.html (100%) rename layouts/{shortcodes => _shortcodes}/include.html (100%) rename layouts/{shortcodes => _shortcodes}/list-pages-in-section.html (100%) rename layouts/{shortcodes => _shortcodes}/module-mounts-note.html (100%) rename layouts/{shortcodes => _shortcodes}/new-in.html (100%) rename layouts/{shortcodes => _shortcodes}/per-lang-config-keys.html (97%) rename layouts/{shortcodes => _shortcodes}/quick-reference.html (100%) rename layouts/{shortcodes => _shortcodes}/root-configuration-keys.html (100%) rename layouts/{shortcodes => _shortcodes}/syntax-highlighting-styles.html (100%) rename layouts/{_default => }/baseof.html (98%) rename layouts/{index.headers => home.headers} (100%) rename layouts/{index.html => home.html} (100%) rename layouts/{index.redir => home.redir} (100%) rename layouts/{_default => }/list.html (100%) rename layouts/{_default => }/list.rss.xml (100%) rename layouts/{_default => }/single.html (100%) create mode 100644 package.hugo.json diff --git a/content/en/configuration/introduction.md b/content/en/configuration/introduction.md index 121a483c4..8f8ad4c1e 100644 --- a/content/en/configuration/introduction.md +++ b/content/en/configuration/introduction.md @@ -249,7 +249,7 @@ HUGO_FILE_LOG_FORMAT HUGO_MEMORYLIMIT : {{< new-in 0.123.0 />}} -: (`int`) The maximum amount of system memory, in gigabytes, that Hugo can use while rendering your site. Default is 25% of total system memory. Note that The `HUGO_MEMORYLIMIT` is a “best effort” setting. Don't expect Hugo to build a million pages with only 1 GB memory. You can get more information about how this behaves during the build by building with `hugo --logLevel info` and look for the `dynacache` label. +: (`int`) The maximum amount of system memory, in gigabytes, that Hugo can use while rendering your site. Default is 25% of total system memory. Note that `HUGO_MEMORYLIMIT` is a "best effort" setting. Don't expect Hugo to build a million pages with only 1 GB of memory. You can get more information about how this behaves during the build by building with `hugo --logLevel info` and look for the `dynacache` label. HUGO_NUMWORKERMULTIPLIER : (`int`) The number of workers used in parallel processing. Default is the number of logical CPUs. diff --git a/content/en/content-management/menus.md b/content/en/content-management/menus.md index ab1bcbfa1..6d01173dc 100644 --- a/content/en/content-management/menus.md +++ b/content/en/content-management/menus.md @@ -11,7 +11,7 @@ aliases: [/extras/menus/] To create a menu for your site: 1. Define the menu entries -1. [Localize] each entry +1. [Localize](multilingual/#menus) each entry 1. Render the menu with a [template] Create multiple menus, either flat or nested. For example, create a main menu for the header, and a separate menu for the footer. diff --git a/content/en/contribute/documentation.md b/content/en/contribute/documentation.md index 1d185d21d..68129912a 100644 --- a/content/en/contribute/documentation.md +++ b/content/en/contribute/documentation.md @@ -112,7 +112,7 @@ Yes → Hugo is fast. ### Function and method descriptions -Start descriptions in the functions and methods sections with "Returns", of for booelan values, "Reports whether". +Start descriptions in the functions and methods sections with "Returns", or for boolean values, "Reports whether". ### File paths and names diff --git a/content/en/functions/collections/Where.md b/content/en/functions/collections/Where.md index 1df84afc4..84fd1d21e 100644 --- a/content/en/functions/collections/Where.md +++ b/content/en/functions/collections/Where.md @@ -87,7 +87,6 @@ Use any of the following logical operators: : (`bool`) Reports whether the given field value (a slice) contains one or more elements in common with `VALUE`. See [details](/functions/collections/intersect). `like` -: {{< new-in 0.116.0 />}} : (`bool`) Reports whether the given field value matches the [regular expression](g) specified in `VALUE`. Use the `like` operator to compare `string` values. The `like` operator returns `false` when comparing other data types to the regular expression. > [!note] @@ -167,8 +166,6 @@ For example, to return a collection of pages where any of the terms in the "genr ## Regular expression comparison -{{< new-in 0.116.0 />}} - To return a collection of pages where the "author" page parameter begins with either "victor" or "Victor": ```go-html-template diff --git a/content/en/functions/css/Sass.md b/content/en/functions/css/Sass.md index 1d5487130..03a4c7451 100644 --- a/content/en/functions/css/Sass.md +++ b/content/en/functions/css/Sass.md @@ -12,13 +12,66 @@ params: {{< new-in 0.128.0 />}} -```go-html-template +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. + +Sass has two forms of syntax: [SCSS] and [indented]. Hugo supports both. + +[scss]: https://sass-lang.com/documentation/syntax#scss +[indented]: https://sass-lang.com/documentation/syntax#the-indented-syntax + +## Options + +enableSourceMap +: (`bool`) Whether to generate a source map. Default is `false`. + +includePaths +: (`slice`) A slice of paths, relative to the project root, that the transpiler will use when resolving `@use` and `@import` statements. + +outputStyle +: (`string`) The output style of the resulting CSS. With LibSass, one of `nested` (default), `expanded`, `compact`, or `compressed`. With Dart Sass, either `expanded` (default) or `compressed`. + +precision +: (`int`) The precision of floating point math. Applicable to LibSass. Default is `8`. + +silenceDeprecations +: {{< new-in 0.139.0 />}} +: (`slice`) A slice of deprecation IDs to silence. IDs are enclosed in brackets within Dart Sass warning messages (e.g., `import` in `WARN Dart Sass: DEPRECATED [import]`). Applicable to Dart Sass. Default is `false`. + +silenceDependencyDeprecations +: {{< new-in 0.146.0 />}} +: (`bool`) Whether to silence deprecation warnings from dependencies, where a dependency is considered any file transitively imported through a load path. This does not apply to `@warn` or `@debug` rules.Default is `false`. + +sourceMapIncludeSources +: (`bool`) Whether to embed sources in the generated source map. Applicable to Dart Sass. Default is `false`. + +targetPath +: (`string`) The publish path for the transformed resource, relative to the[`publishDir`]. If unset, the target path defaults to the asset's original path with a `.css` extension. + +transpiler +: (`string`) The transpiler to use, either `libsass` or `dartsass`. Hugo's extended and extended/deploy editions include the LibSass transpiler. To use the Dart Sass transpiler, see the [installation instructions](#dart-sass). Default is `libsass`. + +vars +: (`map`) A map of key-value pairs that will be available in the `hugo:vars` namespace. Useful for [initializing Sass variables from Hugo templates](https://discourse.gohugo.io/t/42053/). + + ```scss + // LibSass + @import "hugo:vars"; + + // Dart Sass + @use "hugo:vars" as v; + ``` + +## Example + +```go-html-template {copy=true} {{ with resources.Get "sass/main.scss" }} {{ $opts := dict "enableSourceMap" (not hugo.IsProduction) "outputStyle" (cond hugo.IsProduction "compressed" "expanded") "targetPath" "css/main.css" - "transpiler" "libsass" + "transpiler" "dartsass" + "vars" site.Params.styles + "includePaths" (slice "node_modules/bootstrap/scss") }} {{ with . | toCSS $opts }} {{ if hugo.IsProduction }} @@ -32,63 +85,6 @@ params: {{ end }} ``` -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. - -Sass has two forms of syntax: [SCSS] and [indented]. Hugo supports both. - -[scss]: https://sass-lang.com/documentation/syntax#scss -[indented]: https://sass-lang.com/documentation/syntax#the-indented-syntax - -## Options - -transpiler -: (`string`) The transpiler to use, either `libsass` (default) or `dartsass`. Hugo's extended and extended/deploy editions include the LibSass transpiler. To use the Dart Sass transpiler, see the [installation instructions](#dart-sass) below. - -targetPath -: (`string`) If not set, the transformed resource's target path will be the original path of the asset file with its extension replaced by `.css`. - -vars -: (`map`) A map of key-value pairs that will be available in the `hugo:vars` namespace. Useful for [initializing Sass variables from Hugo templates](https://discourse.gohugo.io/t/42053/). - -```scss -// LibSass -@import "hugo:vars"; - -// Dart Sass -@use "hugo:vars" as v; -``` - -outputStyle -: (`string`) Output styles available to LibSass include `nested` (default), `expanded`, `compact`, and `compressed`. Output styles available to Dart Sass include `expanded` (default) and `compressed`. - -precision -: (`int`) Precision of floating point math. Not applicable to Dart Sass. - -enableSourceMap -: (`bool`) Whether to generate a source map. Default is `false`. - -sourceMapIncludeSources -: (`bool`) Whether to embed sources in the generated source map. Not applicable to LibSass. Default is `false`. - -includePaths -: (`slice`) A slice of paths, relative to the project root, that the transpiler will use when resolving `@use` and `@import` statements. - -```go-html-template -{{ $opts := dict - "transpiler" "dartsass" - "targetPath" "css/style.css" - "vars" site.Params.styles - "enableSourceMap" (not hugo.IsProduction) - "includePaths" (slice "node_modules/bootstrap/scss") -}} -{{ with resources.Get "sass/main.scss" | toCSS $opts | minify | fingerprint }} - -{{ end }} -``` - -silenceDeprecations -: (`slice`) {{< new-in 0.139.0 />}} A slice of deprecation IDs to silence. The deprecation IDs are printed to in the warning message, e.g "import" in `WARN Dart Sass: DEPRECATED [import] ...`. This is for Dart Sass only. - ## Dart Sass Hugo's extended and extended/deploy editions include [LibSass] to transpile Sass to CSS. In 2020, the Sass team deprecated LibSass in favor of [Dart Sass]. @@ -121,6 +117,9 @@ You may also install [prebuilt binaries] for Linux, macOS, and Windows. Run `hugo env` to list the active transpilers. +> [!note] +> If you build Hugo from source and run `mage test -v`, the test will fail if you install Dart Sass as a Snap package. This is due to the Snap package's strict confinement model. + ### Installing in a production environment For [CI/CD](g) deployments (e.g., GitHub Pages, GitLab Pages, Netlify, etc.) you must edit the workflow to install Dart Sass before Hugo builds the site[^2]. Some providers allow you to use one of the package managers above, or you can download and extract one of the prebuilt binaries. @@ -136,8 +135,6 @@ To install Dart Sass for your builds on GitHub Pages, add this step to the GitHu run: sudo snap install dart-sass ``` -If you are using GitHub Pages for the first time with your repository, GitHub provides a [starter workflow] for Hugo that includes Dart Sass. This is the simplest way to get started. - #### GitLab Pages To install Dart Sass for your builds on GitLab Pages, the `.gitlab-ci.yml` file should look something like this: @@ -194,34 +191,6 @@ command = """\ """ ``` -### Example - -To transpile with Dart Sass, set `transpiler` to `dartsass` in the options map passed to `css.Sass`. For example: - -```go-html-template -{{ with resources.Get "sass/main.scss" }} - {{ $opts := dict - "enableSourceMap" (not hugo.IsProduction) - "outputStyle" (cond hugo.IsProduction "compressed" "expanded") - "targetPath" "css/main.css" - "transpiler" "dartsass" - }} - {{ with . | toCSS $opts }} - {{ if hugo.IsProduction }} - {{ with . | fingerprint }} - - {{ end }} - {{ else }} - - {{ end }} - {{ end }} -{{ end }} -``` - -### Miscellaneous - -If you build Hugo from source and run `mage test -v`, the test will fail if you install Dart Sass as a Snap package. This is due to the Snap package's strict confinement model. - [brew.sh]: https://brew.sh/ [chocolatey.org]: https://community.chocolatey.org/packages/sass [dart sass]: https://sass-lang.com/dart-sass @@ -232,3 +201,4 @@ If you build Hugo from source and run `mage test -v`, the test will fail if you [snap package]: /installation/linux/#snap [snapcraft.io]: https://snapcraft.io/dart-sass [starter workflow]: https://github.com/actions/starter-workflows/blob/main/pages/hugo.yml +[`publishDir`]: /configuration/all/#publishdir diff --git a/content/en/functions/go-template/template.md b/content/en/functions/go-template/template.md index dac1fa3be..053cfcc22 100644 --- a/content/en/functions/go-template/template.md +++ b/content/en/functions/go-template/template.md @@ -10,7 +10,18 @@ params: signatures: ['template NAME [CONTEXT]'] --- -Use the `template` function to execute [embedded templates]. For example: +Use the `template` function to execute any of these [embedded templates](g): + +- [`disqus.html`] +- [`google_analytics.html`] +- [`opengraph.html`] +- [`pagination.html`] +- [`schema.html`] +- [`twitter_cards.html`] + + + +For example: ```go-html-template {{ range (.Paginate .Pages).Pages }} @@ -39,8 +50,21 @@ The example above can be rewritten using an [inline partial] template: {{ end }} ``` +The key distinctions between the preceding two examples are: + +1. Inline partials are globally scoped. That means that an inline partial defined in _one_ template may be called from _any_ template. +2. Leveraging the [`partialCached`] function when calling an inline partial allows for performance optimization through result caching. +3. An inline partial can [`return`] a value of any data type instead of rendering a string. + {{% include "/_common/functions/go-template/text-template.md" %}} +[`disqus.html`]: /templates/embedded/#disqus +[`google_analytics.html`]: /templates/embedded/#google-analytics +[`opengraph.html`]: /templates/embedded/#open-graph +[`pagination.html`]: /templates/embedded/#pagination +[`partialCached`]: /functions/partials/includecached/ [`partial`]: /functions/partials/include/ +[`return`]: /functions/go-template/return/ +[`schema.html`]: /templates/embedded/#schema +[`twitter_cards.html`]: /templates/embedded/#x-twitter-cards [inline partial]: /templates/partial/#inline-partials -[embedded templates]: /templates/embedded/ diff --git a/content/en/functions/templates/Current.md b/content/en/functions/templates/Current.md new file mode 100644 index 000000000..805aeec05 --- /dev/null +++ b/content/en/functions/templates/Current.md @@ -0,0 +1,155 @@ +--- +title: templates.Current +description: Returns information about the currently executing template. +categories: [] +keywords: [] +params: + functions_and_methods: + aliases: [] + returnType: tpl.CurrentTemplateInfo + signatures: [templates.Current] +--- + +> [!note] +> This function is experimental and subject to change. + +{{< new-in 0.146.0 />}} + +The `templates.Current` function provides introspection capabilities, allowing you to access details about the currently executing templates. This is useful for debugging complex template hierarchies and understanding the flow of execution during rendering. + +## Methods + +Ancestors +: (`tpl.CurrentTemplateInfos`) Returns a slice containing information about each template in the current execution chain, starting from the parent of the current template and going up towards the initial template called. It excludes any base template applied via `define` and `block`. You can chain the `Reverse` method to this result to get the slice in chronological execution order. + +Base +: (`tpl.CurrentTemplateInfoCommonOps`) Returns an object representing the base template that was applied to the current template, if any. This may be `nil`. + +Filename +: (`string`) Returns the absolute path of the current template. This will be empty for embedded templates. + +Name +: (`string`) Returns the name of the current template. This is usually the path relative to the layouts directory. + +Parent +: (`tpl.CurrentTemplateInfo`) Returns an object representing the parent of the current template, if any. This may be `nil`. + +## Examples + +The examples below help visualize template execution and require a `debug` parameter set to `true` in your site configuration: + +{{< code-toggle file=hugo >}} +[params] +debug = true +{{< /code-toggle >}} + +### Boundaries + +To visually mark where a template begins and ends execution: + +```go-html-template {file="layouts/_default/single.html"} +{{ define "main" }} + {{ if site.Params.debug }} +
[entering {{ templates.Current.Filename }}]
+ {{ end }} + +

{{ .Title }}

+ {{ .Content }} + + {{ if site.Params.debug }} +
[leaving {{ templates.Current.Filename }}]
+ {{ end }} +{{ end }} +``` + +### Call stack + +To display the chain of templates that led to the current one, create a partial template that iterates through its ancestors: + +```go-html-template {file="layouts/partials/template-call-stack.html" copy=true} +{{ with templates.Current }} +
+ {{ range .Ancestors }} + {{ .Filename }}
+ {{ with .Base }} + {{ .Filename }}
+ {{ end }} + {{ end }} +
+{{ end }} +``` + +Then call the partial from any template: + +```go-html-template {file="layouts/partials/footer/copyright.html" copy=true} +{{ if site.Params.debug }} + {{ partial "template-call-stack.html" . }} +{{ end }} +``` + +The rendered template stack would look something like this: + +```text +/home/user/project/layouts/partials/footer/copyright.html +/home/user/project/themes/foo/layouts/partials/footer.html +/home/user/project/layouts/_default/single.html +/home/user/project/themes/foo/layouts/_default/baseof.html +``` + +To reverse the order of the entries, chain the `Reverse` method to the `Ancestors` method: + +```go-html-template {file="layouts/partials/template-call-stack.html" copy=true} +{{ with templates.Current }} +
+ {{ range .Ancestors.Reverse }} + {{ with .Base }} + {{ .Filename }}
+ {{ end }} + {{ .Filename }}
+ {{ end }} +
+{{ end }} +``` + +### VS Code + +To render links that, when clicked, will open the template in Microsoft Visual Studio Code, create a partial template with anchor elements that use the `vscode` URI scheme: + +```go-html-template {file="layouts/partials/template-open-in-vs-code.html" copy=true} +{{ with templates.Current.Parent }} +
+ {{ .Name }} + {{ with .Base }} + {{ .Name }} + {{ end }} +
+{{ end }} +``` + +Then call the partial from any template: + +```go-html-template {file="layouts/_default/single.html" copy=true} +{{ define "main" }} +

{{ .Title }}

+ {{ .Content }} + + {{ if site.Params.debug }} + {{ partial "template-open-in-vs-code.html" . }} + {{ end }} +{{ end }} +``` + +Use the same approach to render the entire call stack as links: + +```go-html-template {file="layouts/partials/template-call-stack.html" copy=true} +{{ with templates.Current }} +
+ {{ range .Ancestors }} + {{ .Filename }}
+ {{ with .Base }} + {{ .Filename }}
+ {{ end }} + {{ end }} +
+{{ end }} +``` diff --git a/content/en/functions/time/In.md b/content/en/functions/time/In.md new file mode 100644 index 000000000..821eb99b7 --- /dev/null +++ b/content/en/functions/time/In.md @@ -0,0 +1,30 @@ +--- +title: time.In +description: Returns the given date/time as represented in the specified IANA time zone. +categories: [] +keywords: [] +params: + functions_and_methods: + aliases: [] + returnType: time.Time + signatures: [time.In TIMEZONE INPUT] +--- + +{{< new-in 0.146.0 />}} + +The `time.In` function returns the given date/time as represented in the specified [IANA](g) time zone. + +- If the time zone is an empty string or `UTC`, the time is returned in [UTC](g). +- If the time zone is `Local`, the time is returned in the system's local time zone. +- Otherwise, the time zone must be a valid IANA [time zone name]. + +[time zone name]: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List + +```go-html-template +{{ $layout := "2006-01-02T15:04:05-07:00" }} +{{ $t := time.AsTime "2025-03-31T14:45:00-00:00" }} + +{{ $t | time.In "America/Denver" | time.Format $layout }} → 2025-03-31T08:45:00-06:00 +{{ $t | time.In "Australia/Adelaide" | time.Format $layout }} → 2025-04-01T01:15:00+10:30 +{{ $t | time.In "Europe/Oslo" | time.Format $layout }} → 2025-03-31T16:45:00+02:00 +``` diff --git a/content/en/functions/transform/Unmarshal.md b/content/en/functions/transform/Unmarshal.md index d159122f5..93168294c 100644 --- a/content/en/functions/transform/Unmarshal.md +++ b/content/en/functions/transform/Unmarshal.md @@ -114,12 +114,14 @@ A remote resource is a file on a remote server, accessible via HTTP or HTTPS. > > `{{ $data = .Content | transform.Unmarshal }}` -## Options +## Working with CSV + +### Options When unmarshaling a CSV file, provide an optional map of options. delimiter -: (`string`) The delimiter used, default is `,`. +: (`string`) The delimiter used. Default is `,`. comment : (`string`) The comment character used in the CSV. If set, lines beginning with the comment character without preceding whitespace are ignored. @@ -128,8 +130,85 @@ lazyQuotes : {{< new-in 0.122.0 />}} : (`bool`) Whether to allow a quote in an unquoted field, or to allow a non-doubled quote in a quoted field. Default is `false`. +targetType +: {{< new-in 0.146.7 />}} +: (`string`) The target data type, either `slice` or `map`. Default is `slice`. + +### Examples + +The examples below use this CSV file: + +```csv +"name","type","breed","age" +"Spot","dog","Collie",3 +"Rover","dog","Boxer",5 +"Felix","cat","Calico",7 +``` + +To render an HTML table from a CSV file: + ```go-html-template -{{ $csv := "a;b;c" | transform.Unmarshal (dict "delimiter" ";") }} +{{ $data := slice }} +{{ $file := "pets.csv" }} +{{ with or (.Resources.Get $file) (resources.Get $file) }} + {{ $opts := dict "targetType" "slice" }} + {{ $data = transform.Unmarshal $opts . }} +{{ end }} + +{{ with $data }} + + + + {{ range index . 0 }} + + {{ end }} + + + + {{ range . | after 1 }} + + {{ range . }} + + {{ end }} + + {{ end }} + +
{{ . }}
{{ . }}
+{{ end }} +``` + +To extract a subset of the data, or to sort the data, unmarshal to a map instead of a slice: + +```go-html-template +{{ $data := slice }} +{{ $file := "pets.csv" }} +{{ with or (.Resources.Get $file) (resources.Get $file) }} + {{ $opts := dict "targetType" "map" }} + {{ $data = transform.Unmarshal $opts . }} +{{ end }} + +{{ with sort (where $data "type" "dog") "name" "asc" }} + + + + + + + + + + + {{ range . }} + + + + + + + {{ end }} + +
nametypebreedage
{{ .name }}{{ .type }}{{ .breed }}{{ .age }}
+{{ end }} ``` ## Working with XML diff --git a/content/en/host-and-deploy/host-on-github-pages/index.md b/content/en/host-and-deploy/host-on-github-pages/index.md index 4c00fbc8e..7c3201099 100644 --- a/content/en/host-and-deploy/host-on-github-pages/index.md +++ b/content/en/host-and-deploy/host-on-github-pages/index.md @@ -136,6 +136,8 @@ jobs: key: hugo-${{ github.run_id }} restore-keys: hugo- + - name: Configure Git + run: git config core.quotepath false - name: Build with Hugo run: | hugo \ diff --git a/content/en/host-and-deploy/host-on-gitlab-pages.md b/content/en/host-and-deploy/host-on-gitlab-pages.md index 4b308cc19..4750b0ff3 100644 --- a/content/en/host-and-deploy/host-on-gitlab-pages.md +++ b/content/en/host-and-deploy/host-on-gitlab-pages.md @@ -23,15 +23,15 @@ 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: - DART_SASS_VERSION: 1.85.0 + DART_SASS_VERSION: 1.87.0 GIT_DEPTH: 0 GIT_STRATEGY: clone GIT_SUBMODULE_STRATEGY: recursive - HUGO_VERSION: 0.144.2 - NODE_VERSION: 23.x + HUGO_VERSION: 0.146.7 + NODE_VERSION: 22.x TZ: America/Los_Angeles image: - name: golang:1.23.4-bookworm + name: golang:1.24.2-bookworm pages: script: @@ -53,6 +53,8 @@ pages: - apt-get install -y nodejs # Install Node.js dependencies - "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true" + # Configure Git + - git config core.quotepath false # Build - hugo --gc --minify --baseURL ${CI_PAGES_URL} # Compress diff --git a/content/en/host-and-deploy/host-on-netlify/index.md b/content/en/host-and-deploy/host-on-netlify/index.md index f3601331a..4c89a6c1e 100644 --- a/content/en/host-and-deploy/host-on-netlify/index.md +++ b/content/en/host-and-deploy/host-on-netlify/index.md @@ -113,21 +113,23 @@ Create a new file named netlify.toml in the root of your project directory. In i ```toml {file="netlify.toml"} [build.environment] -HUGO_VERSION = "0.144.2" +GO_VERSION = "1.24" +HUGO_VERSION = "0.146.7" NODE_VERSION = "22" TZ = "America/Los_Angeles" [build] publish = "public" -command = "hugo --gc --minify" +command = "git config core.quotepath false && hugo --gc --minify" ``` If your site requires Dart Sass to transpile Sass to CSS, the configuration file should look something like this: ```toml {file="netlify.toml"} [build.environment] -HUGO_VERSION = "0.144.2" -DART_SASS_VERSION = "1.85.0" +DART_SASS_VERSION = "1.87.0" +GO_VERSION = "1.24" +HUGO_VERSION = "0.146.7" NODE_VERSION = "22" TZ = "America/Los_Angeles" @@ -138,6 +140,7 @@ command = """\ tar -xf dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz && \ rm dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz && \ export PATH=/opt/build/repo/dart-sass:$PATH && \ + git config core.quotepath false && \ hugo --gc --minify \ """ ``` diff --git a/content/en/installation/linux.md b/content/en/installation/linux.md index 731cfce4c..591bf0818 100644 --- a/content/en/installation/linux.md +++ b/content/en/installation/linux.md @@ -30,17 +30,33 @@ To install the extended edition of Hugo: sudo snap install hugo ``` -To enable or revoke access to removable media: +To control automatic updates: ```sh +# disable automatic updates +sudo snap refresh --hold hugo + +# enable automatic updates +sudo snap refresh --unhold hugo +``` + +To control access to removable media: + +```sh +# allow access sudo snap connect hugo:removable-media + +# revoke access sudo snap disconnect hugo:removable-media ``` -To enable or revoke access to SSH keys: +To control access to SSH keys: ```sh +# allow access sudo snap connect hugo:ssh-keys + +# revoke access sudo snap disconnect hugo:ssh-keys ``` diff --git a/content/en/news/_content.gotmpl b/content/en/news/_content.gotmpl index f979c9adc..af3cf47ed 100644 --- a/content/en/news/_content.gotmpl +++ b/content/en/news/_content.gotmpl @@ -23,7 +23,8 @@ "dates" $dates "kind" "page" "params" $params - "path" .name + "path" (strings.Replace .name "." "-") + "slug" .name "title" (printf "Release %s" .name) }} {{ $.AddPage $page }} diff --git a/content/en/quick-reference/glossary/iana.md b/content/en/quick-reference/glossary/iana.md new file mode 100644 index 000000000..89497f76a --- /dev/null +++ b/content/en/quick-reference/glossary/iana.md @@ -0,0 +1,6 @@ +--- +title: IANA +reference: https://www.iana.org/about +--- + +_IANA_ is an abbreviation for the Internet Assigned Numbers Authority, a non-profit organization that manages the allocation of global IP addresses, autonomous system numbers, DNS root zone, media types, and other Internet Protocol-related resources. diff --git a/content/en/quick-reference/glossary/utc.md b/content/en/quick-reference/glossary/utc.md new file mode 100644 index 000000000..a4627be5a --- /dev/null +++ b/content/en/quick-reference/glossary/utc.md @@ -0,0 +1,6 @@ +--- +title: UTC +reference: https://en.wikipedia.org/wiki/Coordinated_Universal_Time +--- + +_UTC_ is an abbreviation for Coordinated Universal Time, the primary time standard used worldwide to regulate clocks and time. It is the basis for civil time and time zones across the globe. diff --git a/content/en/shortcodes/ref.md b/content/en/shortcodes/ref.md index 2f821254c..a52c2bf6e 100755 --- a/content/en/shortcodes/ref.md +++ b/content/en/shortcodes/ref.md @@ -10,7 +10,7 @@ keywords: [] > To override Hugo's embedded `ref` shortcode, copy the [source code] to a file with the same name in the `layouts/shortcodes` directory. > [!note] -> When working with the Markdown [content format], this shortcode has become largely redundant. Its functionality is now primarily handled by [link render hooks], specifically the embedded one provided by Hugo. This hook effectively addresses all the use cases previously covered by this shortcode. +> When working with Markdown, this shortcode is obsolete. Instead, use a [link render hook] that resolves the link destination using the `GetPage` method on the `Page` object. You can either create your own, or simply enable the [embedded link render hook]. The embedded link render hook is automatically enabled for multilingual single-host projects. ## Usage @@ -56,6 +56,7 @@ Rendered: {{% include "_common/ref-and-relref-error-handling.md" %}} [content format]: /content-management/formats/ -[link render hooks]: /render-hooks/images/#default +[embedded link render hook]: /render-hooks/links/#default +[link render hook]: /render-hooks/links/ [Markdown notation]: /content-management/shortcodes/#notation -[source code]: {{% eturl ref %}} +[source code]: {{% eturl relref %}} diff --git a/content/en/shortcodes/relref.md b/content/en/shortcodes/relref.md index 5b413b87e..219eae81a 100755 --- a/content/en/shortcodes/relref.md +++ b/content/en/shortcodes/relref.md @@ -10,7 +10,7 @@ keywords: [] > To override Hugo's embedded `relref` shortcode, copy the [source code] to a file with the same name in the `layouts/shortcodes` directory. > [!note] -> When working with the Markdown [content format], this shortcode has become largely redundant. Its functionality is now primarily handled by [link render hooks], specifically the embedded one provided by Hugo. This hook effectively addresses all the use cases previously covered by this shortcode. +> When working with Markdown, this shortcode is obsolete. Instead, use a [link render hook] that resolves the link destination using the `GetPage` method on the `Page` object. You can either create your own, or simply enable the [embedded link render hook]. The embedded link render hook is automatically enabled for multilingual single-host projects. ## Usage @@ -56,6 +56,7 @@ Rendered: {{% include "_common/ref-and-relref-error-handling.md" %}} [content format]: /content-management/formats/ -[link render hooks]: /render-hooks/links/ +[embedded link render hook]: /render-hooks/links/#default +[link render hook]: /render-hooks/links/ [Markdown notation]: /content-management/shortcodes/#notation [source code]: {{% eturl relref %}} diff --git a/content/en/shortcodes/vimeo.md b/content/en/shortcodes/vimeo.md index c354eefe0..1164ce997 100755 --- a/content/en/shortcodes/vimeo.md +++ b/content/en/shortcodes/vimeo.md @@ -29,19 +29,27 @@ Hugo renders this to: ## Arguments +id +: (string) The video `id`. Optional if the `id` is provided as a positional argument as shown in the example above. + +allowFullScreen +: {{< new-in 0.146.0 />}} +: (`bool`) Whether the `iframe` element can activate full screen mode. Default is `true`. + class : (`string`) The `class` attribute of the wrapping `div` element. Adding one or more CSS classes disables inline styling. -id -: (`string`) The `id` of the Vimeo video +loading +: {{< new-in 0.146.0 />}} +: (`string`) The loading attribute of the `iframe` element, either `eager` or `lazy`. Default is `eager`. title : (`string`) The `title` attribute of the `iframe` element. -If you provide a `class` or `title` you must use a named parameter for the `id`. +Here's an example using some of the available arguments: ```text -{{}} +{{}} ``` ## Privacy diff --git a/content/en/shortcodes/youtube.md b/content/en/shortcodes/youtube.md index 18c5ae6c2..ed3cf0632 100755 --- a/content/en/shortcodes/youtube.md +++ b/content/en/shortcodes/youtube.md @@ -70,7 +70,7 @@ start title : (`string`) The `title` attribute of the `iframe` element. Defaults to "YouTube video". -Example using some of the above: +Here's an example using some of the available arguments: ```text {{}} diff --git a/content/en/templates/embedded.md b/content/en/templates/embedded.md index 198136393..ecfd90514 100644 --- a/content/en/templates/embedded.md +++ b/content/en/templates/embedded.md @@ -1,6 +1,6 @@ --- -title: Embedded templates -description: Hugo provides embedded templates for common use cases. +title: Embedded partial templates +description: Hugo provides embedded partial templates for common use cases. categories: [] keywords: [] weight: 170 @@ -145,6 +145,10 @@ Various optional metadata can also be set: If using YouTube this will produce a og:video tag like ``. Use the `https://youtu.be/` format with YouTube videos (example: `https://youtu.be/qtIqKaDlqXo`). +## Pagination + +See [details](/templates/pagination/). + ## Schema > [!note] diff --git a/content/en/templates/partial.md b/content/en/templates/partial.md index 8493a4674..7ff2d9594 100644 --- a/content/en/templates/partial.md +++ b/content/en/templates/partial.md @@ -49,7 +49,7 @@ As shown in the above example directory structure, you can nest your directories ### Variable scoping -The second argument in a partial call is the variable being passed down. The above examples are passing the `.`, which tells the template receiving the partial to apply the current [context][context]. +The second argument in a partial call is the variable being passed down. The above examples are passing the dot (`.`), which tells the template receiving the partial to apply the current [context][context]. This means the partial will *only* be able to access those variables. The partial is isolated and cannot access the outer scope. From within the partial, `$.Var` is equivalent to `.Var`. diff --git a/content/en/templates/shortcode.md b/content/en/templates/shortcode.md index 711d342cb..3ed573651 100644 --- a/content/en/templates/shortcode.md +++ b/content/en/templates/shortcode.md @@ -329,7 +329,7 @@ You can use the `HasShortcode` method in your base template to conditionally loa [`with`]: /functions/go-template/with/ [content management]: /content-management/shortcodes/ [embedded shortcodes]: /shortcodes/ -[GitHub]: https://github.com/gohugoio/hugo/tree/master/tpl/tplimpl/embedded/templates/shortcodes +[GitHub]: https://github.com/gohugoio/hugo/tree/master/tpl/tplimpl/embedded/templates/_shortcodes [introduction to templating]: /templates/introduction/ [Markdown notation]: /content-management/shortcodes/#markdown-notation [named or positional]: /content-management/shortcodes/#arguments diff --git a/content/en/troubleshooting/inspection.md b/content/en/troubleshooting/inspection.md index dc662243a..ea3c097f9 100644 --- a/content/en/troubleshooting/inspection.md +++ b/content/en/troubleshooting/inspection.md @@ -34,6 +34,11 @@ Use the [`printf`] function (render) or [`warnf`] function (log to console) to i {{ printf "%[1]v (%[1]T)" $value }} → 42 (int) ``` +{{< new-in 0.146.0 />}} + +Use the [`templates.Current`] function to visually mark template execution boundaries or to display the template call stack. + [`debug.Dump`]: /functions/debug/dump/ [`printf`]: /functions/fmt/printf/ [`warnf`]: /functions/fmt/warnf/ +[`templates.Current`]: /functions/templates/current/ diff --git a/data/embedded_template_urls.toml b/data/embedded_template_urls.toml index f75b14f12..b2a796cd1 100644 --- a/data/embedded_template_urls.toml +++ b/data/embedded_template_urls.toml @@ -4,39 +4,39 @@ # BaseURL 'base_url' = 'https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates' -# Templates -'alias' = 'alias.html' -'disqus' = 'disqus.html' -'google_analytics' = 'google_analytics.html' -'opengraph' = 'opengraph.html' -'pagination' = 'pagination.html' -'robots' = '_default/robots.txt' -'rss' = '_default/rss.xml' -'schema' = 'schema.html' -'sitemap' = '_default/sitemap.xml' -'sitemapindex' = '_default/sitemapindex.xml' -'twitter_cards' = 'twitter_cards.html' +# Partials +'disqus' = '_partials/disqus.html' +'google_analytics' = '_partials/google_analytics.html' +'opengraph' = '_partials/opengraph.html' +'pagination' = '_partials/pagination.html' +'schema' = '_partials/schema.html' +'twitter_cards' = '_partials/twitter_cards.html' # Render hooks -'render-codeblock-goat' = '_default/_markup/render-codeblock-goat.html' -'render-image' = '_default/_markup/render-image.html' -'render-link' = '_default/_markup/render-link.html' -'render-table' = '_default/_markup/render-table.html' +'render-codeblock-goat' = '_markup/render-codeblock-goat.html' +'render-image' = '_markup/render-image.html' +'render-link' = '_markup/render-link.html' +'render-table' = '_markup/render-table.html' # Shortcodes -'details' = 'shortcodes/details.html' -'figure' = 'shortcodes/figure.html' -'gist' = 'shortcodes/gist.html' -'highlight' = 'shortcodes/highlight.html' -'instagram' = 'shortcodes/instagram.html' -'param' = 'shortcodes/param.html' -'qr' = 'shortcodes/qr.html' -'ref' = 'shortcodes/ref.html' -'relref' = 'shortcodes/relref.html' -'twitter' = 'shortcodes/twitter.html' -'twitter_simple' = 'shortcodes/twitter_simple.html' -'vimeo' = 'shortcodes/vimeo.html' -'vimeo_simple' = 'shortcodes/vimeo_simple.html' -'x' = 'shortcodes/x.html' -'x_simple' = 'shortcodes/x_simple.html' -'youtube' = 'shortcodes/youtube.html' +'details' = '_shortcodes/details.html' +'figure' = '_shortcodes/figure.html' +'gist' = '_shortcodes/gist.html' +'highlight' = '_shortcodes/highlight.html' +'instagram' = '_shortcodes/instagram.html' +'param' = '_shortcodes/param.html' +'qr' = '_shortcodes/qr.html' +'ref' = '_shortcodes/ref.html' +'relref' = '_shortcodes/relref.html' +'vimeo' = '_shortcodes/vimeo.html' +'vimeo_simple' = '_shortcodes/vimeo_simple.html' +'x' = '_shortcodes/x.html' +'x_simple' = '_shortcodes/x_simple.html' +'youtube' = '_shortcodes/youtube.html' + +# Other +'alias' = 'alias.html' +'robots' = 'robots.txt' +'rss' = 'rss.xml' +'sitemap' = 'sitemap.xml' +'sitemapindex' = 'sitemapindex.xml' diff --git a/layouts/_default/_markup/render-blockquote.html b/layouts/_markup/render-blockquote.html similarity index 100% rename from layouts/_default/_markup/render-blockquote.html rename to layouts/_markup/render-blockquote.html diff --git a/layouts/_default/_markup/render-codeblock.html b/layouts/_markup/render-codeblock.html similarity index 100% rename from layouts/_default/_markup/render-codeblock.html rename to layouts/_markup/render-codeblock.html diff --git a/layouts/_default/_markup/render-link.html b/layouts/_markup/render-link.html similarity index 98% rename from layouts/_default/_markup/render-link.html rename to layouts/_markup/render-link.html index 88e3cbee5..70011220e 100644 --- a/layouts/_default/_markup/render-link.html +++ b/layouts/_markup/render-link.html @@ -196,7 +196,7 @@ either of these shortcodes in conjunction with this render hook. >{{ .Text }} -{{- define "partials/inline/h-rh-l/validate-fragment.html" }} +{{- define "_partials/inline/h-rh-l/validate-fragment.html" }} {{- /* Validates the fragment portion of a link destination. @@ -248,7 +248,7 @@ either of these shortcodes in conjunction with this render hook. {{- end }} {{- end }} -{{- define "partials/inline/h-rh-l/get-glossary-link-attributes.html" }} +{{- define "_partials/inline/h-rh-l/get-glossary-link-attributes.html" }} {{- /* Returns the anchor element attributes for a link to the given glossary term. diff --git a/layouts/_default/_markup/render-passthrough.html b/layouts/_markup/render-passthrough.html similarity index 100% rename from layouts/_default/_markup/render-passthrough.html rename to layouts/_markup/render-passthrough.html diff --git a/layouts/_default/_markup/render-table.html b/layouts/_markup/render-table.html similarity index 100% rename from layouts/_default/_markup/render-table.html rename to layouts/_markup/render-table.html diff --git a/layouts/partials/docs/functions-aliases.html b/layouts/_partials/docs/functions-aliases.html similarity index 100% rename from layouts/partials/docs/functions-aliases.html rename to layouts/_partials/docs/functions-aliases.html diff --git a/layouts/partials/docs/functions-return-type.html b/layouts/_partials/docs/functions-return-type.html similarity index 100% rename from layouts/partials/docs/functions-return-type.html rename to layouts/_partials/docs/functions-return-type.html diff --git a/layouts/partials/docs/functions-signatures.html b/layouts/_partials/docs/functions-signatures.html similarity index 100% rename from layouts/partials/docs/functions-signatures.html rename to layouts/_partials/docs/functions-signatures.html diff --git a/layouts/partials/helpers/debug/list-item-metadata.html b/layouts/_partials/helpers/debug/list-item-metadata.html similarity index 100% rename from layouts/partials/helpers/debug/list-item-metadata.html rename to layouts/_partials/helpers/debug/list-item-metadata.html diff --git a/layouts/partials/helpers/funcs/color-from-string.html b/layouts/_partials/helpers/funcs/color-from-string.html similarity index 100% rename from layouts/partials/helpers/funcs/color-from-string.html rename to layouts/_partials/helpers/funcs/color-from-string.html diff --git a/layouts/partials/helpers/funcs/get-github-info.html b/layouts/_partials/helpers/funcs/get-github-info.html similarity index 100% rename from layouts/partials/helpers/funcs/get-github-info.html rename to layouts/_partials/helpers/funcs/get-github-info.html diff --git a/layouts/partials/helpers/funcs/get-remote-data.html b/layouts/_partials/helpers/funcs/get-remote-data.html similarity index 100% rename from layouts/partials/helpers/funcs/get-remote-data.html rename to layouts/_partials/helpers/funcs/get-remote-data.html diff --git a/layouts/partials/helpers/gtag.html b/layouts/_partials/helpers/gtag.html similarity index 100% rename from layouts/partials/helpers/gtag.html rename to layouts/_partials/helpers/gtag.html diff --git a/layouts/partials/helpers/linkcss.html b/layouts/_partials/helpers/linkcss.html similarity index 100% rename from layouts/partials/helpers/linkcss.html rename to layouts/_partials/helpers/linkcss.html diff --git a/layouts/partials/helpers/linkjs.html b/layouts/_partials/helpers/linkjs.html similarity index 100% rename from layouts/partials/helpers/linkjs.html rename to layouts/_partials/helpers/linkjs.html diff --git a/layouts/partials/helpers/picture.html b/layouts/_partials/helpers/picture.html similarity index 92% rename from layouts/partials/helpers/picture.html rename to layouts/_partials/helpers/picture.html index 454dd705e..4dc16c002 100644 --- a/layouts/partials/helpers/picture.html +++ b/layouts/_partials/helpers/picture.html @@ -5,6 +5,7 @@ {{ $image1x := $image.Resize (printf "%dx" $width1x) }} {{ $image1xWebp := $image.Resize (printf "%dx webp" $width1x) }} {{ $class := .class | default "h-64 tablet:h-96 lg:h-full w-full object-cover lg:absolute" }} +{{ $loading := .loading | default "eager" }} diff --git a/layouts/partials/helpers/validation/validate-keywords.html b/layouts/_partials/helpers/validation/validate-keywords.html similarity index 100% rename from layouts/partials/helpers/validation/validate-keywords.html rename to layouts/_partials/helpers/validation/validate-keywords.html diff --git a/layouts/partials/layouts/blocks/alert.html b/layouts/_partials/layouts/blocks/alert.html similarity index 100% rename from layouts/partials/layouts/blocks/alert.html rename to layouts/_partials/layouts/blocks/alert.html diff --git a/layouts/partials/layouts/blocks/modal.html b/layouts/_partials/layouts/blocks/modal.html similarity index 100% rename from layouts/partials/layouts/blocks/modal.html rename to layouts/_partials/layouts/blocks/modal.html diff --git a/layouts/partials/layouts/breadcrumbs.html b/layouts/_partials/layouts/breadcrumbs.html similarity index 100% rename from layouts/partials/layouts/breadcrumbs.html rename to layouts/_partials/layouts/breadcrumbs.html diff --git a/layouts/partials/layouts/date.html b/layouts/_partials/layouts/date.html similarity index 100% rename from layouts/partials/layouts/date.html rename to layouts/_partials/layouts/date.html diff --git a/layouts/partials/layouts/docsheader.html b/layouts/_partials/layouts/docsheader.html similarity index 100% rename from layouts/partials/layouts/docsheader.html rename to layouts/_partials/layouts/docsheader.html diff --git a/layouts/partials/layouts/explorer.html b/layouts/_partials/layouts/explorer.html similarity index 100% rename from layouts/partials/layouts/explorer.html rename to layouts/_partials/layouts/explorer.html diff --git a/layouts/partials/layouts/footer.html b/layouts/_partials/layouts/footer.html similarity index 100% rename from layouts/partials/layouts/footer.html rename to layouts/_partials/layouts/footer.html diff --git a/layouts/partials/layouts/head/head-js.html b/layouts/_partials/layouts/head/head-js.html similarity index 100% rename from layouts/partials/layouts/head/head-js.html rename to layouts/_partials/layouts/head/head-js.html diff --git a/layouts/partials/layouts/head/head.html b/layouts/_partials/layouts/head/head.html similarity index 100% rename from layouts/partials/layouts/head/head.html rename to layouts/_partials/layouts/head/head.html diff --git a/layouts/partials/layouts/header/githubstars.html b/layouts/_partials/layouts/header/githubstars.html similarity index 100% rename from layouts/partials/layouts/header/githubstars.html rename to layouts/_partials/layouts/header/githubstars.html diff --git a/layouts/partials/layouts/header/header.html b/layouts/_partials/layouts/header/header.html similarity index 100% rename from layouts/partials/layouts/header/header.html rename to layouts/_partials/layouts/header/header.html diff --git a/layouts/partials/layouts/header/qr.html b/layouts/_partials/layouts/header/qr.html similarity index 96% rename from layouts/partials/layouts/header/qr.html rename to layouts/_partials/layouts/header/qr.html index ccc0ee959..fea64f625 100644 --- a/layouts/partials/layouts/header/qr.html +++ b/layouts/_partials/layouts/header/qr.html @@ -10,7 +10,7 @@ {{ partial "layouts/blocks/modal.html" (dict "modal_button" $qr "modal_content" $qrBig "modal_title" (printf "QR code linking to %s" $.Permalink )) }} -{{ define "partials/_inline/qr" }} +{{ define "_partials/_inline/qr" }} {{ $img_class := .img_class | default "w-10" }} {{ with images.QR $.page.Permalink (dict "targetDir" "images/qr") }} diff --git a/layouts/partials/layouts/header/theme.html b/layouts/_partials/layouts/header/theme.html similarity index 100% rename from layouts/partials/layouts/header/theme.html rename to layouts/_partials/layouts/header/theme.html diff --git a/layouts/partials/layouts/home/features.html b/layouts/_partials/layouts/home/features.html similarity index 100% rename from layouts/partials/layouts/home/features.html rename to layouts/_partials/layouts/home/features.html diff --git a/layouts/partials/layouts/home/opensource.html b/layouts/_partials/layouts/home/opensource.html similarity index 100% rename from layouts/partials/layouts/home/opensource.html rename to layouts/_partials/layouts/home/opensource.html diff --git a/layouts/partials/layouts/home/sponsors.html b/layouts/_partials/layouts/home/sponsors.html similarity index 100% rename from layouts/partials/layouts/home/sponsors.html rename to layouts/_partials/layouts/home/sponsors.html diff --git a/layouts/partials/layouts/hooks/body-end.html b/layouts/_partials/layouts/hooks/body-end.html similarity index 100% rename from layouts/partials/layouts/hooks/body-end.html rename to layouts/_partials/layouts/hooks/body-end.html diff --git a/layouts/partials/layouts/hooks/body-main-start.html b/layouts/_partials/layouts/hooks/body-main-start.html similarity index 100% rename from layouts/partials/layouts/hooks/body-main-start.html rename to layouts/_partials/layouts/hooks/body-main-start.html diff --git a/layouts/partials/layouts/hooks/body-start.html b/layouts/_partials/layouts/hooks/body-start.html similarity index 100% rename from layouts/partials/layouts/hooks/body-start.html rename to layouts/_partials/layouts/hooks/body-start.html diff --git a/layouts/partials/layouts/icons.html b/layouts/_partials/layouts/icons.html similarity index 100% rename from layouts/partials/layouts/icons.html rename to layouts/_partials/layouts/icons.html diff --git a/layouts/partials/layouts/in-this-section.html b/layouts/_partials/layouts/in-this-section.html similarity index 100% rename from layouts/partials/layouts/in-this-section.html rename to layouts/_partials/layouts/in-this-section.html diff --git a/layouts/partials/layouts/page-edit.html b/layouts/_partials/layouts/page-edit.html similarity index 100% rename from layouts/partials/layouts/page-edit.html rename to layouts/_partials/layouts/page-edit.html diff --git a/layouts/partials/layouts/related.html b/layouts/_partials/layouts/related.html similarity index 100% rename from layouts/partials/layouts/related.html rename to layouts/_partials/layouts/related.html diff --git a/layouts/partials/layouts/search/algolialogo.html b/layouts/_partials/layouts/search/algolialogo.html similarity index 100% rename from layouts/partials/layouts/search/algolialogo.html rename to layouts/_partials/layouts/search/algolialogo.html diff --git a/layouts/partials/layouts/search/button.html b/layouts/_partials/layouts/search/button.html similarity index 100% rename from layouts/partials/layouts/search/button.html rename to layouts/_partials/layouts/search/button.html diff --git a/layouts/partials/layouts/search/input.html b/layouts/_partials/layouts/search/input.html similarity index 100% rename from layouts/partials/layouts/search/input.html rename to layouts/_partials/layouts/search/input.html diff --git a/layouts/partials/layouts/search/results.html b/layouts/_partials/layouts/search/results.html similarity index 100% rename from layouts/partials/layouts/search/results.html rename to layouts/_partials/layouts/search/results.html diff --git a/layouts/partials/layouts/templates.html b/layouts/_partials/layouts/templates.html similarity index 100% rename from layouts/partials/layouts/templates.html rename to layouts/_partials/layouts/templates.html diff --git a/layouts/partials/layouts/toc.html b/layouts/_partials/layouts/toc.html similarity index 100% rename from layouts/partials/layouts/toc.html rename to layouts/_partials/layouts/toc.html diff --git a/layouts/partials/opengraph/get-featured-image.html b/layouts/_partials/opengraph/get-featured-image.html similarity index 100% rename from layouts/partials/opengraph/get-featured-image.html rename to layouts/_partials/opengraph/get-featured-image.html diff --git a/layouts/partials/opengraph/opengraph.html b/layouts/_partials/opengraph/opengraph.html similarity index 100% rename from layouts/partials/opengraph/opengraph.html rename to layouts/_partials/opengraph/opengraph.html diff --git a/layouts/shortcodes/chroma-lexers.html b/layouts/_shortcodes/chroma-lexers.html similarity index 100% rename from layouts/shortcodes/chroma-lexers.html rename to layouts/_shortcodes/chroma-lexers.html diff --git a/layouts/shortcodes/code-toggle.html b/layouts/_shortcodes/code-toggle.html similarity index 100% rename from layouts/shortcodes/code-toggle.html rename to layouts/_shortcodes/code-toggle.html diff --git a/layouts/shortcodes/datatable-filtered.html b/layouts/_shortcodes/datatable-filtered.html similarity index 100% rename from layouts/shortcodes/datatable-filtered.html rename to layouts/_shortcodes/datatable-filtered.html diff --git a/layouts/shortcodes/datatable.html b/layouts/_shortcodes/datatable.html similarity index 100% rename from layouts/shortcodes/datatable.html rename to layouts/_shortcodes/datatable.html diff --git a/layouts/shortcodes/deprecated-in.html b/layouts/_shortcodes/deprecated-in.html similarity index 100% rename from layouts/shortcodes/deprecated-in.html rename to layouts/_shortcodes/deprecated-in.html diff --git a/layouts/shortcodes/eturl.html b/layouts/_shortcodes/eturl.html similarity index 100% rename from layouts/shortcodes/eturl.html rename to layouts/_shortcodes/eturl.html diff --git a/layouts/shortcodes/glossary-term.html b/layouts/_shortcodes/glossary-term.html similarity index 100% rename from layouts/shortcodes/glossary-term.html rename to layouts/_shortcodes/glossary-term.html diff --git a/layouts/shortcodes/glossary.html b/layouts/_shortcodes/glossary.html similarity index 100% rename from layouts/shortcodes/glossary.html rename to layouts/_shortcodes/glossary.html diff --git a/layouts/shortcodes/hl.html b/layouts/_shortcodes/hl.html similarity index 100% rename from layouts/shortcodes/hl.html rename to layouts/_shortcodes/hl.html diff --git a/layouts/shortcodes/img.html b/layouts/_shortcodes/img.html similarity index 99% rename from layouts/shortcodes/img.html rename to layouts/_shortcodes/img.html index 60187802e..e49afc57f 100644 --- a/layouts/shortcodes/img.html +++ b/layouts/_shortcodes/img.html @@ -359,7 +359,7 @@ When using the padding filter, provide all arguments in this order: {{- end }} {{- end }} -{{- define "partials/inline/get-resource.html" }} +{{- define "_partials/inline/get-resource.html" }} {{- $r := "" }} {{- $u := urls.Parse .src }} {{- $msg := "The %q shortcode was unable to resolve %s. See %s" }} diff --git a/layouts/shortcodes/imgproc.html b/layouts/_shortcodes/imgproc.html similarity index 100% rename from layouts/shortcodes/imgproc.html rename to layouts/_shortcodes/imgproc.html diff --git a/layouts/shortcodes/include.html b/layouts/_shortcodes/include.html similarity index 100% rename from layouts/shortcodes/include.html rename to layouts/_shortcodes/include.html diff --git a/layouts/shortcodes/list-pages-in-section.html b/layouts/_shortcodes/list-pages-in-section.html similarity index 100% rename from layouts/shortcodes/list-pages-in-section.html rename to layouts/_shortcodes/list-pages-in-section.html diff --git a/layouts/shortcodes/module-mounts-note.html b/layouts/_shortcodes/module-mounts-note.html similarity index 100% rename from layouts/shortcodes/module-mounts-note.html rename to layouts/_shortcodes/module-mounts-note.html diff --git a/layouts/shortcodes/new-in.html b/layouts/_shortcodes/new-in.html similarity index 100% rename from layouts/shortcodes/new-in.html rename to layouts/_shortcodes/new-in.html diff --git a/layouts/shortcodes/per-lang-config-keys.html b/layouts/_shortcodes/per-lang-config-keys.html similarity index 97% rename from layouts/shortcodes/per-lang-config-keys.html rename to layouts/_shortcodes/per-lang-config-keys.html index f6090d555..31d7daf6a 100644 --- a/layouts/shortcodes/per-lang-config-keys.html +++ b/layouts/_shortcodes/per-lang-config-keys.html @@ -14,8 +14,8 @@ separately for each language. (dict "contentDir" "/configuration/all/#contentdir") (dict "copyright" "/configuration/all/#copyright") (dict "disableAliases" "/configuration/all/#disablealiases") - (dict "disableHugoGeneratorInject" "/configuration/all/#disableHugogeneratorinject") - (dict "disableKinds" "/configuration/all/#disableKinds") + (dict "disableHugoGeneratorInject" "/configuration/all/#disablehugogeneratorinject") + (dict "disableKinds" "/configuration/all/#disablekinds") (dict "disableLiveReload" "/configuration/all/#disablelivereload") (dict "disablePathToLower" "/configuration/all/#disablepathtolower") (dict "enableEmoji " "/configuration/all/#enableemoji") diff --git a/layouts/shortcodes/quick-reference.html b/layouts/_shortcodes/quick-reference.html similarity index 100% rename from layouts/shortcodes/quick-reference.html rename to layouts/_shortcodes/quick-reference.html diff --git a/layouts/shortcodes/root-configuration-keys.html b/layouts/_shortcodes/root-configuration-keys.html similarity index 100% rename from layouts/shortcodes/root-configuration-keys.html rename to layouts/_shortcodes/root-configuration-keys.html diff --git a/layouts/shortcodes/syntax-highlighting-styles.html b/layouts/_shortcodes/syntax-highlighting-styles.html similarity index 100% rename from layouts/shortcodes/syntax-highlighting-styles.html rename to layouts/_shortcodes/syntax-highlighting-styles.html diff --git a/layouts/_default/baseof.html b/layouts/baseof.html similarity index 98% rename from layouts/_default/baseof.html rename to layouts/baseof.html index 1f4952146..4c14a6b6d 100644 --- a/layouts/_default/baseof.html +++ b/layouts/baseof.html @@ -44,6 +44,8 @@ {{ block "header" . }} {{ partial "layouts/header/header.html" . }} {{ end }} + {{ block "subheader" . }} + {{ end }} {{ block "hero" . }} {{ end }}
diff --git a/layouts/index.headers b/layouts/home.headers similarity index 100% rename from layouts/index.headers rename to layouts/home.headers diff --git a/layouts/index.html b/layouts/home.html similarity index 100% rename from layouts/index.html rename to layouts/home.html diff --git a/layouts/index.redir b/layouts/home.redir similarity index 100% rename from layouts/index.redir rename to layouts/home.redir diff --git a/layouts/_default/list.html b/layouts/list.html similarity index 100% rename from layouts/_default/list.html rename to layouts/list.html diff --git a/layouts/_default/list.rss.xml b/layouts/list.rss.xml similarity index 100% rename from layouts/_default/list.rss.xml rename to layouts/list.rss.xml diff --git a/layouts/_default/single.html b/layouts/single.html similarity index 100% rename from layouts/_default/single.html rename to layouts/single.html diff --git a/netlify.toml b/netlify.toml index 67c146cad..c24a32a60 100644 --- a/netlify.toml +++ b/netlify.toml @@ -3,7 +3,7 @@ command = "hugo --gc --minify" [build.environment] - HUGO_VERSION = "0.145.0" + HUGO_VERSION = "0.146.7" [context.production.environment] HUGO_ENV = "production" diff --git a/package.hugo.json b/package.hugo.json new file mode 100644 index 000000000..24ffc7ff5 --- /dev/null +++ b/package.hugo.json @@ -0,0 +1,25 @@ +{ + "name": "hugoDocs", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "", + "devDependencies": { + "@awmottaz/prettier-plugin-void-html": "~1.8.0", + "@tailwindcss/cli": "~4.1.0", + "@tailwindcss/typography": "~0.5.16", + "prettier": "~3.5.3", + "prettier-plugin-go-template": "~0.0.15", + "tailwindcss": "~4.1.0" + }, + "dependencies": { + "@alpinejs/focus": "~3.14.9", + "@alpinejs/persist": "~3.14.9", + "@hotwired/turbo": "~8.0.13", + "alpinejs": "~3.14.9" + } +}