mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-09-09 01:14:41 -04:00
Miscellaneous edits and corrections
This commit is contained in:
parent
41b54d4210
commit
24236f57d9
@ -35,7 +35,7 @@ list
|
|||||||
: Do not include the page in _any_ page collection.
|
: Do not include the page in _any_ page collection.
|
||||||
|
|
||||||
publishResources
|
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`
|
- `true`
|
||||||
: Always publish resources. This is the default value.
|
: Always publish resources. This is the default value.
|
||||||
|
@ -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.
|
: (`string`) Apply a `type` specific filter to the result of a search. This is currently only used for the `fragments` type.
|
||||||
|
|
||||||
weight
|
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 >}}
|
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`.
|
: (`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`.
|
||||||
|
@ -106,7 +106,7 @@ If you need to use a different template for a subsection, specify `type` and/or
|
|||||||
|
|
||||||
## Ancestors and descendants
|
## 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
|
```text
|
||||||
content/products/product-1/benefits/benefit-1.md
|
content/products/product-1/benefits/benefit-1.md
|
||||||
|
@ -99,7 +99,7 @@ title
|
|||||||
: Image title.
|
: Image title.
|
||||||
|
|
||||||
caption
|
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
|
||||||
: `class` attribute of the HTML `figure` tag.
|
: `class` attribute of the HTML `figure` tag.
|
||||||
@ -358,7 +358,7 @@ Furthermore, you can automatically start playback of the embedded video by setti
|
|||||||
{{</* youtube id="w7Ft2ymGmfc" autoplay="true" */>}}
|
{{</* youtube id="w7Ft2ymGmfc" autoplay="true" */>}}
|
||||||
{{< /code >}}
|
{{< /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 >}}
|
{{< code file=example-youtube-input-with-title.md >}}
|
||||||
{{</* youtube id="w7Ft2ymGmfc" title="A New Hugo Site in Under Two Minutes" */>}}
|
{{</* youtube id="w7Ft2ymGmfc" title="A New Hugo Site in Under Two Minutes" */>}}
|
||||||
|
@ -50,7 +50,7 @@ The concept of a *summary divider* is not unique to Hugo. It is also called the
|
|||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
Pros
|
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
|
Cons
|
||||||
: Extra work for content authors, since they need to remember to type `<!--more-->` (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/).
|
: Extra work for content authors, since they need to remember to type `<!--more-->` (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 `<!--more-->` exactly; i.e., all lowercase and with no white
|
|||||||
|
|
||||||
### Front matter summary
|
### 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
|
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
|
Cons
|
||||||
: Extra work for content authors as they need to write an entirely separate piece of text as the summary of the article.
|
: 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
|
## 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 `<!--more-->`> summary divider present in the article the text up to the divider will be provided as per the manual summary split method
|
1. If there is a `<!--more-->`> 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
|
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
|
3. The text at the start of the article will be provided as per the automatic summary split method
|
||||||
|
|
||||||
{{% note %}}
|
{{% 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 `<!--more-->` 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 `<!--more-->` summary divider Hugo will use the manual summary split method.
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
## Example: first 10 articles with summaries
|
## Example: first 10 articles with summaries
|
||||||
|
@ -288,6 +288,8 @@ Use the "new-in" shortcode to indicate a new feature:
|
|||||||
{{</* new-in 0.120.0 */>}}
|
{{</* new-in 0.120.0 */>}}
|
||||||
{{< /code >}}
|
{{< /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
|
## Deprecated features
|
||||||
|
|
||||||
Use the "deprecated-in" shortcode to indicate that a feature is deprecated:
|
Use the "deprecated-in" shortcode to indicate that a feature is deprecated:
|
||||||
|
@ -10,13 +10,12 @@ action:
|
|||||||
- functions/transform/Remarshal
|
- functions/transform/Remarshal
|
||||||
- functions/transform/Unmarshal
|
- functions/transform/Unmarshal
|
||||||
signatures:
|
signatures:
|
||||||
- encoding.Jsonify INPUT
|
- encoding.Jsonify [OPTIONS] INPUT
|
||||||
- encoding.Jsonify OPTIONS INPUT
|
|
||||||
aliases: [/functions/jsonify]
|
aliases: [/functions/jsonify]
|
||||||
---
|
---
|
||||||
|
|
||||||
To customize the printing of the JSON, pass an options map as the first
|
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
|
the output will begin on a new line beginning with *prefix* followed by one or
|
||||||
more copies of *indent* according to the indentation nesting.
|
more copies of *indent* according to the indentation nesting.
|
||||||
|
|
||||||
@ -34,9 +33,5 @@ indent
|
|||||||
prefix
|
prefix
|
||||||
: (`string`) Indentation prefix. Default is "".
|
: (`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`.
|
: (`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/
|
|
||||||
|
@ -36,6 +36,16 @@ Use with the [`else`] statement:
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Intialize a variable, scoped to the current block:
|
||||||
|
|
||||||
|
```go-html-template
|
||||||
|
{{ with $var := 42 }}
|
||||||
|
{{ . }} → 42
|
||||||
|
{{ $var }} → 42
|
||||||
|
{{ end }}
|
||||||
|
{{ $var }} → undefined
|
||||||
|
```
|
||||||
|
|
||||||
## Understanding context
|
## 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.
|
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.
|
||||||
|
@ -63,7 +63,7 @@ minify
|
|||||||
: (`bool`)Let `js.Build` handle the minification.
|
: (`bool`)Let `js.Build` handle the minification.
|
||||||
|
|
||||||
inject
|
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
|
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:
|
: (`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';
|
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.:
|
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.
|
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.
|
The start directory for resolving npm packages (aka. packages that live inside a `node_modules` folder) is always the main project folder.
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ action:
|
|||||||
aliases: [/functions/absurl]
|
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
|
- Whether the input begins with a slash
|
||||||
- The `baseURL` in site configuration
|
- The `baseURL` in site configuration
|
||||||
|
@ -43,7 +43,7 @@ minify
|
|||||||
: (`bool`) Let `js.Build` handle the minification.
|
: (`bool`) Let `js.Build` handle the minification.
|
||||||
|
|
||||||
inject
|
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
|
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:
|
: (`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';
|
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.:
|
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
|
### 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.
|
The start directory for resolving npm packages (aka. packages that live inside a `node_modules` folder) is always the main project folder.
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ Line two.` }}
|
|||||||
## Variables
|
## Variables
|
||||||
|
|
||||||
Each Go Template gets a data object. In Hugo, each template is passed
|
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].
|
accessible in that [`Page` variable][pagevars].
|
||||||
|
|
||||||
With the `Page` being the default scope of a template, the `Title`
|
With the `Page` being the default scope of a template, the `Title`
|
||||||
|
@ -10,13 +10,13 @@ button will be hidden if:
|
|||||||
@param {string} version The semantic version string, with or without a leading v.
|
@param {string} version The semantic version string, with or without a leading v.
|
||||||
@returns {template.HTML}
|
@returns {template.HTML}
|
||||||
|
|
||||||
@example {{< new-in 0.100.0 }}
|
@example {{< new-in 0.100.0 >}}
|
||||||
*/}}
|
*/}}
|
||||||
|
|
||||||
{{- /* Set defaults. */}}
|
{{- /* Set defaults. */}}
|
||||||
{{- $majorVersionDiffThreshold := 0 }}
|
{{- $majorVersionDiffThreshold := 0 }}
|
||||||
{{- $minorVersionDiffThreshold := 30 }}
|
{{- $minorVersionDiffThreshold := 30 }}
|
||||||
{{- $displayExpirationWarning := true}}
|
{{- $displayExpirationWarning := true }}
|
||||||
|
|
||||||
{{- /* Render. */}}
|
{{- /* Render. */}}
|
||||||
{{- with $version := .Get 0 | strings.TrimPrefix "v" }}
|
{{- with $version := .Get 0 | strings.TrimPrefix "v" }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user