mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
Merge commit '346b60358dd8ec2ca228e6635bff9d7914b398b7'
This commit is contained in:
@@ -12,12 +12,11 @@ action:
|
||||
signatures: [SITE.AllPages]
|
||||
---
|
||||
|
||||
This method returns all page [kinds] in all languages. That includes the home page, section pages, taxonomy pages, term pages, and regular pages.
|
||||
This method returns all page [kinds](g) in all languages. That includes the home page, section pages, taxonomy pages, term pages, and regular pages.
|
||||
|
||||
In most cases you should use the [`RegularPages`] method instead.
|
||||
|
||||
[`RegularPages`]: /methods/site/regularpages/
|
||||
[kinds]: /getting-started/glossary/#page-kind
|
||||
|
||||
```go-html-template
|
||||
{{ range .Site.AllPages }}
|
||||
|
@@ -13,17 +13,17 @@ action:
|
||||
signatures: [SITE.Data]
|
||||
---
|
||||
|
||||
Use the `Data` method on a `Site` object to access data within the data directory, or within any directory [mounted] to the data directory. Supported data formats include JSON, TOML, YAML, and XML.
|
||||
Use the `Data` method on a `Site` object to access data within the `data` directory, or within any directory [mounted] to the `data` directory. Supported data formats include JSON, TOML, YAML, and XML.
|
||||
|
||||
[mounted]: /hugo-modules/configuration/#module-configuration-mounts
|
||||
|
||||
{{% note %}}
|
||||
Although Hugo can unmarshal CSV files with the [`transform.Unmarshal`] function, do not place CSV files in the data directory. You cannot access data within CSV files using this method.
|
||||
Although Hugo can unmarshal CSV files with the [`transform.Unmarshal`] function, do not place CSV files in the `data` directory. You cannot access data within CSV files using this method.
|
||||
|
||||
[`transform.Unmarshal`]: /functions/transform/unmarshal/
|
||||
{{% /note %}}
|
||||
|
||||
Consider this data directory:
|
||||
Consider this `data` directory:
|
||||
|
||||
```text
|
||||
data/
|
||||
@@ -55,7 +55,7 @@ And these data files:
|
||||
isbn: 978-0521280495
|
||||
{{< /code >}}
|
||||
|
||||
Access the data by [chaining] the [identifiers]:
|
||||
Access the data by [chaining](g) the [identifiers](g):
|
||||
|
||||
```go-html-template
|
||||
{{ range $category, $books := .Site.Data.books }}
|
||||
@@ -101,14 +101,10 @@ To find a fiction book by ISBN:
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
In the template examples above, each of the keys is a valid [identifier]. For example, none of the keys contains a hyphen. To access a key that is not a valid identifier, use the [`index`] function. For example:
|
||||
|
||||
[identifier]: /getting-started/glossary/#identifier
|
||||
In the template examples above, each of the keys is a valid identifier. For example, none of the keys contains a hyphen. To access a key that is not a valid identifier, use the [`index`] function. For example:
|
||||
|
||||
```go-html-template
|
||||
{{ index .Site.Data.books "historical-fiction" }}
|
||||
```
|
||||
|
||||
[`index`]: /functions/collections/indexfunction/
|
||||
[chaining]: /getting-started/glossary/#chain
|
||||
[identifiers]: /getting-started/glossary/#identifier
|
||||
|
@@ -15,7 +15,7 @@ The `GetPage` method is also available on `Page` objects, allowing you to specif
|
||||
|
||||
[details]: /methods/page/getpage/
|
||||
|
||||
When using the `GetPage` method on a `Site` object, specify a path relative to the content directory.
|
||||
When using the `GetPage` method on a `Site` object, specify a path relative to the `content` directory.
|
||||
|
||||
If Hugo cannot resolve the path to a page, the method returns nil.
|
||||
|
||||
@@ -96,7 +96,7 @@ content/
|
||||
└── _index.md
|
||||
```
|
||||
|
||||
In the home template, use the `GetPage` method on a `Site` object to render all the images in the headless [page bundle]:
|
||||
In the home template, use the `GetPage` method on a `Site` object to render all the images in the headless [page bundle](g):
|
||||
|
||||
```go-html-template
|
||||
{{ with .Site.GetPage "/headless" }}
|
||||
@@ -105,5 +105,3 @@ In the home template, use the `GetPage` method on a `Site` object to render all
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
[page bundle]: /getting-started/glossary/#page-bundle
|
||||
|
@@ -12,12 +12,11 @@ action:
|
||||
signatures: [SITE.Pages]
|
||||
---
|
||||
|
||||
This method returns all page [kinds] in the current language. That includes the home page, section pages, taxonomy pages, term pages, and regular pages.
|
||||
This method returns all page [kinds](g) in the current language. That includes the home page, section pages, taxonomy pages, term pages, and regular pages.
|
||||
|
||||
In most cases you should use the [`RegularPages`] method instead.
|
||||
|
||||
[`RegularPages`]: /methods/site/regularpages/
|
||||
[kinds]: /getting-started/glossary/#page-kind
|
||||
|
||||
```go-html-template
|
||||
{{ range .Site.Pages }}
|
||||
|
@@ -16,7 +16,6 @@ The `Param` method on a `Site` object is a convenience method to return the valu
|
||||
display_toc = true
|
||||
{{< /code-toggle >}}
|
||||
|
||||
|
||||
```go-html-template
|
||||
{{ .Site.Param "display_toc" }} → true
|
||||
```
|
||||
|
@@ -26,7 +26,7 @@ With this site configuration:
|
||||
rfc_3339 = '2006-01-02T15:04:05-07:00'
|
||||
{{< /code-toggle >}}
|
||||
|
||||
Access the custom parameters by [chaining] the [identifiers]:
|
||||
Access the custom parameters by [chaining](g) the [identifiers](g):
|
||||
|
||||
```go-html-template
|
||||
{{ .Site.Params.subtitle }} → The Best Widgets on Earth
|
||||
@@ -43,5 +43,3 @@ In the template example above, each of the keys is a valid identifier. For examp
|
||||
```
|
||||
|
||||
[`index`]: /functions/collections/indexfunction/
|
||||
[chaining]: /getting-started/glossary/#chain
|
||||
[identifiers]: /getting-started/glossary/#identifier
|
||||
|
@@ -12,9 +12,7 @@ action:
|
||||
signatures: [SITE.RegularPages]
|
||||
---
|
||||
|
||||
The `RegularPages` method on a `Site` object returns a collection of all [regular pages].
|
||||
|
||||
[regular pages]: /getting-started/glossary/#regular-page
|
||||
The `RegularPages` method on a `Site` object returns a collection of all [regular pages](g).
|
||||
|
||||
```go-html-template
|
||||
{{ range .Site.RegularPages }}
|
||||
|
@@ -16,11 +16,10 @@ 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.
|
||||
The `Store` method on a `Site` object creates a persistent [scratch pad](g) to store and manipulate data. To create a locally scoped scratch pad that is not attached to a `Site` object, use the [`newScratch`] function.
|
||||
|
||||
[`Scratch`]: /methods/site/scratch/
|
||||
[`newScratch`]: /functions/collections/newscratch/
|
||||
[scratch pad]: /getting-started/glossary/#scratch-pad
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -109,9 +108,7 @@ Removes the given key.
|
||||
|
||||
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
|
||||
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](g) variable:
|
||||
|
||||
```go-html-template
|
||||
{{ $noop := .Content }}
|
||||
|
@@ -9,10 +9,6 @@ action:
|
||||
signatures: [SITE.Taxonomies]
|
||||
---
|
||||
|
||||
{{% comment %}}
|
||||
Show template example: GetTerms
|
||||
{{% /comment %}}
|
||||
|
||||
Conceptually, the `Taxonomies` method on a `Site` object returns a data structure such as:
|
||||
|
||||
{{< code-toggle >}}
|
||||
@@ -73,7 +69,6 @@ authors:
|
||||
- Pride and Prejudice
|
||||
{{< /code-toggle >}}
|
||||
|
||||
|
||||
To list the "suspense" books:
|
||||
|
||||
```go-html-template
|
||||
|
Reference in New Issue
Block a user