Merge commit '7125ad401ad043e46262afc7eca8dceb6d54bb9e'

This commit is contained in:
Bjørn Erik Pedersen
2024-01-26 08:22:42 +01:00
141 changed files with 904 additions and 813 deletions

View File

@@ -26,7 +26,7 @@ Hugo ships with an internal template supporting [Google Analytics 4].
Provide your tracking ID in your configuration file:
**Google Analytics 4 (gtag.js)**
{{< code-toggle file="hugo" >}}
{{< code-toggle file=hugo >}}
[services.googleAnalytics]
ID = "G-MEASUREMENT_ID"
{{</ code-toggle >}}

View File

@@ -22,7 +22,7 @@ Layout
: Can be set in front matter.
Output Format
: See [Custom Output Formats](/templates/output-formats). An output format has both a `name` (e.g. `rss`, `amp`, `html`) and a `suffix` (e.g. `xml`, `html`). We prefer matches with both (e.g. `index.amp.html`, but look for less specific templates.
: See [Custom Output Formats](/templates/output-formats). An output format has both a `name` (e.g. `rss`, `amp`, `html`) and a `suffix` (e.g. `xml`, `html`). We prefer matches with both (e.g. `index.amp.html`), but look for less specific templates.
Note that if the output format's Media Type has more than one suffix defined, only the first is considered.

View File

@@ -155,7 +155,7 @@ While you can create shortcode templates that accept both positional and named p
You can also use the variable `.Page` to access all the normal [page variables][pagevars].
A shortcodes can also be nested. In a nested shortcode, you can access the parent shortcode context with [`.Parent` variable][shortcodesvars]. This can be very useful for inheritance of common shortcode parameters from the root.
Shortcodes can also be nested. In a nested shortcode, you can access the parent shortcode context with the [`.Parent`] shortcode method. This can be very useful for inheritance of common shortcode parameters from the root.
### Checking for existence
@@ -307,7 +307,7 @@ The rendered output of the HTML example code block will be as follows:
### Nested shortcode: image gallery
Hugo's [`.Parent` shortcode variable][parent] provides access to the parent shortcode context when the shortcode in question is called within the context of a *parent* shortcode. This provides an inheritance model for common shortcode parameters.
Hugo's [`.Parent`] shortcode method provides access to the parent shortcode context when the shortcode in question is called within the context of a *parent* shortcode. This provides an inheritance model for common shortcode parameters.
The following example is contrived but demonstrates the concept. Assume you have a `gallery` shortcode that expects one named `class` parameter:
@@ -350,7 +350,7 @@ This will output the following HTML. Note how the first two `img` shortcodes inh
## Error handling in shortcodes
Use the [errorf](/functions/fmt/errorf) template func and [.Position](/variables/shortcode/) variable to get useful error messages in shortcodes:
Use the [errorf](/functions/fmt/errorf) template function and [`.Position`] shortcode method to get useful error messages in shortcodes:
```sh
{{ with .Get "name" }}
@@ -372,6 +372,7 @@ You can also implement your shortcodes inline -- e.g. where you use them in the
This feature is disabled by default, but can be enabled in your site configuration:
{{< code-toggle file=hugo >}}
[security]
enableInlineShortcodes = true
{{< /code-toggle >}}
@@ -405,8 +406,8 @@ The same inline shortcode can be reused later in the same content file, with dif
[hugosc]: /content-management/shortcodes/#using-hugo-s-built-in-shortcodes
[lookup order]: /templates/lookup-order/
[pagevars]: /variables/page/
[parent]: /variables/shortcode/
[shortcodesvars]: /variables/shortcode/
[`.Parent`]: /methods/shortcode/parent/
[`.Position`]: /methods/shortcode/position/
[spfscs]: https://github.com/spf13/spf13.com/tree/master/layouts/shortcodes
[vimeoexample]: #single-flexible-example-vimeo
[youtubeshortcode]: /content-management/shortcodes/#youtube