diff --git a/content/en/content-management/build-options.md b/content/en/content-management/build-options.md index f6550cc1b..bc9d7ff49 100644 --- a/content/en/content-management/build-options.md +++ b/content/en/content-management/build-options.md @@ -35,7 +35,7 @@ list : Do not include the page in _any_ page collection. publishResources -: Applicable to [page bundles], determines whether to publish the associated [page resources]. Specify one of: +: Applicable to [page bundles], determines whether to publish the associated [page resources]. Specify one of: - `true` : Always publish resources. This is the default value. diff --git a/content/en/content-management/related.md b/content/en/content-management/related.md index 9a766e130..e73dfc32a 100644 --- a/content/en/content-management/related.md +++ b/content/en/content-management/related.md @@ -147,7 +147,7 @@ applyFilter {{< new-in 0.111.0 >}} : (`string`) Apply a `type` specific filter to the result of a search. This is currently only used for the `fragments` type. weight -: (`int`) An integer weight that indicates _how important_ this parameter is relative to the other parameters. It can be `0`, which has the effect of turning this index off, or even negative. Test with different values to see what fits your content best. +: (`int`) An integer weight that indicates _how important_ this parameter is relative to the other parameters. It can be `0`, which has the effect of turning this index off, or even negative. Test with different values to see what fits your content best. cardinalityThreshold {{< new-in 0.111.0 >}} : (`int`) A percentage (0-100) used to remove common keywords from the index. As an example, setting this to `50` will remove all keywords that are used in more than 50% of the documents in the index. Default is `0`. diff --git a/content/en/content-management/sections.md b/content/en/content-management/sections.md index 2207513d5..1b694ce44 100644 --- a/content/en/content-management/sections.md +++ b/content/en/content-management/sections.md @@ -106,7 +106,7 @@ If you need to use a different template for a subsection, specify `type` and/or ## Ancestors and descendants -A section has one or more ancestors (including the home page), and zero or more descendants. With the file structure from the [example above](#overview): +A section has one or more ancestors (including the home page), and zero or more descendants. With the file structure from the [example above](#overview): ```text content/products/product-1/benefits/benefit-1.md diff --git a/content/en/content-management/shortcodes.md b/content/en/content-management/shortcodes.md index 40184c606..bbc2b0cc8 100644 --- a/content/en/content-management/shortcodes.md +++ b/content/en/content-management/shortcodes.md @@ -99,7 +99,7 @@ title : Image title. caption -: Image caption. Markdown within the value of `caption` will be rendered. +: Image caption. Markdown within the value of `caption` will be rendered. class : `class` attribute of the HTML `figure` tag. @@ -358,7 +358,7 @@ Furthermore, you can automatically start playback of the embedded video by setti {{}} {{< /code >}} -For [accessibility reasons](https://dequeuniversity.com/tips/provide-iframe-titles), it's best to provide a title for your YouTube video. You can do this using the shortcode by providing a `title` parameter. If no title is provided, a default of "YouTube Video" will be used. +For [accessibility reasons](https://dequeuniversity.com/tips/provide-iframe-titles), it's best to provide a title for your YouTube video. You can do this using the shortcode by providing a `title` parameter. If no title is provided, a default of "YouTube Video" will be used. {{< code file=example-youtube-input-with-title.md >}} {{}} diff --git a/content/en/content-management/summaries.md b/content/en/content-management/summaries.md index 6788375e3..2ff1fec34 100644 --- a/content/en/content-management/summaries.md +++ b/content/en/content-management/summaries.md @@ -50,7 +50,7 @@ The concept of a *summary divider* is not unique to Hugo. It is also called the {{% /note %}} Pros -: Freedom, precision, and improved rendering. All HTML tags and formatting are preserved. +: Freedom, precision, and improved rendering. All HTML tags and formatting are preserved. Cons : Extra work for content authors, since they need to remember to type `` (or `# more` for [org content][org]) in each content file. This can be automated by adding the summary divider below the front matter of an [archetype](/content-management/archetypes/). @@ -61,24 +61,24 @@ Be careful to enter `` exactly; i.e., all lowercase and with no white ### Front matter summary -You might want your summary to be something other than the text that starts the article. In this case you can provide a separate summary in the `summary` variable of the article front matter. +You might want your summary to be something other than the text that starts the article. In this case you can provide a separate summary in the `summary` variable of the article front matter. Pros -: Complete freedom of text independent of the content of the article. Markup can be used within the summary. +: Complete freedom of text independent of the content of the article. Markup can be used within the summary. Cons : Extra work for content authors as they need to write an entirely separate piece of text as the summary of the article. ## Summary selection order -Because there are multiple ways in which a summary can be specified it is useful to understand the order of selection Hugo follows when deciding on the text to be returned by `.Summary`. It is as follows: +Because there are multiple ways in which a summary can be specified it is useful to understand the order of selection Hugo follows when deciding on the text to be returned by `.Summary`. It is as follows: 1. If there is a ``> summary divider present in the article the text up to the divider will be provided as per the manual summary split method 2. If there is a `summary` variable in the article front matter the value of the variable will be provided as per the front matter summary method 3. The text at the start of the article will be provided as per the automatic summary split method {{% note %}} -Hugo uses the _first_ of the above steps that returns text. So if, for example, your article has both `summary` variable in its front matter and a `` summary divider Hugo will use the manual summary split method. +Hugo uses the _first_ of the above steps that returns text. So if, for example, your article has both `summary` variable in its front matter and a `` summary divider Hugo will use the manual summary split method. {{% /note %}} ## Example: first 10 articles with summaries diff --git a/content/en/contribute/documentation.md b/content/en/contribute/documentation.md index 6b37db280..14df5cdee 100644 --- a/content/en/contribute/documentation.md +++ b/content/en/contribute/documentation.md @@ -288,6 +288,8 @@ Use the "new-in" shortcode to indicate a new feature: {{}} {{< /code >}} +The "new in" label will be hidden if the specified version is older than a predefined threshold, based on differences in major and minor versions. See [details](https://github.com/gohugoio/hugoDocs/blob/master/layouts/shortcodes/new-in.html). + ## Deprecated features Use the "deprecated-in" shortcode to indicate that a feature is deprecated: diff --git a/content/en/functions/encoding/Jsonify.md b/content/en/functions/encoding/Jsonify.md index af1995294..475f8a76a 100644 --- a/content/en/functions/encoding/Jsonify.md +++ b/content/en/functions/encoding/Jsonify.md @@ -10,13 +10,12 @@ action: - functions/transform/Remarshal - functions/transform/Unmarshal signatures: - - encoding.Jsonify INPUT - - encoding.Jsonify OPTIONS INPUT + - encoding.Jsonify [OPTIONS] INPUT aliases: [/functions/jsonify] --- To customize the printing of the JSON, pass an options map as the first -argument. Supported options are "prefix" and "indent". Each JSON element in +argument. Supported options are "prefix" and "indent". Each JSON element in the output will begin on a new line beginning with *prefix* followed by one or more copies of *indent* according to the indentation nesting. @@ -34,9 +33,5 @@ indent prefix : (`string`) Indentation prefix. Default is "". -noHTMLEscape (false) +noHTMLEscape : (`bool`) Disable escaping of problematic HTML characters inside JSON quoted strings. The default behavior is to escape `&`, `<`, and `>` to `\u0026`, `\u003c`, and `\u003e` to avoid certain safety problems that can arise when embedding JSON in HTML. Default is `false`. - -See also the `.PlainWords`, `.Plain`, and `.RawContent` [page variables]. - -[page variables]: /variables/page/ diff --git a/content/en/functions/go-template/with.md b/content/en/functions/go-template/with.md index 9245e563f..197181953 100644 --- a/content/en/functions/go-template/with.md +++ b/content/en/functions/go-template/with.md @@ -36,6 +36,16 @@ Use with the [`else`] statement: {{ end }} ``` +Intialize a variable, scoped to the current block: + +```go-html-template +{{ with $var := 42 }} + {{ . }} → 42 + {{ $var }} → 42 +{{ end }} +{{ $var }} → undefined +``` + ## Understanding context At the top of a page template, the [context] (the dot) is a `Page` object. Inside of the `with` block, the context is bound to the value passed to the `with` statement. diff --git a/content/en/functions/js/Build.md b/content/en/functions/js/Build.md index b53a7a01f..835785486 100644 --- a/content/en/functions/js/Build.md +++ b/content/en/functions/js/Build.md @@ -63,7 +63,7 @@ minify : (`bool`)Let `js.Build` handle the minification. inject -: (`slice`) This option allows you to automatically replace a global variable with an import from another file. The path names must be relative to `assets`. See https://esbuild.github.io/api/#inject +: (`slice`) This option allows you to automatically replace a global variable with an import from another file. The path names must be relative to `assets`. See https://esbuild.github.io/api/#inject shims : (`map`) This option allows swapping out a component with another. A common use case is to load dependencies like React from a CDN (with _shims_) when in production, but running with the full bundled `node_modules` dependency during development: @@ -139,7 +139,7 @@ For other files (e.g. `JSON`, `CSS`) you need to use the relative path including import * as data from 'my/module/data.json'; ``` -Any imports in a file outside `/assets` or that does not resolve to a component inside `/assets` will be resolved by [ESBuild](https://esbuild.github.io/) with the **project directory** as the resolve directory (used as the starting point when looking for `node_modules` etc.). Also see [hugo mod npm pack](/commands/hugo_mod_npm_pack/). If you have any imported npm dependencies in your project, you need to make sure to run `npm install` before you run `hugo`. +Any imports in a file outside `/assets` or that does not resolve to a component inside `/assets` will be resolved by [ESBuild](https://esbuild.github.io/) with the **project directory** as the resolve directory (used as the starting point when looking for `node_modules` etc.). Also see [hugo mod npm pack](/commands/hugo_mod_npm_pack/). If you have any imported npm dependencies in your project, you need to make sure to run `npm install` before you run `hugo`. Also note the new `params` option that can be passed from template to your JS files, e.g.: @@ -158,7 +158,7 @@ Hugo will, by default, generate a `assets/jsconfig.json` file that maps the impo Use the `js.Build` function to include Node.js dependencies. -Any imports in a file outside `/assets` or that does not resolve to a component inside `/assets` will be resolved by [esbuild](https://esbuild.github.io/) with the **project directory** as the resolve directory (used as the starting point when looking for `node_modules` etc.). Also see [hugo mod npm pack](/commands/hugo_mod_npm_pack/). If you have any imported npm dependencies in your project, you need to make sure to run `npm install` before you run `hugo`. +Any imports in a file outside `/assets` or that does not resolve to a component inside `/assets` will be resolved by [esbuild](https://esbuild.github.io/) with the **project directory** as the resolve directory (used as the starting point when looking for `node_modules` etc.). Also see [hugo mod npm pack](/commands/hugo_mod_npm_pack/). If you have any imported npm dependencies in your project, you need to make sure to run `npm install` before you run `hugo`. The start directory for resolving npm packages (aka. packages that live inside a `node_modules` folder) is always the main project folder. diff --git a/content/en/functions/urls/AbsURL.md b/content/en/functions/urls/AbsURL.md index 0bcf5eb14..5b027ae84 100644 --- a/content/en/functions/urls/AbsURL.md +++ b/content/en/functions/urls/AbsURL.md @@ -14,7 +14,7 @@ action: aliases: [/functions/absurl] --- -With multilingual configurations, use the [`absLangURL`] function instead. The URL returned by this function depends on: +With multilingual configurations, use the [`absLangURL`] function instead. The URL returned by this function depends on: - Whether the input begins with a slash - The `baseURL` in site configuration diff --git a/content/en/hugo-pipes/js.md b/content/en/hugo-pipes/js.md index f62458d39..c9366ce8a 100644 --- a/content/en/hugo-pipes/js.md +++ b/content/en/hugo-pipes/js.md @@ -43,7 +43,7 @@ minify : (`bool`) Let `js.Build` handle the minification. inject -: (`slice`) This option allows you to automatically replace a global variable with an import from another file. The path names must be relative to `assets`. See https://esbuild.github.io/api/#inject +: (`slice`) This option allows you to automatically replace a global variable with an import from another file. The path names must be relative to `assets`. See https://esbuild.github.io/api/#inject shims : (`map`) This option allows swapping out a component with another. A common use case is to load dependencies like React from a CDN (with _shims_) when in production, but running with the full bundled `node_modules` dependency during development: @@ -123,7 +123,7 @@ For other files (e.g. `JSON`, `CSS`) you need to use the relative path including import * as data from 'my/module/data.json'; ``` -Any imports in a file outside `/assets` or that does not resolve to a component inside `/assets` will be resolved by [ESBuild](https://esbuild.github.io/) with the **project directory** as the resolve directory (used as the starting point when looking for `node_modules` etc.). Also see [hugo mod npm pack](/commands/hugo_mod_npm_pack/). If you have any imported npm dependencies in your project, you need to make sure to run `npm install` before you run `hugo`. +Any imports in a file outside `/assets` or that does not resolve to a component inside `/assets` will be resolved by [ESBuild](https://esbuild.github.io/) with the **project directory** as the resolve directory (used as the starting point when looking for `node_modules` etc.). Also see [hugo mod npm pack](/commands/hugo_mod_npm_pack/). If you have any imported npm dependencies in your project, you need to make sure to run `npm install` before you run `hugo`. Also note the new `params` option that can be passed from template to your JS files, e.g.: @@ -140,7 +140,7 @@ Hugo will, by default, generate a `assets/jsconfig.json` file that maps the impo ### Include dependencies In package.json / node_modules -Any imports in a file outside `/assets` or that does not resolve to a component inside `/assets` will be resolved by [ESBuild](https://esbuild.github.io/) with the **project directory** as the resolve directory (used as the starting point when looking for `node_modules` etc.). Also see [hugo mod npm pack](/commands/hugo_mod_npm_pack/). If you have any imported npm dependencies in your project, you need to make sure to run `npm install` before you run `hugo`. +Any imports in a file outside `/assets` or that does not resolve to a component inside `/assets` will be resolved by [ESBuild](https://esbuild.github.io/) with the **project directory** as the resolve directory (used as the starting point when looking for `node_modules` etc.). Also see [hugo mod npm pack](/commands/hugo_mod_npm_pack/). If you have any imported npm dependencies in your project, you need to make sure to run `npm install` before you run `hugo`. The start directory for resolving npm packages (aka. packages that live inside a `node_modules` folder) is always the main project folder. diff --git a/content/en/templates/introduction.md b/content/en/templates/introduction.md index 56cabe0ca..7fb0ddecf 100644 --- a/content/en/templates/introduction.md +++ b/content/en/templates/introduction.md @@ -79,7 +79,7 @@ Line two.` }} ## Variables Each Go Template gets a data object. In Hugo, each template is passed -a `Page`. In the below example, `.Title` is one of the elements +a `Page`. In the below example, `.Title` is one of the elements accessible in that [`Page` variable][pagevars]. With the `Page` being the default scope of a template, the `Title` diff --git a/layouts/shortcodes/new-in.html b/layouts/shortcodes/new-in.html index c048f2d22..f45b3194a 100644 --- a/layouts/shortcodes/new-in.html +++ b/layouts/shortcodes/new-in.html @@ -10,13 +10,13 @@ button will be hidden if: @param {string} version The semantic version string, with or without a leading v. @returns {template.HTML} -@example {{< new-in 0.100.0 }} +@example {{< new-in 0.100.0 >}} */}} {{- /* Set defaults. */}} {{- $majorVersionDiffThreshold := 0 }} {{- $minorVersionDiffThreshold := 30 }} -{{- $displayExpirationWarning := true}} +{{- $displayExpirationWarning := true }} {{- /* Render. */}} {{- with $version := .Get 0 | strings.TrimPrefix "v" }}