This commit is contained in:
Bjørn Erik Pedersen 2024-12-11 09:53:33 +01:00
commit b47376586a
No known key found for this signature in database
73 changed files with 705 additions and 163 deletions

View file

@ -22,8 +22,15 @@
{{ $releases = where $releases "draft" false }}
{{ $releases = where $releases "prerelease" false }}
{{ range $releases | first 20 }}
{{ $publishDate := .published_at | time.AsTime }}
{{/* Correct the v0.138.0 release date. See https://github.com/gohugoio/hugo/issues/13066. */}}
{{ if eq .name "v0.138.0" }}
{{ $publishDate = "2024-11-06T11:22:34Z" | time.AsTime }}
{{ end }}
{{ $ctx := dict
"Date" (.published_at | time.AsTime)
"Date" $publishDate
"Title" (printf "Release %s" .name)
"Permalink" .html_url
"Section" "news"

View file

@ -21,14 +21,21 @@
{{- $releases = where $releases "draft" false }}
{{- $releases = where $releases "prerelease" false }}
{{- range $releases | first 20 }}
{{- $publishDate := .published_at | time.AsTime }}
{{- /* Correct the v0.138.0 release date. See https://github.com/gohugoio/hugo/issues/13066. */}}
{{- if eq .name "v0.138.0" }}
{{- $publishDate = "2024-11-06T11:22:34Z" | time.AsTime }}
{{- end }}
{{- $summary := printf
"Hugo %s was released on %s. See [release notes](%s) for details."
.tag_name
(.published_at | time.AsTime | time.Format "2 Jan 2006")
($publishDate | time.AsTime | time.Format "2 Jan 2006")
.html_url
}}
{{- $ctx := dict
"PublishDate" (.published_at | time.AsTime)
"PublishDate" $publishDate
"Title" (printf "Release %s" .name)
"Permalink" .html_url
"Section" "news"

View file

@ -16,7 +16,7 @@
<h2>{{ $heading }}</h2>
<ul>
{{- range . }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
<li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
{{- end }}
</ul>
{{- end }}

View file

@ -1 +1,2 @@
# github.com/gohugoio/gohugoioTheme v0.0.0-20241105120803-6c6e5fb8f8af
# github.com/gohugoio/gohugoioTheme v0.0.0-20241119115653-b92d27ede3e1

View file

@ -1,5 +1,5 @@
---
# Do not remove front matter.
_comment: Do not remove front matter.
---
| Kind | Description | Example |

View file

@ -52,7 +52,7 @@ Hugo does not provide a built-in template for Mermaid diagrams. Create your own
{{< code file=layouts/_default/_markup/render-codeblock-mermaid.html >}}
<pre class="mermaid">
{{- .Inner | safeHTML }}
{{- .Inner | htmlEscape | safeHTML }}
</pre>
{{ .Page.Store.Set "hasMermaid" true }}
{{< /code >}}

View file

@ -37,7 +37,9 @@ Please follow these guidelines:
### Style
Although we do not strictly adhere to the [Microsoft Writing Style Guide], it is an excellent resource for questions related to style, grammar, and voice.
Please adhere to Google's [developer documentation style guide].
[developer documentation style guide]: https://developers.google.com/style
#### Terminology

View file

@ -1,5 +1,5 @@
---
# Do not remove front matter.
_comment: Do not remove front matter.
---
Path|Pattern|Match

View file

@ -1,5 +1,5 @@
---
# Do not remove front matter.
_comment: Do not remove front matter.
---
Hugo uses Go's [text/template] and [html/template] packages.

View file

@ -1,5 +1,5 @@
---
# Do not remove front matter.
_comment: Do not remove front matter.
---
{{% note %}}

View file

@ -1,5 +1,5 @@
---
# Do not remove front matter.
_comment: Do not remove front matter.
---
When specifying the regular expression, use a raw [string literal] (backticks) instead of an interpreted string literal (double quotes) to simplify the syntax. With an interpreted string literal you must escape backslashes.

View file

@ -1,5 +1,5 @@
---
# Do not remove front matter.
_comment: Do not remove front matter.
---
Format a `time.Time` value based on [Go's reference time]:

View file

@ -124,6 +124,6 @@ module.exports = {
```
[node.js]: https://nodejs.org/en/download
[postcss plugins]: https://www.postcss.parts/
[postcss plugins]: https://postcss.org/docs/postcss-plugins
[supported file name]: https://github.com/postcss/postcss-load-config#usage
[transpile to CSS]: /functions/css/sass/

View file

@ -1,5 +1,5 @@
---
# Do not remove front matter.
_comment: Do not remove front matter.
---
The documentation for Go's [fmt] package describes the structure and content of the format string.

View file

@ -1,5 +1,5 @@
---
# Do not remove front matter.
_comment: Do not remove front matter.
---
See Go's [text/template] documentation for more information.

View file

@ -1,5 +1,5 @@
---
# Do not remove front matter.
_comment: Do not remove front matter.
---
The falsy values are `false`, `0`, any `nil` pointer or interface value, any array, slice, map, or string of length zero, and zero `time.Time` values.

View file

@ -0,0 +1,125 @@
---
title: hugo.Store
description: Returns a global, persistent "scratch pad" to store and manipulate data.
categories: []
keywords: []
action:
related:
- methods/page/store
- methods/site/store
- functions/collections/NewScratch
returnType: maps.Scratch
signatures: [hugo.Store]
toc: true
---
{{< new-in 0.139.0 >}}
The global `hugo.Store` function creates a persistent [scratch pad] to store and manipulate data. To create a locally scoped, use the [`newScratch`] function.
[`Scratch`]: /functions/hugo/scratch/
[`newScratch`]: /functions/collections/newscratch/
[scratch pad]: /getting-started/glossary/#scratch-pad
## Methods
###### Set
Sets the value of a given key.
```go-html-template
{{ hugo.Store.Set "greeting" "Hello" }}
```
###### Get
Gets the value of a given key.
```go-html-template
{{ hugo.Store.Set "greeting" "Hello" }}
{{ hugo.Store.Get "greeting" }} → Hello
```
###### Add
Adds a given value to existing value(s) of the given key.
For single values, `Add` accepts values that support Go's `+` operator. If the first `Add` for a key is an array or slice, the following adds will be appended to that list.
```go-html-template
{{ hugo.Store.Set "greeting" "Hello" }}
{{ hugo.Store.Add "greeting" "Welcome" }}
{{ hugo.Store.Get "greeting" }} → HelloWelcome
```
```go-html-template
{{ hugo.Store.Set "total" 3 }}
{{ hugo.Store.Add "total" 7 }}
{{ hugo.Store.Get "total" }} → 10
```
```go-html-template
{{ hugo.Store.Set "greetings" (slice "Hello") }}
{{ hugo.Store.Add "greetings" (slice "Welcome" "Cheers") }}
{{ hugo.Store.Get "greetings" }} → [Hello Welcome Cheers]
```
###### SetInMap
Takes a `key`, `mapKey` and `value` and adds a map of `mapKey` and `value` to the given `key`.
```go-html-template
{{ hugo.Store.SetInMap "greetings" "english" "Hello" }}
{{ hugo.Store.SetInMap "greetings" "french" "Bonjour" }}
{{ hugo.Store.Get "greetings" }} → map[english:Hello french:Bonjour]
```
###### DeleteInMap
Takes a `key` and `mapKey` and removes the map of `mapKey` from the given `key`.
```go-html-template
{{ hugo.Store.SetInMap "greetings" "english" "Hello" }}
{{ hugo.Store.SetInMap "greetings" "french" "Bonjour" }}
{{ hugo.Store.DeleteInMap "greetings" "english" }}
{{ hugo.Store.Get "greetings" }} → map[french:Bonjour]
```
###### GetSortedMapValues
Returns an array of values from `key` sorted by `mapKey`.
```go-html-template
{{ hugo.Store.SetInMap "greetings" "english" "Hello" }}
{{ hugo.Store.SetInMap "greetings" "french" "Bonjour" }}
{{ hugo.Store.GetSortedMapValues "greetings" }} → [Hello Bonjour]
```
###### Delete
Removes the given key.
```go-html-template
{{ hugo.Store.Set "greeting" "Hello" }}
{{ hugo.Store.Delete "greeting" }}
```
## Determinate values
The `Store` method is often used to set scratch pad values within a shortcode, a partial template called by a shortcode, or by a Markdown render hook. In all three cases, the scratch pad values are indeterminate until Hugo renders the page content.
If you need to access a scratch pad value from a parent template, and the parent template has not yet rendered the page content, you can trigger content rendering by assigning the returned value to a [noop] variable:
[noop]: /getting-started/glossary/#noop
```go-html-template
{{ $noop := .Content }}
{{ hugo.Store.Get "mykey" }}
```
You can also trigger content rendering with the `ContentWithoutSummary`, `FuzzyWordCount`, `Len`, `Plain`, `PlainWords`, `ReadingTime`, `Summary`, `Truncated`, and `WordCount` methods. For example:
```go-html-template
{{ $noop := .WordCount }}
{{ hugo.Store.Get "mykey" }}
```

View file

@ -1,5 +1,5 @@
---
# Do not remove front matter.
_comment: Do not remove front matter.
---
Apply the filter using the [`images.Filter`] function:

View file

@ -1,5 +1,5 @@
---
# Do not remove front matter.
_comment: Do not remove front matter.
---
If you are a Windows user, and the path to your project contains a space, you must place the PostCSS configuration within the package.json file. See [this example] and issue [#7333].

View file

@ -1,5 +1,5 @@
---
# Do not remove front matter.
_comment: Do not remove front matter.
---
Format|Time zone

View file

@ -230,7 +230,7 @@ Let's add a `lang` attribute to the `title` nodes of our RSS feed, and a namespa
<language>en-US</language>
<atom:link href="https://example.org/books/index.xml" rel="self" type="application/rss+xml" />
<item>
<title lang="fr">The Hunchback of Notre Dame</title>
<title lang="en">The Hunchback of Notre Dame</title>
<description>Written by Victor Hugo</description>
<isbn:number>9780140443530</isbn:number>
<link>https://example.org/books/the-hunchback-of-notre-dame/</link>
@ -238,7 +238,7 @@ Let's add a `lang` attribute to the `title` nodes of our RSS feed, and a namespa
<guid>https://example.org/books/the-hunchback-of-notre-dame/</guid>
</item>
<item>
<title lang="en">Les Misérables</title>
<title lang="fr">Les Misérables</title>
<description>Written by Victor Hugo</description>
<isbn:number>9780451419439</isbn:number>
<link>https://example.org/books/les-miserables/</link>
@ -266,7 +266,7 @@ Each item node looks like this:
"pubDate": "Mon, 09 Oct 2023 09:27:12 -0700",
"title": {
"#text": "The Hunchback of Notre Dame",
"-lang": "fr"
"-lang": "en"
}
}
```
@ -290,8 +290,8 @@ Hugo renders this to:
```html
<ul>
<li>The Hunchback of Notre Dame (fr) 9780140443530</li>
<li>Les Misérables (en) 9780451419439</li>
<li>The Hunchback of Notre Dame (en) 9780140443530</li>
<li>Les Misérables (fr) 9780451419439</li>
</ul>
```

View file

@ -28,10 +28,10 @@ This controls the behavior of the `anchorize` function and the generation of hea
Set `autoHeadingIDType` to one of:
github
: Compatible with GitHub. This is the default, and strongly recommended.
: Compatible with GitHub. This is the default.
github-ascii
: Similar to the "github" setting, but removes non-ASCII characters.
: Similar to the `github` setting, but removes non-ASCII characters.
blackfriday
: Provided for backwards compatibility with Hugo v0.59.1 and earlier. This option will be removed in a future release.

View file

@ -1,5 +1,5 @@
---
# Do not remove front matter.
_comment: Do not remove front matter.
---
The [`anchorize`] and [`urlize`] functions are similar:

View file

@ -1,46 +0,0 @@
---
title: Host on AWS Amplify
description: Develop and deploy a cloud-powered web app with AWS Amplify.
categories: [hosting and deployment]
keywords: [hosting,amplify]
menu:
docs:
parent: hosting-and-deployment
toc: true
---
In this guide we'll walk through how to deploy and host your Hugo site using the [AWS Amplify Console](https://console.amplify.aws).
AWS Amplify is a combination of client library, CLI toolchain, and a Console for continuous deployment and hosting. The Amplify CLI and library allow developers to get up & running with full-stack cloud-powered applications with features like authentication, storage, serverless GraphQL or REST APIs, analytics, Lambda functions, & more. The Amplify Console provides continuous deployment and hosting for modern web apps (single page apps and static site generators). Continuous deployment allows developers to deploy updates to their web app on every code commit to their Git repository. Hosting includes features such as globally available CDNs, easy custom domain setup + HTTPS, feature branch deployments, and password protection.
## Pre-requisites
* [Sign up for an AWS Account](https://portal.aws.amazon.com/billing/signup?redirect_url=https%3A%2F%2Faws.amazon.com%2Fregistration-confirmation). There are no upfront charges or any term commitments to create an AWS account and signing up gives you immediate access to the AWS Free Tier.
* You have an account with GitHub, GitLab, or Bitbucket.
* You have completed the [Quick Start] or have a Hugo website you are ready to deploy and share with the world.
## Hosting
1. Log in to the [AWS Amplify Console](https://console.aws.amazon.com/amplify/home) and choose Get Started under Deploy.
![Hugo Amplify](/images/hosting-and-deployment/hosting-on-aws-amplify/amplify-gettingstarted.png)
1. Connect a branch from your GitHub, Bitbucket, GitLab, or AWS CodeCommit repository. Connecting your repository allows Amplify to deploy updates on every code commit to a branch.
![Hugo Amplify](/images/hosting-and-deployment/hosting-on-aws-amplify/amplify-connect-repo.gif)
1. Accept the default build settings. The Amplify Console automatically detects your Hugo build settings and output directory.
![Hugo Amplify](/images/hosting-and-deployment/hosting-on-aws-amplify/amplify-build-settings.png)
1. Review your changes and then choose **Save and deploy**. The Amplify Console will pull code from your repository, build changes to the backend and frontend, and deploy your build artifacts at `https://master.unique-id.amplifyapp.com`. Bonus: Screenshots of your app on different devices to find layout issues.
## Using a newer version of Hugo
If you need to use a different, perhaps newer, version of Hugo than the version currently supported by AWS Amplify:
1. Visit the [AWS Amplify Console](https://console.aws.amazon.com/amplify/home), and click the app you would like to modify
1. In the side navigation bar, Under App Settings, click **Build settings**
1. On the Build settings page, near the bottom, there is a section called **Build image settings**. Click **Edit**
1. Under **Live package updates**, click **Add package version override**
1. From the selection, click **Hugo** and ensure the version field says `latest`
1. Click **Save** to save the changes.
[Quick Start]: /getting-started/quick-start/

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

View file

@ -0,0 +1,151 @@
---
title: Host on AWS Amplify
description: Host your site on AWS Amplify with continuous deployment.
categories: [hosting and deployment]
keywords: [hosting]
menu:
docs:
parent: hosting-and-deployment
toc: true
---
## Prerequisites
Please complete the following tasks before continuing:
1. [Create an AWS account]
2. [Install Git]
3. [Create a Hugo site] and test it locally with `hugo server`
4. Commit the changes to your local repository
5. Push the local repository to your [GitHub], [GitLab], or [Bitbucket] account
[Bitbucket]: https://bitbucket.org/product
[Create a Hugo site]: /getting-started/quick-start/
[Create an AWS account]: https://aws.amazon.com/resources/create-account/
[GitHub]: https://github.com
[GitLab]: https://about.gitlab.com/
[Install Git]: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
## Procedure
This procedure will enable continuous deployment from a GitHub repository. The procedure is essentially the same if you are using GitLab or Bitbucket.
Step 1
: Create a file named `amplify.yml` in the root of your project.
```sh
touch amplify.yml
```
Step 2
: Copy and paste the YAML below into the file you created. Change the application versions and time zone as needed.
{{< code file=amplify.yml copy=true >}}
version: 1
env:
variables:
# Application versions
DART_SASS_VERSION: 1.81.0
GO_VERSION: 1.23.3
HUGO_VERSION: 0.139.3
# Time zone
TZ: America/Los_Angeles
# Cache
HUGO_CACHEDIR: ${PWD}/.hugo
NPM_CONFIG_CACHE: ${PWD}/.npm
frontend:
phases:
preBuild:
commands:
# Install Dart Sass
- curl -LJO https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz
- sudo tar -C /usr/local/bin -xf dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz
- rm dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz
- export PATH=/usr/local/bin/dart-sass:$PATH
# Install Go
- curl -LJO https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz
- sudo tar -C /usr/local -xf go${GO_VERSION}.linux-amd64.tar.gz
- rm go${GO_VERSION}.linux-amd64.tar.gz
- export PATH=/usr/local/go/bin:$PATH
# Install Hugo
- curl -LJO https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz
- sudo tar -C /usr/local/bin -xf hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz
- rm hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz
- export PATH=/usr/local/bin:$PATH
# Check installed versions
- go version
- hugo version
- node -v
- npm -v
- sass --embedded --version
# Install Node.JS dependencies
- "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci --prefer-offline || true"
# https://github.com/gohugoio/hugo/issues/9810
- git config --add core.quotepath false
build:
commands:
- hugo --gc --minify
artifacts:
baseDirectory: public
files:
- '**/*'
cache:
paths:
- ${HUGO_CACHEDIR}/**/*
- ${NPM_CONFIG_CACHE}/**/*
{{< /code >}}
Step 3
: Commit and push the change to your GitHub repository.
```sh
git add -A
git commit -m "Create amplify.yml"
git push
```
Step 4
: Log in to your AWS account, navigate to the [Amplify Console], then press the **Deploy an app** button.
[Amplify Console]: https://console.aws.amazon.com/amplify/apps
Step 5
: Choose a source code provider, then press the **Next** button.
![screen capture](amplify-step-05.png)
Step 6
: Authorize AWS Amplify to access your GitHub account.
![screen capture](amplify-step-06.png)
Step 7
: Select your personal account or relevant organization.
![screen capture](amplify-step-07.png)
Step 8
: Authorize access to one or more repositories.
![screen capture](amplify-step-08.png)
Step 9
: Select a repository and branch, then press the **Next** button.
![screen capture](amplify-step-09.png)
Step 10
: On the "App settings" page, scroll to the bottom then press the **Next** button. Amplify reads the `amplify.yml` file you created in Steps 1-3 instead of using the values on this page.
Step 11
: On the "Review" page, scroll to the bottom then press the **Save and deploy** button.
Step 12
: When your site has finished deploying, press the **Visit deployed URL** button to view your published site.
![screen capture](amplify-step-11.png)

View file

@ -12,6 +12,8 @@ aliases: [/tutorials/github-pages-blog/]
## Prerequisites
Please complete the following tasks before continuing:
1. [Create a GitHub account]
2. [Install Git]
3. [Create a Hugo site] and test it locally with `hugo server`.
@ -53,10 +55,11 @@ Step 4
{style="max-width: 280px"}
Step 5
: Create an empty file in your local repository.
: Create a file named `hugo.yaml` in a directory named `.github/workflows`.
```text
.github/workflows/hugo.yaml
mkdir -p .github/workflows
touch hugo.yaml
```
Step 6
@ -144,7 +147,13 @@ jobs:
{{< /code >}}
Step 7
: Commit the change to your local repository with a commit message of something like "Add workflow", and push to GitHub.
: Commit and push the change to your GitHub repository.
```sh
git add -A
git commit -m "Create hugo.yaml"
git push
```
Step 8
: From GitHub's main menu, choose **Actions**. You will see something like this:
@ -181,7 +190,7 @@ You may remove this step if your site, themes, and modules do not transpile Sass
[Dart Sass]: /hugo-pipes/transpile-sass-to-css/#dart-sass
## Additional resources
## Other resources
- [Learn more about GitHub Actions](https://docs.github.com/en/actions)
- [Caching dependencies to speed up workflows](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows)

View file

@ -11,11 +11,13 @@ toc: true
## Prerequisites
Please complete the following tasks before continuing:
1. [Create a Netlify account]
2. [Install Git]
3. [Create a Hugo site] and test it locally with `hugo server`
4. Commit the changes to your local repository
4. Push the local repository to your [GitHub], [GitLab], or [Bitbucket] account
5. Push the local repository to your [GitHub], [GitLab], or [Bitbucket] account
[Bitbucket]: https://bitbucket.org/product
[Create a Hugo site]: /getting-started/quick-start/
@ -34,64 +36,64 @@ Step 1
Step 2
: Select your deployment method.
![screen capture](netlify-step-02.png)
![screen capture](netlify-step-02.png)
Step 3
: Authorize Netlify to connect with your GitHub account by pressing the **Authorize Netlify** button.
![screen capture](netlify-step-03.png)
![screen capture](netlify-step-03.png)
Step 4
: Press the **Configure Netlify on GitHub** button.
![screen capture](netlify-step-04.png)
![screen capture](netlify-step-04.png)
Step 5
: Install the Netlify app by selecting your GitHub account.
![screen capture](netlify-step-05.png)
![screen capture](netlify-step-05.png)
Step 6
: Press the **Install** button.
![screen capture](netlify-step-06.png)
![screen capture](netlify-step-06.png)
Step 7
: Click on the site's repository from the list.
![screen capture](netlify-step-07.png)
![screen capture](netlify-step-07.png)
Step 8
: Set the site name and branch from which to deploy.
![screen capture](netlify-step-08.png)
![screen capture](netlify-step-08.png)
Step 9
: Define the build settings, press the **Add environment variables** button, then press the **New variable** button.
![screen capture](netlify-step-09.png)
![screen capture](netlify-step-09.png)
Step 10
: Create a new environment variable named `HUGO_VERSION` and set the value to the [latest version].
[latest version]: https://github.com/gohugoio/hugo/releases/latest
![screen capture](netlify-step-10.png)
![screen capture](netlify-step-10.png)
Step 11
: Press the "Deploy my new site" button at the bottom of the page.
![screen capture](netlify-step-11.png)
![screen capture](netlify-step-11.png)
Step 12
: At the bottom of the screen, wait for the deploy to complete, then click on the deploy log entry.
![screen capture](netlify-step-12.png)
![screen capture](netlify-step-12.png)
Step 13
: Press the **Open production deploy** button to view the live site.
![screen capture](netlify-step-13.png)
![screen capture](netlify-step-13.png)
## Configuration file

View file

@ -133,8 +133,6 @@ Also see the [CLI Doc](/commands/hugo_mod_clean/).
## Module workspaces
{{< new-in 0.109.0 >}}
Workspace support was added in [Go 1.18](https://go.dev/blog/get-familiar-with-workspaces) and Hugo got solid support for it in the `v0.109.0` version.
A common use case for a workspace is to simplify local development of a site with its theme modules.

View file

@ -88,7 +88,7 @@ HUGO_ENVIRONMENT
: The value e.g. set with `hugo -e production` (defaults to `production` for `hugo` and `development` for `hugo server`).
HUGO_PUBLISHDIR
: {{< new-in 0.109.0 >}} The absolute path to the publish directory (the `public` directory). Note that the value will always point to a directory on disk even when running `hugo server` in memory mode. If you write to this folder from PostCSS when running the server, you could run the server with one of these flags:
: The absolute path to the publish directory (the `public` directory). Note that the value will always point to a directory on disk even when running `hugo server` in memory mode. If you write to this folder from PostCSS when running the server, you could run the server with one of these flags:
```sh
hugo server --renderToDisk

View file

@ -42,7 +42,7 @@ transpiler
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 {{< new-in 0.109.0 >}}
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

View file

@ -1,5 +1,5 @@
---
# Do not remove front matter.
_comment: Do not remove front matter.
---
Hugo is available in three editions: standard, extended, and extended/deploy. While the standard edition provides core functionality, the extended and extended/deploy editions offer advanced features.

View file

@ -1,5 +1,5 @@
---
# Do not remove front matter.
_comment: Do not remove front matter.
---
## Prerequisites

View file

@ -1,5 +1,5 @@
---
# Do not remove front matter.
_comment: Do not remove front matter.
---
## Prebuilt binaries

View file

@ -1,5 +1,5 @@
---
# Do not remove front matter.
_comment: Do not remove front matter.
---
## Build from source

View file

@ -1,5 +1,5 @@
---
# Do not remove front matter.
_comment: Do not remove front matter.
---
### Homebrew

View file

@ -192,6 +192,16 @@ sudo eopkg install hugo
[Solus]: https://getsol.us/
### Void Linux
To install the extended edition of Hugo on [Void Linux]:
```sh
sudo xbps-install -S hugo
```
[Void Linux]: https://voidlinux.org/
{{% include "installation/_common/04-build-from-source.md" %}}
## Comparison

View file

@ -0,0 +1,120 @@
---
title: PageRef
description: Returns the `pageRef` property of the given menu entry.
categories: []
keywords: []
action:
related:
- /methods/menu-entry/URL
returnType: string
signatures: [MENUENTRY.PageRef]
toc: true
---
The use case for this method is rare.
In almost also scenarios you should use the [`URL`] method instead.
## Explanation
If you specify a `pageRef` property when [defining a menu entry] in your site configuration, Hugo looks for a matching page when rendering the entry.
If a matching page is found:
- The [`URL`] method returns the page's relative permalink
- The [`Page`] method returns the corresponding `Page` object
- The [`HasMenuCurrent`] and [`IsMenuCurrent`] methods on a `Page` object return the expected values
If a matching page is not found:
- The [`URL`] method returns the entry's `url` property if set, else an empty string
- The [`Page`] method returns nil
- The [`HasMenuCurrent`] and [`IsMenuCurrent`] methods on a `Page` object return `false`
{{% note %}}
In almost also scenarios you should use the [`URL`] method instead.
[`URL`]: /methods/menu-entry/url/
{{% /note %}}
[defining a menu entry]: /content-management/menus/#define-in-site-configuration
[`Page`]: /methods/menu-entry/page/
[`URL`]: /methods/menu-entry/url/
[`IsMenuCurrent`]: /methods/page/ismenucurrent/
[`HasMenuCurrent`]: /methods/page/hasmenucurrent/
[`RelPermalink`]: /methods/page/relpermalink/
## Example
This example is contrived.
{{% note %}}
In almost also scenarios you should use the [`URL`] method instead.
[`URL`]: /methods/menu-entry/url/
{{% /note %}}
Consider this content structure:
```text
content/
├── products.md
└── _index.md
```
And this menu definition:
{{< code-toggle file=hugo >}}
[[menus.main]]
name = 'Products'
pageRef = '/products'
weight = 10
[[menus.main]]
name = 'Services'
pageRef = '/services'
weight = 20
{{< /code-toggle >}}
With this template code:
{{< code file=layouts/partials/menu.html >}}
<ul>
{{ range .Site.Menus.main }}
<li><a href="{{ .URL }}">{{ .Name }}</a></li>
{{ end }}
</ul>
{{< /code >}}
Hugo render this HTML:
```html
<ul>
<li><a href="/products/">Products</a></li>
<li><a href="">Services</a></li>
</ul>
```
In the above note that the `href` attribute of the second `anchor` element is blank because Hugo was unable to find the "services" page.
With this template code:
{{< code file=layouts/partials/menu.html >}}
<ul>
{{ range .Site.Menus.main }}
<li><a href="{{ or .URL .PageRef }}">{{ .Name }}</a></li>
{{ end }}
</ul>
{{< /code >}}
Hugo renders this HTML:
```html
<ul>
<li><a href="/products/">Products</a></li>
<li><a href="/services">Services</a></li>
</ul>
```
In the above note that Hugo populates the `href` attribute of the second `anchor` element with the `pageRef` property as defined in the site configuration because the template code falls back to the `PageRef` method.

View file

@ -1,5 +1,5 @@
---
# Do not remove front matter.
_comment: Do not remove front matter.
---
In this site configuration we enable rendering of [emoji shortcodes], and add emoji shortcodes before (pre) and after (post) each menu entry:

View file

@ -16,8 +16,6 @@ action:
signatures: [PAGE.Ancestors]
---
{{< new-in 0.109.0 >}}
{{% include "methods/page/_common/definition-of-section.md" %}}
With this content structure:

View file

@ -141,6 +141,7 @@ Some providers perform deep clones by default, others allow you to configure the
Hosting service | Default clone depth | Configurable
:-- | :-- | :--
AWS Amplify | Deep | N/A
Cloudflare Pages | Shallow | Yes [^CFP]
DigitalOcean App Platform | Deep | N/A
GitHub Pages | Shallow | Yes [^GHP]

View file

@ -28,4 +28,8 @@ If the `Page` object associated with the menu entry is a section, this method al
See [menu templates] for a complete example.
{{% note %}}
When using this method you must either define the menu entry in front matter, or specify a `pageRef` property when defining the menu entry in your site configuration.
{{% /note %}}
[menu templates]: /templates/menu/#example

View file

@ -26,4 +26,8 @@ aliases: [/functions/ismenucurrent]
See [menu templates] for a complete example.
{{% note %}}
When using this method you must either define the menu entry in front matter, or specify a `pageRef` property when defining the menu entry in your site configuration.
{{% /note %}}
[menu templates]: /templates/menu/#example

View file

@ -1,11 +1,14 @@
---
title: Store
linktitle: PAGE.Store
description: Returns a persistent "scratch pad" on the given page to store and manipulate data.
categories: []
keywords: []
action:
related:
- methods/page/scratch
- methods/site/store
- functions/hugo/store
- functions/collections/NewScratch
returnType: maps.Scratch
signatures: [PAGE.Store]

View file

@ -1,5 +1,5 @@
---
# Do not remove front matter.
_comment: Do not remove front matter.
---
A _section_ is a top-level content directory, or any content directory with an&nbsp;_index.md&nbsp;file.

View file

@ -1,5 +1,5 @@
---
# Do not remove front matter.
_comment: Do not remove front matter.
---
Hugo determines the _next_ and _previous_ page by sorting the site's collection of regular pages according to this sorting hierarchy:

View file

@ -1,5 +1,5 @@
---
# Do not remove front matter.
_comment: Do not remove front matter.
---
Hugo determines the _next_ and _previous_ page by sorting the current section's regular pages according to this sorting hierarchy:

View file

@ -1,5 +1,5 @@
---
# Do not remove front matter.
_comment: Do not remove front matter.
---
Hugo generates one or more files per page when building a site. For example, when rendering home, [section], [taxonomy], and [term] pages, Hugo generates an HTML file and an RSS file. Both HTML and RSS are built-in _output formats_. Create multiple output formats, and control generation based on [page kind], or by enabling one or more output formats for one or more pages. See&nbsp;[details].

View file

@ -1,5 +1,5 @@
---
# Do not remove front matter.
_comment: Do not remove front matter.
---
Get IDENTIFIER

View file

@ -1,5 +1,5 @@
---
# Do not remove front matter.
_comment: Do not remove front matter.
---
## Methods

View file

@ -1,5 +1,5 @@
---
# Do not remove front matter.
_comment: Do not remove front matter.
---
For the optional sort order, specify either `asc` for ascending order, or `desc` for descending order.

View file

@ -1,5 +1,5 @@
---
# Do not remove front matter.
_comment: Do not remove front matter.
---
Hugo determines the _next_ and _previous_ page by sorting the page collection according to this sorting hierarchy:

View file

@ -1,5 +1,5 @@
---
# Do not remove front matter.
_comment: Do not remove front matter.
---
{{% note %}}

View file

@ -1,5 +1,5 @@
---
# Do not remove front matter.
_comment: Do not remove front matter.
---
## Process specification

View file

@ -11,6 +11,10 @@ action:
The `Ordinal` method returns the zero-based ordinal of the shortcode in relation to its parent. If the parent is the page itself, the ordinal represents the position of this shortcode in the page content.
{{% note %}}
Hugo increments the ordinal with each shortcode call, regardless of the specific shortcode type. This means that the ordinal value is tracked sequentially across all shortcodes within a given page.
{{% /note %}}
This method is useful for, among other things, assigning unique element IDs when a shortcode is called two or more times from the same page. For example:
{{< code file=content/about.md lang=md >}}

View file

@ -10,7 +10,17 @@ action:
signatures: [SHORTCODE.Scratch]
---
The `Scratch` method within a shortcode creates a [scratch pad] to store and manipulate data. The scratch pad is scoped to the shortcode, and is reset on server rebuilds.
{{% deprecated-in 0.139.0 %}}
Use the [`SHORTCODE.Store`] method instead.
This is a soft deprecation. This method will be removed in a future release, but the removal date has not been established. Although Hugo will not emit a warning if you continue to use this method, you should begin using `SHORTCODE.Store` as soon as possible.
Beginning with v0.139.0 the `SHORTCODE.Scratch` method is aliased to `SHORTCODE.Store`.
[`SHORTCODE.Store`]: /methods/shortcode/store/
{{% /deprecated-in %}}
The `Scratch` method within a shortcode creates a [scratch pad] to store and manipulate data. The scratch pad is scoped to the shortcode.
{{% note %}}
With the introduction of the [`newScratch`] function, and the ability to [assign values to template variables] after initialization, the `Scratch` method within a shortcode is obsolete.

View file

@ -0,0 +1,29 @@
---
title: Store
description: Returns a "Store pad" scoped to the shortcode to store and manipulate data.
categories: []
keywords: []
action:
related:
- functions/collections/NewScratch
- methods/page/Store
- methods/site/Store
- functions/hugo/Store
returnType: maps.Store
signatures: [SHORTCODE.Store]
---
{{< new-in 0.139.0 >}}
The `Store` method within a shortcode creates a [scratch pad] to store and manipulate data. The scratch pad is scoped to the shortcode.
{{% note %}}
With the introduction of the [`newScratch`] function, and the ability to [assign values to template variables] after initialization, the `Store` method within a shortcode is mostly obsolete.
[assign values to template variables]: https://go.dev/doc/go1.11#text/template
[`newScratch`]: /functions/collections/newScratch/
{{% /note %}}
[Store pad]: /getting-started/glossary/#scratch-pad
{{% include "methods/page/_common/scratch-methods.md" %}}

View file

@ -0,0 +1,126 @@
---
title: Store
linktitle: site.Store
description: Returns a persistent "scratch pad" on the given site to store and manipulate data.
categories: []
keywords: []
action:
related:
- methods/page/store
- functions/hugo/store
- functions/collections/NewScratch
returnType: maps.Scratch
signatures: [site.Store]
toc: true
---
{{< new-in 0.139.0 >}}
The `Store` method on a `Site` object creates a persistent [scratch pad] to store and manipulate data. To create a locally scoped scratch pad that is not attached to a `Site` object, use the [`newScratch`] function.
[`Scratch`]: /methods/site/scratch/
[`newScratch`]: /functions/collections/newscratch/
[scratch pad]: /getting-started/glossary/#scratch-pad
## Methods
###### Set
Sets the value of a given key.
```go-html-template
{{ site.Store.Set "greeting" "Hello" }}
```
###### Get
Gets the value of a given key.
```go-html-template
{{ site.Store.Set "greeting" "Hello" }}
{{ site.Store.Get "greeting" }} → Hello
```
###### Add
Adds a given value to existing value(s) of the given key.
For single values, `Add` accepts values that support Go's `+` operator. If the first `Add` for a key is an array or slice, the following adds will be appended to that list.
```go-html-template
{{ site.Store.Set "greeting" "Hello" }}
{{ site.Store.Add "greeting" "Welcome" }}
{{ site.Store.Get "greeting" }} → HelloWelcome
```
```go-html-template
{{ site.Store.Set "total" 3 }}
{{ site.Store.Add "total" 7 }}
{{ site.Store.Get "total" }} → 10
```
```go-html-template
{{ site.Store.Set "greetings" (slice "Hello") }}
{{ site.Store.Add "greetings" (slice "Welcome" "Cheers") }}
{{ site.Store.Get "greetings" }} → [Hello Welcome Cheers]
```
###### SetInMap
Takes a `key`, `mapKey` and `value` and adds a map of `mapKey` and `value` to the given `key`.
```go-html-template
{{ site.Store.SetInMap "greetings" "english" "Hello" }}
{{ site.Store.SetInMap "greetings" "french" "Bonjour" }}
{{ site.Store.Get "greetings" }} → map[english:Hello french:Bonjour]
```
###### DeleteInMap
Takes a `key` and `mapKey` and removes the map of `mapKey` from the given `key`.
```go-html-template
{{ site.Store.SetInMap "greetings" "english" "Hello" }}
{{ site.Store.SetInMap "greetings" "french" "Bonjour" }}
{{ site.Store.DeleteInMap "greetings" "english" }}
{{ site.Store.Get "greetings" }} → map[french:Bonjour]
```
###### GetSortedMapValues
Returns an array of values from `key` sorted by `mapKey`.
```go-html-template
{{ site.Store.SetInMap "greetings" "english" "Hello" }}
{{ site.Store.SetInMap "greetings" "french" "Bonjour" }}
{{ site.Store.GetSortedMapValues "greetings" }} → [Hello Bonjour]
```
###### Delete
Removes the given key.
```go-html-template
{{ site.Store.Set "greeting" "Hello" }}
{{ site.Store.Delete "greeting" }}
```
## Determinate values
The `Store` method is often used to set scratch pad values within a shortcode, a partial template called by a shortcode, or by a Markdown render hook. In all three cases, the scratch pad values are indeterminate until Hugo renders the page content.
If you need to access a scratch pad value from a parent template, and the parent template has not yet rendered the page content, you can trigger content rendering by assigning the returned value to a [noop] variable:
[noop]: /getting-started/glossary/#noop
```go-html-template
{{ $noop := .Content }}
{{ site.Store.Get "mykey" }}
```
You can also trigger content rendering with the `ContentWithoutSummary`, `FuzzyWordCount`, `Len`, `Plain`, `PlainWords`, `ReadingTime`, `Summary`, `Truncated`, and `WordCount` methods. For example:
```go-html-template
{{ $noop := .WordCount }}
{{ site.Store.Get "mykey" }}
```

View file

@ -1,5 +1,5 @@
---
# Do not remove front matter.
_comment: Do not remove front matter.
---
Before we can use a `Taxonomy` method, we need to capture a `Taxonomy` object.

View file

@ -1,5 +1,5 @@
---
# Do not remove front matter.
_comment: Do not remove front matter.
---
An ordered taxonomy is a slice, where each element is an object that contains the term and a slice of its weighted pages.

View file

@ -1,5 +1,5 @@
---
# Do not remove front matter.
_comment: Do not remove front matter.
---
## PageInner details

View file

@ -122,7 +122,7 @@ For example, to create a code block render hook to render [Mermaid] diagrams:
{{< code file=layouts/_default/_markup/render-codeblock-mermaid.html copy=true >}}
<pre class="mermaid">
{{- .Inner | safeHTML }}
{{- .Inner | htmlEscape | safeHTML }}
</pre>
{{ .Page.Store.Set "hasMermaid" true }}
{{< /code >}}

View file

@ -1,5 +1,5 @@
---
# Do not remove front matter.
_comment: Do not remove front matter.
---
{{% note %}}

View file

@ -167,7 +167,7 @@ Whitespace includes spaces, horizontal tabs, carriage returns, and newlines.
### Pipes
Within a template action you may [pipe] a value to function or method. The piped value becomes the final argument to the function or method. For example, these are equivalent:
Within a template action you may [pipe] a value to a function or method. The piped value becomes the final argument to the function or method. For example, these are equivalent:
[pipe]: /getting-started/glossary/#pipeline

View file

@ -2440,17 +2440,6 @@ tpl:
treating values as key-value pairs. The number of values must be even.
The keys can be string slices, which will create the needed nested structure.
Examples: []
EchoParam:
Aliases:
- echoParam
Args:
- c
- k
Description: |-
EchoParam returns the value in the collection c with key k if is set; otherwise, it returns an
empty string.
Deprecated: Use the index function instead.
Examples: []
First:
Aliases:
- first
@ -3119,6 +3108,11 @@ tpl:
Args: null
Description: ""
Examples: null
Store:
Aliases: null
Args: null
Description: ""
Examples: null
Version:
Aliases: null
Args: null
@ -3384,11 +3378,6 @@ tpl:
Args: null
Description: ""
Examples: null
NumFmt:
Aliases: null
Args: null
Description: ""
Examples: null
Translate:
Aliases:
- i18n
@ -4002,11 +3991,6 @@ tpl:
Args: null
Description: ""
Examples: null
DisqusShortname:
Aliases: null
Args: null
Description: ""
Examples: null
ForEeachIdentityByName:
Aliases: null
Args: null
@ -4017,11 +4001,6 @@ tpl:
Args: null
Description: ""
Examples: null
GoogleAnalytics:
Aliases: null
Args: null
Description: ""
Examples: null
Home:
Aliases: null
Args: null
@ -4037,11 +4016,6 @@ tpl:
Args: null
Description: ""
Examples: null
IsServer:
Aliases: null
Args: null
Description: ""
Examples: null
Key:
Aliases: null
Args: null
@ -4102,11 +4076,6 @@ tpl:
Args: null
Description: ""
Examples: null
RSSLink:
Aliases: null
Args: null
Description: ""
Examples: null
RegularPages:
Aliases: null
Args: null
@ -4132,6 +4101,11 @@ tpl:
Args: null
Description: ""
Examples: null
Store:
Aliases: null
Args: null
Description: ""
Examples: null
Taxonomies:
Aliases: null
Args: null
@ -4457,6 +4431,11 @@ tpl:
Examples:
- - '{{ "aabbaa" | strings.TrimRight "a" }}'
- aabb
TrimSpace:
Aliases: null
Args: null
Description: ""
Examples: null
TrimSuffix:
Aliases: null
Args:

View file

@ -1,5 +1,5 @@
module github.com/gohugoio/hugoDocs
go 1.16
go 1.22.0
require github.com/gohugoio/gohugoioTheme v0.0.0-20241105120803-6c6e5fb8f8af // indirect
require github.com/gohugoio/gohugoioTheme v0.0.0-20241119115653-b92d27ede3e1 // indirect

View file

@ -1,4 +1,2 @@
github.com/gohugoio/gohugoioTheme v0.0.0-20241105040910-e9dac9458255 h1:kaSc7cVAifWPRzmECr7il0YXgXBM+H2ZrGcNnb03S8k=
github.com/gohugoio/gohugoioTheme v0.0.0-20241105040910-e9dac9458255/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM=
github.com/gohugoio/gohugoioTheme v0.0.0-20241105120803-6c6e5fb8f8af h1:H8Oa4AEJs2yz8w1Gq9hEGBJNukkKo05OAaIEsHMd63k=
github.com/gohugoio/gohugoioTheme v0.0.0-20241105120803-6c6e5fb8f8af/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM=
github.com/gohugoio/gohugoioTheme v0.0.0-20241119115653-b92d27ede3e1 h1:d6XNQ4QYvJGIE8vMejUFTD89AWaPDywcLivzWpEU0qE=
github.com/gohugoio/gohugoioTheme v0.0.0-20241119115653-b92d27ede3e1/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM=

View file

@ -3,7 +3,7 @@
command = "hugo --gc --minify"
[build.environment]
HUGO_VERSION = "0.138.0"
HUGO_VERSION = "0.139.4"
[context.production.environment]
HUGO_ENV = "production"