8390a4a3a Add Void Linux installation instructions d6099aae8 Update link to PostCSS plugins 25dad4693 netlify: Hugo 0.139.4 2b1fa118c Fix typo 3ef1eb505 Update hosting-on-aws-amplify c0f6d35d6 Fix typo aa54d4301 Correct directory name 98aa26bdb Improve instructions for hosting with AWS Amplify a07638a80 Add new-in badges 6ad018055 netlify: Hugo 0.139.3 1050835d6 Update title of hugo.Store page ebbd2e851 Clarify the shortcode Ordinal method b7716ed95 Revise code block render hook for Mermaid diagrams f1da9b6ea netlify: Hugo 0.139.2 d8ac9f428 Downgrade the Go toolchain in go.mod to a slightly older Go version 254b3c4f2 netlify: Hugo 0.139.1 03e666038 Add hugo.Store, site.Store and Shortcode.Store 157e8983b Update Anchorize.md 59fa9f214 Document the PageRef menu entry method bda544cce docs(transform.Unmarshal): match lang attribute to title language in examples 1985886bd Adjust front matter of shared Markdown snippets da5bd70d1 Fix typo 431b65d6b Update theme b63ef69f5 Update style guidance d50ed3422 Remove old new-in badges 12bfb9933 Update docs.yaml 0b936cacd netlify: Hugo 0.139.0 ab7668b4d dartsass: Add silenceDeprecations option 154df9bfc Merge commit '838bd312b1a287bb33962ad478dbc54737654f35' efa80477c docs: Regen CLI docs ad99e4a7a docs: Regenerate CLI docs
-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].
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.
+: (`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
The extended version of Hugo includes [LibSass] to transpile Sass to CSS. In 2020, the Sass team deprecated LibSass in favor of [Dart Sass].
+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.
+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.
+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:
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].
-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.
-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.
-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`
new file mode 100644 (file)
index 0000000..bb98d97
Binary files /dev/null and b/content/en/hosting-and-deployment/hosting-on-aws-amplify/amplify-step-05.png differ
new file mode 100644 (file)
index 0000000..2e9b96e
Binary files /dev/null and b/content/en/hosting-and-deployment/hosting-on-aws-amplify/amplify-step-06.png differ
new file mode 100644 (file)
index 0000000..b326015
Binary files /dev/null and b/content/en/hosting-and-deployment/hosting-on-aws-amplify/amplify-step-07.png differ
new file mode 100644 (file)
index 0000000..55e80e7
Binary files /dev/null and b/content/en/hosting-and-deployment/hosting-on-aws-amplify/amplify-step-08.png differ
new file mode 100644 (file)
index 0000000..b422e3a
Binary files /dev/null and b/content/en/hosting-and-deployment/hosting-on-aws-amplify/amplify-step-09.png differ
new file mode 100644 (file)
index 0000000..e147edf
Binary files /dev/null and b/content/en/hosting-and-deployment/hosting-on-aws-amplify/amplify-step-11.png differ
+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.
+: Choose a source code provider, then press the **Next** button.
+
+ 
+
+Step 6
+: Authorize AWS Amplify to access your GitHub account.
+
+ 
+
+Step 7
+: Select your personal account or relevant organization.
+
+ 
+
+Step 8
+: Authorize access to one or more repositories.
+
+ 
+
+Step 9
+: Select a repository and branch, then press the **Next** button.
+
+ 
+
+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.
@@ -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.
: 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:
: (`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/).
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.
+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.
@@ -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.
+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.
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 [details].
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:
-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.
+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
+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.
+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.
+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:
@@ -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: