Improve new-in shortcode

This commit is contained in:
Joe Mooring 2025-01-31 20:05:57 -08:00 committed by GitHub
parent 1a7413a166
commit 367d3a7ab8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
82 changed files with 172 additions and 112 deletions

View File

@ -11,7 +11,7 @@ weight: 290
toc: true
---
{{< new-in 0.126.0 >}}
{{< new-in 0.126.0 />}}
## Overview

View File

@ -179,7 +179,7 @@ path
###### params
{{< new-in 0.123.0 >}}
{{< new-in 0.123.0 />}}
(`map`) A map of custom [page parameters].
@ -258,7 +258,7 @@ Alias to [expirydate](#expirydate).
## Parameters
{{< new-in 0.123.0 >}}
{{< new-in 0.123.0 />}}
Specify custom page parameters under the `params` key in front matter:

View File

@ -110,7 +110,7 @@ Metadata (EXIF, IPTC, XMP, etc.) is not preserved during image transformation. U
### Process
{{< new-in 0.119.0 >}}
{{< new-in 0.119.0 />}}
{{% note %}}
The `Process` method is also available as a filter, which is more effective if you need to apply multiple filters to an image. See [Process filter](/functions/images/process).

View File

@ -13,7 +13,7 @@ toc: true
math: true
---
{{< new-in 0.122.0 >}}
{{< new-in 0.122.0 />}}
## Overview

View File

@ -206,7 +206,7 @@ the `Name` and `Title` will be assigned to the resource files as follows:
## Multilingual
{{< new-in 0.123.0 >}}
{{< new-in 0.123.0 />}}
By default, with a multilingual single-host site, Hugo does not duplicate shared page resources when building the site.

View File

@ -56,7 +56,7 @@ If you set both `slug` and `url` in front matter, the `url` value takes preceden
#### Include a colon
{{< new-in 0.136.0 >}}
{{< new-in 0.136.0 />}}
If you need to include a colon in the `url` front matter field, escape it with backslash characters. Use one backslash if you wrap the string within single quotes, or use two backslashes if you wrap the string within double quotes. With YAML front matter, use a single backslash if you omit quotation marks.
@ -118,7 +118,7 @@ multilingual|`about`|`https://example.org/de/about/`
#### Permalinks tokens in front matter
{{< new-in "0.131.0" >}}
{{< new-in 0.131.0 />}}
You can also use [tokens](#tokens) when setting the `url` value. This is typically used in `cascade` sections:

View File

@ -365,7 +365,7 @@ Use the `new-in` shortcode to indicate a new feature:
{{</* new-in 0.127.0 */>}}
```
{{< new-in 0.127.0 >}}
{{< new-in 0.127.0 />}}
### note

View File

@ -45,7 +45,7 @@ tabWidth
: (`int`) Substitute this number of spaces for each tab character in your highlighted code. Irrelevant if `noClasses` is `false`. Default is `4`.
wrapperClass
{{< new-in 0.140.2 >}}
{{< new-in 0.140.2 />}}
: (`string`) The class or classes to use for the outermost element of the highlighted code. Default is `highlight`.
{{% note %}}

View File

@ -87,7 +87,7 @@ Use any of the following logical operators:
`intersect`
: (`bool`) Reports whether the given field value (a slice) contains one or more elements in common with `VALUE`. See&nbsp;[details](/functions/collections/intersect).
`like` {{< new-in 0.116.0 >}}
`like` {{< new-in 0.116.0 />}}
: (`bool`) Reports whether the given field value matches the regular expression 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 %}}
@ -168,7 +168,7 @@ For example, to return a collection of pages where any of the terms in the "genr
## Regular expression comparison
{{< new-in 0.116.0 >}}
{{< new-in 0.116.0 />}}
To return a collection of pages where the "author" page parameter begins with either "victor" or "Victor":

View File

@ -13,7 +13,7 @@ action:
toc: true
---
{{< new-in 0.128.0 >}}
{{< new-in 0.128.0 />}}
```go-html-template
{{ with resources.Get "css/main.css" | postCSS }}

View File

@ -15,7 +15,7 @@ action:
toc: true
---
{{< new-in 0.128.0 >}}
{{< new-in 0.128.0 />}}
```go-html-template
{{ with resources.Get "sass/main.scss" }}
@ -92,7 +92,7 @@ includePaths
```
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.
: (`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

View File

@ -14,7 +14,7 @@ action:
toc: true
---
{{< new-in 0.128.0 >}}
{{< new-in 0.128.0 />}}
## Prerequisites

View File

@ -10,7 +10,7 @@ action:
signatures: [debug.Timer NAME]
---
{{< new-in 0.120.0 >}}
{{< new-in 0.120.0 />}}
Use the `debug.Timer` function to determine execution time for a block of code, useful for finding performance bottlenecks in templates.

View File

@ -14,7 +14,7 @@ action:
aliases: [/functions/warnidf]
---
{{< new-in 0.123.0 >}}
{{< new-in 0.123.0 />}}
{{% include "functions/fmt/_common/fmt-layout.md" %}}

View File

@ -11,7 +11,7 @@ action:
toc: true
---
{{< new-in 0.141.0 >}}
{{< new-in 0.141.0 />}}
The `try` statement is a non-standard extension to Go's [text/template] package. It introduces a mechanism for handling errors within templates, mimicking the `try-catch` constructs found in other programming languages.

View File

@ -12,7 +12,7 @@ action:
signatures: [hugo.IsDevelopment]
---
{{< new-in 0.120.0 >}}
{{< new-in 0.120.0 />}}
```go-html-template
{{ hugo.IsDevelopment }} → true/false

View File

@ -11,7 +11,7 @@ action:
signatures: [hugo.IsMultihost]
---
{{< new-in v0.124.0 >}}
{{< new-in 0.124.0 />}}
Site configuration:

View File

@ -10,7 +10,7 @@ action:
signatures: [hugo.IsMultilingual]
---
{{< new-in v0.124.0 >}}
{{< new-in 0.124.0 />}}
Site configuration:

View File

@ -10,7 +10,7 @@ action:
signatures: [hugo.IsServer]
---
{{< new-in 0.120.0 >}}
{{< new-in 0.120.0 />}}
```go-html-template
{{ hugo.IsServer }} → true/false

View File

@ -14,7 +14,7 @@ action:
toc: true
---
{{< new-in 0.139.0 >}}
{{< new-in 0.139.0 />}}
Use the `hugo.Store` function to create a globally scoped [scratch pad](g) to store and manipulate data. To create a scratch pad with a different [scope](g), refer to the [scope](#scope) section below.

View File

@ -13,7 +13,7 @@ action:
toc: true
---
{{< new-in 0.121.2 >}}
{{< new-in 0.121.2 />}}
## Usage

View File

@ -15,7 +15,7 @@ action:
toc: true
---
{{< new-in 0.123.0 >}}
{{< new-in 0.123.0 />}}
## Options

View File

@ -13,7 +13,7 @@ action:
toc: true
---
{{< new-in 0.141.0 >}}
{{< new-in 0.141.0 />}}
The `images.Mask` filter applies a mask to an image. Black pixels in the mask make the corresponding areas of the base image transparent, while white pixels keep them opaque. Color images are converted to grayscale for masking purposes. The mask is automatically resized to match the dimensions of the base image.

View File

@ -13,7 +13,7 @@ action:
toc: true
---
{{< new-in 0.119.0 >}}
{{< new-in 0.119.0 />}}
The opacity value must be in the range [0, 1]. A value of `0` produces a transparent image, and a value of `1` produces an opaque image (no transparency).

View File

@ -13,7 +13,7 @@ action:
toc: true
---
{{< new-in 0.120.0 >}}
{{< new-in 0.120.0 />}}
The last argument is the canvas color, expressed as an RGB or RGBA [hexadecimal color]. The default value is `ffffffff` (opaque white). The preceding arguments are the padding values, in pixels, using the CSS [shorthand property] syntax. Negative padding values will crop the image.

View File

@ -14,7 +14,7 @@ action:
toc: true
---
{{< new-in 0.119.0 >}}
{{< new-in 0.119.0 />}}
This filter has the same options as the [`Process`] method on a `Resource` object, but using it as a filter may be more effective if you need to apply multiple filters to an image.

View File

@ -11,7 +11,7 @@ toc: true
math: true
---
{{< new-in 0.141.0 >}}
{{< new-in 0.141.0 />}}
The `images.QR` function encodes the given text into a [QR code] using the specified options, returning an image resource. The size of the generated image depends on three factors:

View File

@ -18,7 +18,7 @@ toc: true
Although none of the options are required, at a minimum you will want to set the `size` to be some reasonable percentage of the image height.
alignx
{{< new-in 0.141.0 >}}
{{< new-in 0.141.0 />}}
: (`string`) The horizontal alignment of the text relative to the horizontal offset, one of `left`, `center`, or `right`. Default is `left`.
color

View File

@ -23,7 +23,7 @@ Note that this is meant for small data sets, e.g. configuration settings. For la
###### loaders
{{< new-in "0.140.0" >}}
{{< new-in 0.140.0 />}}
(`map`) Configuring a loader for a given file type lets you load that file type with an import statement or a require call. For example configuring the .png file extension to use the data URL loader means importing a .png file gives you a data URLcontaining the contents of that image. Loaders available are `none`, `base64`, `binary`, `copy`, `css`, `dataurl`, `default`, `empty`, `file`, `global-css`, `js`, `json`, `jsx`, `local-css`, `text`, `ts`, `tsx`. See https://esbuild.github.io/api/#loader.
@ -65,7 +65,7 @@ import * as ReactDOM from 'react-dom/client';
###### platform
{{< new-in 0.140.0 >}}
{{< new-in 0.140.0 />}}
(`string`) One of `browser`, `node`, `neutral`. Default is `browser`. See https://esbuild.github.io/api/#platform.
@ -87,19 +87,19 @@ import * as ReactDOM from 'react-dom/client';
###### sourcesContent
{{< new-in 0.140.0 >}}
{{< new-in 0.140.0 />}}
(`bool`) Whether to include the content of the source files in the source map. By default, this is `true`.
###### JSX
{{< new-in 0.124.0 >}}
{{< new-in 0.124.0 />}}
(`string`) How to handle/transform JSX syntax. One of: `transform`, `preserve`, `automatic`. Default is `transform`. Notably, the `automatic` transform was introduced in React 17+ and will cause the necessary JSX helper functions to be imported automatically. See https://esbuild.github.io/api/#jsx.
###### JSXImportSource
{{< new-in 0.124.0 >}}
{{< new-in 0.124.0 />}}
(`string`) Which library to use to automatically import its JSX helper functions from. This only works if `JSX` is set to `automatic`. The specified library needs to be installed through npm and expose certain exports. See https://esbuild.github.io/api/#jsx-import-source.

View File

@ -17,7 +17,7 @@ action:
signatures: [math.Acos VALUE]
---
{{< new-in 0.130.0 >}}
{{< new-in 0.130.0 />}}
```go-html-template
{{ math.Acos 1 }} → 0

View File

@ -17,7 +17,7 @@ action:
signatures: [math.Asin VALUE]
---
{{< new-in 0.130.0 >}}
{{< new-in 0.130.0 />}}
```go-html-template
{{ math.Asin 1 }} → 1.5707963267948966

View File

@ -17,7 +17,7 @@ action:
signatures: [math.Atan VALUE]
---
{{< new-in 0.130.0 >}}
{{< new-in 0.130.0 />}}
```go-html-template
{{ math.Atan 1 }} → 0.7853981633974483

View File

@ -17,7 +17,7 @@ action:
signatures: [math.Atan2 VALUE VALUE]
---
{{< new-in 0.130.0 >}}
{{< new-in 0.130.0 />}}
```go-html-template
{{ math.Atan2 1 2 }} → 0.4636476090008061

View File

@ -17,7 +17,7 @@ action:
signatures: [math.Cos VALUE]
---
{{< new-in 0.130.0 >}}
{{< new-in 0.130.0 />}}
```go-html-template
{{ math.Cos 1 }} → 0.5403023058681398

View File

@ -17,7 +17,7 @@ action:
signatures: [math.Pi]
---
{{< new-in 0.130.0 >}}
{{< new-in 0.130.0 />}}
```go-html-template
{{ math.Pi }} → 3.141592653589793

View File

@ -15,7 +15,7 @@ action:
signatures: [math.Product VALUE...]
---
{{< new-in 0.114.0 >}}
{{< new-in 0.114.0 />}}
```go-html-template
{{ math.Product 1 (slice 2 3) 4 }} → 24

View File

@ -10,7 +10,7 @@ action:
signatures: [math.Rand]
---
{{< new-in 0.121.2 >}}
{{< new-in 0.121.2 />}}
The `math.Rand` function returns a pseudo-random number in the half-open [interval](g) [0.0, 1.0).

View File

@ -17,7 +17,7 @@ action:
signatures: [math.Sin VALUE]
---
{{< new-in 0.130.0 >}}
{{< new-in 0.130.0 />}}
```go-html-template
{{ math.Sin 1 }} → 0.8414709848078965

View File

@ -14,7 +14,7 @@ action:
signatures: [math.Sum VALUE...]
---
{{< new-in 0.114.0 >}}
{{< new-in 0.114.0 />}}
```go-html-template
{{ math.Sum 1 (slice 2 3) 4 }} → 10

View File

@ -17,7 +17,7 @@ action:
signatures: [math.Tan VALUE]
---
{{< new-in 0.130.0 >}}
{{< new-in 0.130.0 />}}
```go-html-template
{{ math.Tan 1 }} → 1.557407724654902

View File

@ -12,7 +12,7 @@ action:
signatures: [math.ToDegrees VALUE]
---
{{< new-in 0.130.0 >}}
{{< new-in 0.130.0 />}}
```go-html-template
{{ math.ToDegrees 1.5707963267948966 }} → 90

View File

@ -12,7 +12,7 @@ action:
signatures: [math.ToRadians VALUE]
---
{{< new-in 0.130.0 >}}
{{< new-in 0.130.0 />}}
```go-html-template
{{ math.ToRadians 90 }} → 1.5707963267948966

View File

@ -18,6 +18,15 @@ action:
toc: true
---
{{< new-in 0.141.0 >}}
The `Err` method on the returned resource was removed in v0.141.0.
Use the [`try`] statement instead, as shown in the [error handling] example below.
[`try`]: /functions/go-template/try
[error handling]: #error-handling
{{< /new-in >}}
```go-html-template
{{ $url := "https://example.org/images/a.jpg" }}
{{ with try (resources.GetRemote $url) }}

View File

@ -9,7 +9,7 @@ action:
signatures: [strings.Diff OLDNAME OLD NEWNAME NEW]
---
{{< new-in 0.125.0 >}}
{{< new-in 0.125.0 />}}
Use `strings.Diff` to compare two strings and render a highlighted diff:

View File

@ -15,7 +15,7 @@ action:
signatures: [strings.TrimSpace INPUT]
---
{{< new-in 0.136.3 >}}
{{< new-in 0.136.3 />}}
Whitespace characters include `\t`, `\n`, `\v`, `\f`, `\r`, and characters in the [Unicode Space Separator] category.

View File

@ -12,7 +12,7 @@ action:
aliases: [/functions/templates.defer]
---
{{< new-in "0.128.0" >}}
{{< new-in 0.128.0 />}}
In some rare use cases, you may need to defer the execution of a template until after all sites and output formats have been rendered. One such example could be [TailwindCSS](/functions/css/tailwindcss/) using the output of [hugo_stats.json](/getting-started/configuration/#configure-build) to determine which classes and other HTML identifiers are being used in the final output:

View File

@ -13,7 +13,7 @@ aliases: [/functions/tomath]
toc: true
---
{{< new-in "0.132.0" >}}
{{< new-in 0.132.0 />}}
Hugo uses an embedded instance of the [KaTeX] display engine to render mathematical markup to HTML. You do not need to install the KaTeX display engine.

View File

@ -132,7 +132,7 @@ delimiter
comment
: (`string`) The comment character used in the CSV. If set, lines beginning with the comment character without preceding whitespace are ignored.
lazyQuotes {{< new-in 0.122.0 >}}
lazyQuotes {{< new-in 0.122.0 />}}
: (`bool`) If true, a quote may appear in an unquoted field and a non-doubled quote may appear in a quoted field. Default is `false`.
```go-html-template

View File

@ -10,7 +10,7 @@ action:
signatures: [transform.XMLEscape INPUT]
---
{{< new-in 0.121.0 >}}
{{< new-in 0.121.0 />}}
The `transform.XMLEscape` function removes [disallowed characters] as defined in the XML specification, then escapes the result by replacing the following characters with [HTML entities]:

View File

@ -54,7 +54,7 @@ The `build.cachebusters` configuration option was added to support development u
target = "$1"
{{< /code-toggle >}}
When `buildStats` {{< new-in 0.115.1 >}} is enabled, Hugo writes a `hugo_stats.json` file on each build with HTML classes etc. that's used in the rendered output. Changes to this file will trigger a rebuild of the `styles.css` file. You also need to add `hugo_stats.json` to Hugo's server watcher. See [Hugo Starter Tailwind Basic](https://github.com/bep/hugo-starter-tailwind-basic) for a running example.
When `buildStats` {{< new-in 0.115.1 />}} is enabled, Hugo writes a `hugo_stats.json` file on each build with HTML classes etc. that's used in the rendered output. Changes to this file will trigger a rebuild of the `styles.css` file. You also need to add `hugo_stats.json` to Hugo's server watcher. See [Hugo Starter Tailwind Basic](https://github.com/bep/hugo-starter-tailwind-basic) for a running example.
source
: A regexp matching file(s) relative to one of the virtual component directories in Hugo, typically `assets/...`.
@ -66,7 +66,7 @@ target
{{< code-toggle config=build.buildStats />}}
{{< new-in 0.115.1 >}}
{{< new-in 0.115.1 />}}
If `enable` is set to `true`, creates a `hugo_stats.json` file in the root of your project. This file contains arrays of the `class` attributes, `id` attributes, and tags of every HTML element within your published site. Use this file as data source when [removing unused CSS] from your site. This process is also known as pruning, purging, or tree shaking.

View File

@ -86,7 +86,7 @@ typographer|[Goldmark Extensions: Typographer]|:heavy_check_mark:
#### Extras
{{< new-in 0.126.0 >}}
{{< new-in 0.126.0 />}}
Enable [deleted text], [inserted text], [mark text], [subscript], and [superscript] elements in Markdown.
@ -124,7 +124,7 @@ enable = true
#### Passthrough
{{< new-in 0.122.0 >}}
{{< new-in 0.122.0 />}}
Enable the passthrough extension to include mathematical equations and expressions in Markdown using LaTeX markup. See [mathematics in Markdown] for details.
@ -153,7 +153,7 @@ Most of the Goldmark settings above are self-explanatory, but some require expla
###### duplicateResourceFiles
{{< new-in 0.123.0 >}}
{{< new-in 0.123.0 />}}
(`bool`) If `true`, shared page resources on multilingual single-host sites will be duplicated for each language. See [multilingual page resources] for details. Default is `false`.
@ -194,7 +194,7 @@ This is also the strategy used by the [anchorize](/functions/urls/anchorize) tem
###### renderHooks.image.enableDefault
{{< new-in 0.123.0 >}}
{{< new-in 0.123.0 />}}
(`bool`) If `true`, enables Hugo's [embedded image render hook]. Default is `false`.
@ -208,7 +208,7 @@ The embedded image render hook is automatically enabled for multilingual single-
###### renderHooks.link.enableDefault
{{< new-in 0.123.0 >}}
{{< new-in 0.123.0 />}}
(`bool`) If `true`, enables Hugo's [embedded link render hook]. Default is `false`.

View File

@ -232,7 +232,7 @@ See [Configure File Caches](#configure-file-caches).
###### capitalizeListTitles
{{< new-in 0.123.3 >}}
{{< new-in 0.123.3 />}}
(`bool`) Whether to capitalize automatic list titles. Applicable to section, taxonomy, and term pages. Default is `true`. You can change the capitalization style in your site configuration to one of `ap`, `chicago`, `go`, `firstupper`, or `none`. See&nbsp;[details].
@ -281,7 +281,7 @@ To remain consistent and prevent unexpected behavior, do not mix these strategie
###### disableDefaultLanguageRedirect
{{< new-in 0.140.0 >}}
{{< new-in 0.140.0 />}}
(`bool`) Disables generation of redirect to the default language when DefaultContentLanguageInSubdir is `true`. Default is `false`.
@ -472,7 +472,7 @@ content/post/hügó.md → https://example.org/post/hugo/
###### renderSegments
{{< new-in 0.124.0 >}}
{{< new-in 0.124.0 />}}
(`[]string`) A list of segments to render. If not set, everything will be rendered. This is more commonly set in a CLI flag, e.g. `hugo --renderSegments segment1,segment2`. The segment names must match the names in the [segments](#configure-segments) configuration.
@ -563,7 +563,7 @@ enableemoji: true
## Configure page
{{< new-in 0.133.0 >}}
{{< new-in 0.133.0 />}}
These methods on a `Page` object navigate to the next or previous page within a page collection, relative to the current page:
@ -734,7 +734,7 @@ HUGO_ENVIRONMENT
HUGO_FILE_LOG_FORMAT
: (`string`) A format string for the file path, line number, and column number displayed when reporting errors, or when calling the `Position` method from a shortcode or Markdown render hook. Valid tokens are `:file`, `:line`, and `:col`. Default is `:file::line::col`.
{{< new-in 0.123.0 >}}
{{< new-in 0.123.0 />}}
HUGO_MEMORYLIMIT
: (`int`) The maximum amount of system memory, in gigabytes, that Hugo can use while rendering your site. Default is 25% of total system memory.
@ -876,7 +876,7 @@ This can be set using the `cacheDir` config option or via the OS environment var
If this is not set, Hugo will use, in order of preference:
1. If running on Netlify: `/opt/build/cache/hugo_cache/`. This means that if you run your builds on Netlify, all caches configured with `:cacheDir` will be saved and restored on the next build. For other CI vendors, please read their documentation. For an CircleCI example, see [this configuration](https://github.com/bep/hugo-sass-test/blob/6c3960a8f4b90e8938228688bc49bdcdd6b2d99e/.circleci/config.yml).
1. In a `hugo_cache` directory below the OS user cache directory as defined by Go's [os.UserCacheDir](https://pkg.go.dev/os#UserCacheDir). On Unix systems, this is `$XDG_CACHE_HOME` as specified by [basedir-spec-latest](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) if non-empty, else `$HOME/.cache`. On MacOS, this is `$HOME/Library/Caches`. On Windows, this is`%LocalAppData%`. On Plan 9, this is `$home/lib/cache`. {{< new-in 0.116.0 >}}
1. In a `hugo_cache` directory below the OS user cache directory as defined by Go's [os.UserCacheDir](https://pkg.go.dev/os#UserCacheDir). On Unix systems, this is `$XDG_CACHE_HOME` as specified by [basedir-spec-latest](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) if non-empty, else `$HOME/.cache`. On MacOS, this is `$HOME/Library/Caches`. On Windows, this is`%LocalAppData%`. On Plan 9, this is `$home/lib/cache`. {{< new-in 0.116.0 />}}
1. In a `hugo_cache_$USER` directory below the OS temp dir.
If you want to know the current value of `cacheDir`, you can run `hugo config`, e.g: `hugo config | grep cachedir`.
@ -890,7 +890,7 @@ If you want to know the current value of `cacheDir`, you can run `hugo config`,
## Configure HTTP cache
{{< new-in 0.127.0 >}}
{{< new-in 0.127.0 />}}
Note that this configuration is currently only relevant when using the [resources.GetRemote] function.
@ -936,7 +936,7 @@ polling
## Configure segments
{{< new-in 0.124.0 >}}
{{< new-in 0.124.0 />}}
{{% note %}}
The `segments` configuration is currently only used to configure partitioned rendering.

View File

@ -2,6 +2,6 @@
title: logical path
---
{{< new-in 0.123.0 >}}
{{< new-in 0.123.0 />}}
A page or page resource identifier derived from the file path, excluding its extension and language identifier. This value is neither a file path nor a URL. Starting with a file path relative to the `content` directory, Hugo determines the logical path by stripping the file extension and language identifier, converting to lower case, then replacing spaces with hyphens. See [examples](/methods/page/path/#examples).

View File

@ -65,7 +65,7 @@ Hugo allows you to set `draft`, `date`, `publishDate`, and `expiryDate` in the [
- The `publishDate` is in the future
- The `expiryDate` is in the past
{{< new-in 0.123.0 >}}
{{< new-in 0.123.0 />}}
{{% note %}}
Hugo publishes descendants of draft, future, and expired [node](g) pages. To prevent publication of these descendants, use the [`cascade`] front matter field to cascade [build options] to the descendant pages.

View File

@ -154,7 +154,7 @@ target
: (`string`) Where it should be mounted into Hugo's virtual filesystem. It must start with one of Hugo's component directories: `static`, `content`, `layouts`, `data`, `assets`, `i18n`, or `archetypes`. E.g. `content/blog`.
disableWatch
{{< new-in 0.128.0 >}}
{{< new-in 0.128.0 />}}
: (`bool`) Whether to disable watching in watch mode for this mount. Default is `false`.
lang

View File

@ -15,7 +15,7 @@ action:
signatures: [PAGE.ContentWithoutSummary]
---
{{< new-in 0.134.0 >}}
{{< new-in 0.134.0 />}}
Applicable when using manual or automatic [content summaries], the `ContentWithoutSummary` method on a `Page` object renders Markdown and shortcodes to HTML, excluding the content summary from the result.

View File

@ -84,7 +84,7 @@ The path separators (slash or backslash) in `Path`, `Dir`, and `Filename` depend
###### IsContentAdapter
{{< new-in 0.126.0 >}}
{{< new-in 0.126.0 />}}
(`bool`) Reports whether the file is a [content adapter].

View File

@ -12,7 +12,7 @@ action:
toc: true
---
{{< new-in 0.123.0 >}}
{{< new-in 0.123.0 />}}
The `Path` method on a `Page` object returns the [logical path](g) of the given page, regardless of whether the page is backed by a file.

View File

@ -17,7 +17,7 @@ action:
toc: true
---
{{< new-in 0.117.0 >}}
{{< new-in 0.117.0 />}}
Use this method in shortcode templates to compose a page from multiple content files, while preserving a global context for footnotes and the table of contents.

View File

@ -71,7 +71,7 @@ When working with global resources instead of page resources, use the [`resource
###### Mount
{{< new-in "0.140.0" >}}
{{< new-in 0.140.0 />}}
(`ResourceGetter`) Mounts the given resources from the two arguments base (`string`) to the given target path (`string`) and returns an object that implements [Get](#get). Note that leading slashes in target marks an absolute path. Relative target paths allows you to mount resources relative to another set, e.g. a [Page bundle](/content-management/page-bundles/):

View File

@ -21,7 +21,7 @@ changefreq
{{ .Sitemap.ChangeFreq }}
```
disable {{< new-in 0.125.0 >}}
disable {{< new-in 0.125.0 />}}
: (`bool`) Whether to disable page inclusion. Default is `false`. Set to `true` in front matter to exclude the page.
```go-html-template

View File

@ -10,7 +10,7 @@ action:
signatures: [PAGER.PagerSize]
---
{{< new-in 0.128.0 >}}
{{< new-in 0.128.0 />}}
The number of pages per pager is determined by the optional second argument passed to the [`Paginate`] method, falling back to the `pagerSize` as defined in your [site configuration].

View File

@ -20,11 +20,11 @@ The `Resources.Colors` method returns a slice of the most dominant colors in an
Each color is an object with the following methods:
ColorHex
{{< new-in 0.125.0 >}}
{{< new-in 0.125.0 />}}
: (`string`) Returns the [hexadecimal color] value, prefixed with a hash sign.
Luminance
{{< new-in 0.125.0 >}}
{{< new-in 0.125.0 />}}
: (`float64`) Returns the [relative luminance] of the color in the sRGB colorspace in the range [0, 1]. A value of `0` represents the darkest black, while a value of `1` represents the lightest white.
{{% note %}}

View File

@ -14,7 +14,7 @@ action:
toc: true
---
{{< new-in 0.139.0 >}}
{{< new-in 0.139.0 />}}
Use the `Store` method to create a [scratch pad](g) to store and manipulate data, scoped to the current shortcode. To create a scratch pad with a different [scope](g), refer to the [scope](#scope) section below.

View File

@ -9,7 +9,7 @@ action:
signatures: [SITE.Lastmod]
---
{{< new-in 0.123.0 >}}
{{< new-in 0.123.0 />}}
The `Lastmod` method on a `Site` object returns a [`time.Time`] value. Use this with time [functions] and [methods]. For example:

View File

@ -13,7 +13,7 @@ action:
toc: true
---
{{< new-in 0.139.0 >}}
{{< new-in 0.139.0 />}}
Use the `Store` method on a `Site` object to create a [scratch pad](g) to store and manipulate data, scoped to the current site. To create a scratch pad with a different [scope](g), refer to the [scope](#scope) section below.

View File

@ -9,7 +9,7 @@ action:
signatures: [TAXONOMY.Page]
---
{{< new-in 0.125.0 >}}
{{< new-in 0.125.0 />}}
This `TAXONOMY` method returns nil if the taxonomy has no terms, so you must code defensively:

View File

@ -4,7 +4,7 @@ _comment: Do not remove front matter.
## PageInner details
{{< new-in 0.125.0 >}}
{{< new-in 0.125.0 />}}
The primary use case for `PageInner` is to resolve links and [page resources](g) relative to an included `Page`. For example, create an "include" shortcode to compose a page from multiple content files, while preserving a global context for footnotes and the table of contents:

View File

@ -12,7 +12,7 @@ weight: 30
toc: true
---
{{< new-in 0.132.0 >}}
{{< new-in 0.132.0 />}}
## Context
@ -24,13 +24,13 @@ Blockquote render hook templates receive the following [context](g):
###### AlertTitle
{{< new-in 0.134.0 >}}
{{< new-in 0.134.0 />}}
(`template.HTML`) Applicable when [`Type`](#type) is `alert`, this is the alert title. See the [alerts](#alerts) section below.
###### AlertSign
{{< new-in 0.134.0 >}}
{{< new-in 0.134.0 />}}
(`string`) Applicable when [`Type`](#type) is `alert`, this is the alert sign. Typically used to indicate whether an alert is graphically foldable, this is one of&nbsp;`+`,&nbsp;`-`,&nbsp;or an empty string. See the [alerts](#alerts) section below.

View File

@ -78,7 +78,7 @@ Code block render hook templates receive the following [context](g):
###### PageInner
{{< new-in 0.125.0 >}}
{{< new-in 0.125.0 />}}
(`page`) A reference to a page nested via the [`RenderShortcodes`] method. [See details](#pageinner-details).

View File

@ -41,7 +41,7 @@ title = true
###### PageInner
{{< new-in 0.125.0 >}}
{{< new-in 0.125.0 />}}
(`page`) A reference to a page nested via the [`RenderShortcodes`] method. [See details](#pageinner-details).

View File

@ -59,7 +59,7 @@ block = true
###### PageInner
{{< new-in 0.125.0 >}}
{{< new-in 0.125.0 />}}
(`page`) A reference to a page nested via the [`RenderShortcodes`] method. [See details](#pageinner-details).
@ -122,7 +122,7 @@ wrapStandAloneImageWithinParagraph = false
## Default
{{< new-in 0.123.0 >}}
{{< new-in 0.123.0 />}}
Hugo includes an [embedded image render hook] to resolve Markdown image destinations. Disabled by default, you can enable it in your site configuration:

View File

@ -38,7 +38,7 @@ Link render hook templates receive the following context:
###### PageInner
{{< new-in 0.125.0 >}}
{{< new-in 0.125.0 />}}
(`page`) A reference to a page nested via the [`RenderShortcodes`] method. [See details](#pageinner-details).
@ -90,7 +90,7 @@ To include a `rel` attribute set to `external` for external links:
## Default
{{< new-in 0.123.0 >}}
{{< new-in 0.123.0 />}}
Hugo includes an [embedded link render hook] to resolve Markdown link destinations. Disabled by default, you can enable it in your site configuration:

View File

@ -12,7 +12,7 @@ weight: 80
toc: true
---
{{< new-in 0.132.0 >}}
{{< new-in 0.132.0 />}}
## Overview

View File

@ -12,7 +12,7 @@ weight: 90
toc: true
---
{{< new-in 0.134.0 >}}
{{< new-in 0.134.0 />}}
## Context

View File

@ -18,7 +18,7 @@ To override Hugo's embedded `comment` shortcode, copy the [source code] to a fil
[source code]: {{% eturl comment %}}
{{% /note %}}
{{< new-in "0.137.1" >}}
{{< new-in 0.137.1 />}}
Use the `comment` shortcode to include comments in your content. Hugo will ignore the text within these comments when rendering your site.

View File

@ -11,7 +11,7 @@ weight:
toc: true
---
{{< new-in 0.140.0 >}}
{{< new-in 0.140.0 />}}
{{% note %}}
To override Hugo's embedded `details` shortcode, copy the [source code] to a file with the same name in the `layouts/shortcodes` directory.

View File

@ -11,7 +11,7 @@ weight:
toc: true
---
{{< new-in 0.141.0 >}}
{{< new-in 0.141.0 />}}
{{% note %}}
To override Hugo's embedded `qr` shortcode, copy the [source code] to a file with the same name in the `layouts/shortcodes` directory.

View File

@ -11,7 +11,7 @@ weight:
toc: true
---
{{< new-in 0.141.0 >}}
{{< new-in 0.141.0 />}}
{{% note %}}
To override Hugo's embedded `x` shortcode, copy the [source code] to a file with the same name in the `layouts/shortcodes` directory.

View File

@ -41,38 +41,38 @@ 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.125.0 >}}
{{< new-in 0.125.0 />}}
: (`bool`) Whether the `iframe` element can activate full screen mode. Default is `true`.
autoplay
{{< new-in 0.125.0 >}}
{{< new-in 0.125.0 />}}
: (`bool`) Whether to automatically play the video. Forces `mute` to `true`. Default is `false`.
class
: (`string`) The `class` attribute of the wrapping `div` element. When specified, removes the `style` attributes from the `iframe` element and its wrapping `div` element.
controls
{{< new-in 0.125.0 >}}
{{< new-in 0.125.0 />}}
: (`bool`) Whether to display the video controls. Default is `true`.
end
{{< new-in 0.125.0 >}}
{{< new-in 0.125.0 />}}
: (`int`) The time, measured in seconds from the start of the video, when the player should stop playing the video.
loading
{{< new-in 0.125.0 >}}
{{< new-in 0.125.0 />}}
: (`string`) The loading attribute of the `iframe` element, either `eager` or `lazy`. Default is `eager`.
loop
{{< new-in 0.125.0 >}}
{{< new-in 0.125.0 />}}
: (`bool`) Whether to indefinitely repeat the video. Ignores the `start` and `end` arguments after the first play. Default is `false`.
mute
{{< new-in 0.125.0 >}}
{{< new-in 0.125.0 />}}
: (`bool`) Whether to mute the video. Always `true` when `autoplay` is `true`. Default is `false`.
start
{{< new-in 0.125.0 >}}
{{< new-in 0.125.0 />}}
: (`int`) The time, measured in seconds from the start of the video, when the player should start playing the video.
title

View File

@ -35,7 +35,7 @@ These are the default sitemap configuration values. They apply to all pages unle
changefreq
: (`string`) How frequently a page is likely to change. Valid values are `always`, `hourly`, `daily`, `weekly`, `monthly`, `yearly`, and `never`. With the default value of `""` Hugo will omit this field from the sitemap. See&nbsp;[details](https://www.sitemaps.org/protocol.html#changefreqdef).
disable {{< new-in 0.125.0 >}}
disable {{< new-in 0.125.0 />}}
: (`bool`) Whether to disable page inclusion. Default is `false`. Set to `true` in front matter to exclude the page.
filename

View File

@ -0,0 +1,51 @@
{{- /*
Renders a "new in" button indicating the version in which a feature was added.
When comparing the current version to the specified version, the "new in"
button will be hidden if any of the following conditions is true:
- The major version difference exceeds the majorVersionDiffThreshold
- The minor version difference exceeds the minorVersionDiffThreshold
@param {string} version The semantic version string, with or without a leading v.
@returns {template.HTML}
@examples {{< new-in 0.100.0 />}}
{{< new-in 0.100.0 >}}
Some descriptive text here.
{{< /new-in >}}
*/}}
{{ $_hugo_config := `{ "version": 1 }` }}
{{- /* Set defaults. */}}
{{- $majorVersionDiffThreshold := 0 }}
{{- $minorVersionDiffThreshold := 30 }}
{{- $displayExpirationWarning := true }}
{{- /* Render. */}}
{{- with $version := .Get 0 | strings.TrimPrefix "v" }}
{{- $majorVersionDiff := sub (index (split hugo.Version ".") 0 | int) (index (split $version ".") 0 | int) }}
{{- $minorVersionDiff := sub (index (split hugo.Version ".") 1 | int) (index (split $version ".") 1 | int) }}
{{- if or (gt $majorVersionDiff $majorVersionDiffThreshold) (gt $minorVersionDiff $minorVersionDiffThreshold) }}
{{- if $displayExpirationWarning }}
{{- warnf "This call to the %q shortcode should be removed: %s. The button is now hidden because the specified version (%s) is older than the display threshold." $.Name $.Position $version }}
{{- end }}
{{- else }}
{{- $href := printf "https://github.com/gohugoio/hugo/releases/tag/v%s" $version }}
{{- with $.Inner }}
<aside>
<div class="admonition-content bl bw2 b--blue" >
<p>New in <a href="{{ $href }}">v{{ $version }}</a>.</p>
{{ . | $.Page.RenderString (dict "display" "block") }}
</div>
</aside>
{{- else }}
<a class="dib f5 fw6 ba bw1 b--gray ph2 mt1" href="{{ $href }}">New in v{{ $version }}</a>
{{- end }}
{{- end }}
{{- else }}
{{- errorf "The %q shortcode requires a positional parameter (version). See %s" .Name .Position }}
{{- end -}}