mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
Merge commit '7125ad401ad043e46262afc7eca8dceb6d54bb9e'
This commit is contained in:
@@ -15,18 +15,18 @@ Use the `Children` method when rendering a nested menu.
|
||||
With this site configuration:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[[menu.main]]
|
||||
[[menus.main]]
|
||||
name = 'Products'
|
||||
pageRef = '/product'
|
||||
weight = 10
|
||||
|
||||
[[menu.main]]
|
||||
[[menus.main]]
|
||||
name = 'Product 1'
|
||||
pageRef = '/products/product-1'
|
||||
parent = 'Products'
|
||||
weight = 1
|
||||
|
||||
[[menu.main]]
|
||||
[[menus.main]]
|
||||
name = 'Product 2'
|
||||
pageRef = '/products/product-2'
|
||||
parent = 'Products'
|
||||
|
@@ -15,18 +15,18 @@ Use the `HasChildren` method when rendering a nested menu.
|
||||
With this site configuration:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[[menu.main]]
|
||||
[[menus.main]]
|
||||
name = 'Products'
|
||||
pageRef = '/product'
|
||||
weight = 10
|
||||
|
||||
[[menu.main]]
|
||||
[[menus.main]]
|
||||
name = 'Product 1'
|
||||
pageRef = '/products/product-1'
|
||||
parent = 'Products'
|
||||
weight = 1
|
||||
|
||||
[[menu.main]]
|
||||
[[menus.main]]
|
||||
name = 'Product 2'
|
||||
pageRef = '/products/product-2'
|
||||
parent = 'Products'
|
||||
|
@@ -14,13 +14,13 @@ The `Identifier` method returns the `identifier` property of the menu entry. If
|
||||
[automatically]: /content-management/menus/#define-automatically
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[[menu.main]]
|
||||
[[menus.main]]
|
||||
identifier = 'about'
|
||||
name = 'About'
|
||||
pageRef = '/about'
|
||||
weight = 10
|
||||
|
||||
[[menu.main]]
|
||||
[[menus.main]]
|
||||
identifier = 'contact'
|
||||
name = 'Contact'
|
||||
pageRef = '/contact'
|
||||
|
@@ -12,13 +12,13 @@ action:
|
||||
In this menu definition, the second entry does not contain an `identifier`, so the `Identifier` method returns its `name` property instead:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[[menu.main]]
|
||||
[[menus.main]]
|
||||
identifier = 'about'
|
||||
name = 'About'
|
||||
pageRef = '/about'
|
||||
weight = 10
|
||||
|
||||
[[menu.main]]
|
||||
[[menus.main]]
|
||||
name = 'Contact'
|
||||
pageRef = '/contact'
|
||||
weight = 20
|
||||
|
@@ -5,7 +5,7 @@ categories: []
|
||||
keywords: []
|
||||
action:
|
||||
related: []
|
||||
returnType: hugolib.pageState
|
||||
returnType: page.Page
|
||||
signatures: [MENUENTRY.Page]
|
||||
---
|
||||
|
||||
@@ -14,15 +14,15 @@ Regardless of how you [define menu entries], an entry associated with a page has
|
||||
In this menu definition, the first two entries are associated with a page, the last entry is not:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[[menu.main]]
|
||||
[[menus.main]]
|
||||
pageRef = '/about'
|
||||
weight = 10
|
||||
|
||||
[[menu.main]]
|
||||
[[menus.main]]
|
||||
pageRef = '/contact'
|
||||
weight = 20
|
||||
|
||||
[[menu.main]]
|
||||
[[menus.main]]
|
||||
name = 'Hugo'
|
||||
url = 'https://gohugo.io'
|
||||
weight = 30
|
||||
|
@@ -12,21 +12,21 @@ action:
|
||||
When you define menu entries [in site configuration] or [in front matter], you can include a `params` key to attach additional information to the entry. For example:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[[menu.main]]
|
||||
[[menus.main]]
|
||||
name = 'About'
|
||||
pageRef = '/about'
|
||||
weight = 10
|
||||
|
||||
[[menu.main]]
|
||||
[[menus.main]]
|
||||
name = 'Contact'
|
||||
pageRef = '/contact'
|
||||
weight = 20
|
||||
|
||||
[[menu.main]]
|
||||
[[menus.main]]
|
||||
name = 'Hugo'
|
||||
url = 'https://gohugo.io'
|
||||
weight = 30
|
||||
[menu.main.params]
|
||||
[menus.main.params]
|
||||
rel = 'external'
|
||||
{{< /code-toggle >}}
|
||||
|
||||
|
@@ -12,19 +12,18 @@ action:
|
||||
With this menu definition:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[menu]
|
||||
[[menu.main]]
|
||||
[[menus.main]]
|
||||
name = 'Products'
|
||||
pageRef = '/product'
|
||||
weight = 10
|
||||
|
||||
[[menu.main]]
|
||||
[[menus.main]]
|
||||
name = 'Product 1'
|
||||
pageRef = '/products/product-1'
|
||||
parent = 'Products'
|
||||
weight = 1
|
||||
|
||||
[[menu.main]]
|
||||
[[menus.main]]
|
||||
name = 'Product 2'
|
||||
pageRef = '/products/product-2'
|
||||
parent = 'Products'
|
||||
|
@@ -7,14 +7,14 @@ In this site configuration we enable rendering of [emoji shortcodes], and add em
|
||||
{{< code-toggle file=hugo >}}
|
||||
enableEmoji = true
|
||||
|
||||
[[menu.main]]
|
||||
[[menus.main]]
|
||||
name = 'About'
|
||||
pageRef = '/about'
|
||||
post = ':point_left:'
|
||||
pre = ':point_right:'
|
||||
weight = 10
|
||||
|
||||
[[menu.main]]
|
||||
[[menus.main]]
|
||||
name = 'Contact'
|
||||
pageRef = '/contact'
|
||||
post = ':arrow_left:'
|
||||
|
@@ -14,17 +14,17 @@ The `Sort` method returns the given menu with its entries sorted by `name`.
|
||||
Consider this menu definition:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[[menu.main]]
|
||||
[[menus.main]]
|
||||
name = 'Services'
|
||||
pageRef = '/services'
|
||||
weight = 10
|
||||
|
||||
[[menu.main]]
|
||||
[[menus.main]]
|
||||
name = 'About'
|
||||
pageRef = '/about'
|
||||
weight = 20
|
||||
|
||||
[[menu.main]]
|
||||
[[menus.main]]
|
||||
name = 'Contact'
|
||||
pageRef = '/contact'
|
||||
weight = 30
|
||||
|
@@ -16,19 +16,19 @@ The `ByWeight` method returns the given menu with its entries sorted by [`weight
|
||||
Consider this menu definition:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[[menu.main]]
|
||||
[[menus.main]]
|
||||
identifier = 'about'
|
||||
name = 'About'
|
||||
pageRef = '/about'
|
||||
weight = 20
|
||||
|
||||
[[menu.main]]
|
||||
[[menus.main]]
|
||||
identifier = 'services'
|
||||
name = 'Services'
|
||||
pageRef = '/services'
|
||||
weight = 10
|
||||
|
||||
[[menu.main]]
|
||||
[[menus.main]]
|
||||
identifier = 'contact'
|
||||
name = 'Contact'
|
||||
pageRef = '/contact'
|
||||
|
@@ -14,17 +14,17 @@ The `Limit` method returns the given menu, limited to the first N entries.
|
||||
Consider this menu definition:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[[menu.main]]
|
||||
[[menus.main]]
|
||||
name = 'Services'
|
||||
pageRef = '/services'
|
||||
weight = 10
|
||||
|
||||
[[menu.main]]
|
||||
[[menus.main]]
|
||||
name = 'About'
|
||||
pageRef = '/about'
|
||||
weight = 20
|
||||
|
||||
[[menu.main]]
|
||||
[[menus.main]]
|
||||
name = 'Contact'
|
||||
pageRef = '/contact'
|
||||
weight = 30
|
||||
|
@@ -14,17 +14,17 @@ The `Reverse` method returns the given menu, reversing the sort order of its ent
|
||||
Consider this menu definition:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[[menu.main]]
|
||||
[[menus.main]]
|
||||
name = 'Services'
|
||||
pageRef = '/services'
|
||||
weight = 10
|
||||
|
||||
[[menu.main]]
|
||||
[[menus.main]]
|
||||
name = 'About'
|
||||
pageRef = '/about'
|
||||
weight = 20
|
||||
|
||||
[[menu.main]]
|
||||
[[menus.main]]
|
||||
name = 'Contact'
|
||||
pageRef = '/contact'
|
||||
weight = 30
|
||||
|
@@ -63,8 +63,9 @@ And this template:
|
||||
{{ with .AllTranslations }}
|
||||
<ul>
|
||||
{{ range . }}
|
||||
{{ $lang := .Language.LanguageName}}
|
||||
<li><a href="{{ .RelPermalink }}">{{ .LinkTitle }} ({{ $lang }})</a></li>
|
||||
{{ $langName := or .Language.LanguageName .Language.Lang }}
|
||||
{{ $langCode := or .Language.LanguageCode .Language.Lang }}
|
||||
<li><a href="{{ .RelPermalink }}" hreflang="{{ $langCode }}">{{ .LinkTitle }} ({{ $langName }})</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
@@ -74,9 +75,9 @@ Hugo will render this list on the "Book 1" page of each site:
|
||||
|
||||
```html
|
||||
<ul>
|
||||
<li><a href="/books/book-1/">Book 1 (English)</a></li>
|
||||
<li><a href="/de/books/book-1/">Book 1 (Deutsch)</a></li>
|
||||
<li><a href="/fr/books/book-1/">Book 1 (Français)</a></li>
|
||||
<li><a href="/books/book-1/" hreflang="en-US">Book 1 (English)</a></li>
|
||||
<li><a href="/de/books/book-1/" hreflang="de-DE">Book 1 (Deutsch)</a></li>
|
||||
<li><a href="/fr/books/book-1/" hreflang="fr-FR">Book 1 (Français)</a></li>
|
||||
</ul>
|
||||
```
|
||||
|
||||
@@ -84,7 +85,7 @@ On the "Book 2" page of the English and German sites, Hugo will render this:
|
||||
|
||||
```html
|
||||
<ul>
|
||||
<li><a href="/books/book-1/">Book 1 (English)</a></li>
|
||||
<li><a href="/de/books/book-1/">Book 1 (Deutsch)</a></li>
|
||||
<li><a href="/books/book-1/" hreflang="en-US">Book 1 (English)</a></li>
|
||||
<li><a href="/de/books/book-1/" hreflang="de-DE">Book 1 (Deutsch)</a></li>
|
||||
</ul>
|
||||
```
|
||||
|
@@ -29,7 +29,7 @@ enableGitInfo = true
|
||||
Consider this project structure:
|
||||
|
||||
```text
|
||||
hugo-testing/
|
||||
my-project/
|
||||
├── content/
|
||||
│ ├── books/
|
||||
│ │ └── les-miserables.md
|
||||
|
@@ -12,7 +12,7 @@ action:
|
||||
- methods/page/IsDescendant
|
||||
- methods/page/Parent
|
||||
- methods/page/Sections
|
||||
returnType: hugolib.pageState
|
||||
returnType: page.Page
|
||||
signatures: [PAGE.CurrentSection]
|
||||
---
|
||||
|
||||
|
@@ -30,8 +30,9 @@ Code defensively by verifying file existence as shown in each of the examples be
|
||||
The path separators (slash or backslash) in `Path`, `Dir`, and `Filename` depend on the operating system.
|
||||
{{% /note %}}
|
||||
|
||||
BaseFileName
|
||||
: (`string`) The file name, excluding the extension.
|
||||
###### BaseFileName
|
||||
|
||||
(`string`) The file name, excluding the extension.
|
||||
|
||||
```go-html-template
|
||||
{{ with .File }}
|
||||
@@ -39,8 +40,9 @@ BaseFileName
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
ContentBaseName
|
||||
: (`string`) If the page is a branch or leaf bundle, the name of the containing directory, else the `TranslationBaseName`.
|
||||
###### ContentBaseName
|
||||
|
||||
(`string`) If the page is a branch or leaf bundle, the name of the containing directory, else the `TranslationBaseName`.
|
||||
|
||||
```go-html-template
|
||||
{{ with .File }}
|
||||
@@ -48,8 +50,9 @@ ContentBaseName
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
Dir
|
||||
: (`string`) The file path, excluding the file name, relative to the `content` directory.
|
||||
###### Dir
|
||||
|
||||
(`string`) The file path, excluding the file name, relative to the `content` directory.
|
||||
|
||||
```go-html-template
|
||||
{{ with .File }}
|
||||
@@ -57,8 +60,9 @@ Dir
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
Ext
|
||||
: (`string`) The file extension.
|
||||
###### Ext
|
||||
|
||||
(`string`) The file extension.
|
||||
|
||||
```go-html-template
|
||||
{{ with .File }}
|
||||
@@ -66,8 +70,9 @@ Ext
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
Filename
|
||||
: (`string`) The absolute file path.
|
||||
###### Filename
|
||||
|
||||
(`string`) The absolute file path.
|
||||
|
||||
```go-html-template
|
||||
{{ with .File }}
|
||||
@@ -75,8 +80,9 @@ Filename
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
Lang
|
||||
: (`string`) The language associated with the given file.
|
||||
###### Lang
|
||||
|
||||
(`string`) The language associated with the given file.
|
||||
|
||||
```go-html-template
|
||||
{{ with .File }}
|
||||
@@ -84,8 +90,9 @@ Lang
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
LogicalName
|
||||
: (`string`) The file name.
|
||||
###### LogicalName
|
||||
|
||||
(`string`) The file name.
|
||||
|
||||
```go-html-template
|
||||
{{ with .File }}
|
||||
@@ -93,8 +100,9 @@ LogicalName
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
Path
|
||||
: (`string`) The file path, relative to the `content` directory.
|
||||
###### Path
|
||||
|
||||
(`string`) The file path, relative to the `content` directory.
|
||||
|
||||
```go-html-template
|
||||
{{ with .File }}
|
||||
@@ -102,8 +110,9 @@ Path
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
TranslationBaseName
|
||||
: (`string`) The file name, excluding the extension and language identifier.
|
||||
###### TranslationBaseName
|
||||
|
||||
(`string`) The file name, excluding the extension and language identifier.
|
||||
|
||||
```go-html-template
|
||||
{{ with .File }}
|
||||
@@ -111,8 +120,9 @@ TranslationBaseName
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
UniqueID
|
||||
: (`string`) The MD5 hash of `.File.Path`.
|
||||
###### UniqueID
|
||||
|
||||
(`string`) The MD5 hash of `.File.Path`.
|
||||
|
||||
```go-html-template
|
||||
{{ with .File }}
|
||||
|
@@ -12,7 +12,7 @@ action:
|
||||
- methods/page/IsDescendant
|
||||
- methods/page/Parent
|
||||
- methods/page/Sections
|
||||
returnType: hugolib.pageState
|
||||
returnType: page.Page
|
||||
signatures: [PAGE.FirstSection]
|
||||
---
|
||||
|
||||
|
@@ -28,14 +28,14 @@ Use the `Fragments` method on a `Page` object to create a table of contents with
|
||||
## Methods
|
||||
|
||||
Headings
|
||||
: (`map`) A nested map of all headings on the page. Each map contains the following keys: `ID`, `Title` and `Headings`. To inspect the data structure:
|
||||
: (`map`) A nested map of all headings on the page. Each map contains the following keys: `ID`, `Level`, `Title` and `Headings`. To inspect the data structure:
|
||||
|
||||
```go-html-template
|
||||
<pre>{{ .Fragments.Headings | jsonify (dict "indent" " ") }}</pre>
|
||||
```
|
||||
|
||||
HeadingsMap
|
||||
: (`slice`) A slice of maps of all headings on the page, with first-level keys for each heading. Each map contains the following keys: `ID`, `Title` and `Headings`. To inspect the data structure:
|
||||
: (`slice`) A slice of maps of all headings on the page, with first-level keys for each heading. Each map contains the following keys: `ID`, `Level`, `Title` and `Headings`. To inspect the data structure:
|
||||
|
||||
```go-html-template
|
||||
<pre>{{ .Fragments.HeadingsMap | jsonify (dict "indent" " ") }}</pre>
|
||||
|
@@ -6,7 +6,7 @@ keywords: []
|
||||
action:
|
||||
related:
|
||||
- methods/site/GetPage
|
||||
returnType: hugolib.pageState
|
||||
returnType: page.Page
|
||||
signatures: [PAGE.GetPage PATH]
|
||||
aliases: [/functions/getpage]
|
||||
---
|
||||
|
@@ -34,7 +34,7 @@ hugo --enableGitInfo
|
||||
```
|
||||
|
||||
{{% note %}}
|
||||
When you set `enableGitInto` to `true`, or enable the feature with the command line flag, the last modification date for each content page will be the Author Date of the last commit for that file.
|
||||
When you set `enableGitInfo` to `true`, or enable the feature with the command line flag, the last modification date for each content page will be the Author Date of the last commit for that file.
|
||||
|
||||
This is configurable. See [details].
|
||||
|
||||
@@ -43,8 +43,9 @@ This is configurable. See [details].
|
||||
|
||||
## Methods
|
||||
|
||||
AbbreviatedHash
|
||||
: (`string`) The abbreviated commit hash.
|
||||
###### AbbreviatedHash
|
||||
|
||||
(`string`) The abbreviated commit hash.
|
||||
|
||||
```go-html-template
|
||||
{{ with .GitInfo }}
|
||||
@@ -52,8 +53,9 @@ AbbreviatedHash
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
AuthorDate
|
||||
: (`time.Time`) The author date.
|
||||
###### AuthorDate
|
||||
|
||||
(`time.Time`) The author date.
|
||||
|
||||
```go-html-template
|
||||
{{ with .GitInfo }}
|
||||
@@ -61,8 +63,9 @@ AuthorDate
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
AuthorEmail
|
||||
: (`string`) The author's email address, respecting [gitmailmap].
|
||||
###### AuthorEmail
|
||||
|
||||
(`string`) The author's email address, respecting [gitmailmap].
|
||||
|
||||
```go-html-template
|
||||
{{ with .GitInfo }}
|
||||
@@ -70,8 +73,9 @@ AuthorEmail
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
AuthorName
|
||||
: (`string`) The author's name, respecting [gitmailmap].
|
||||
###### AuthorName
|
||||
|
||||
(`string`) The author's name, respecting [gitmailmap].
|
||||
|
||||
```go-html-template
|
||||
{{ with .GitInfo }}
|
||||
@@ -79,8 +83,19 @@ AuthorName
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
Hash
|
||||
: (`string`) The commit hash.
|
||||
###### CommitDate
|
||||
|
||||
(`time.Time`) The commit date.
|
||||
|
||||
```go-html-template
|
||||
{{ with .GitInfo }}
|
||||
{{ .CommitDate.Format "2006-01-02" }} → 2023-10-09
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
###### Hash
|
||||
|
||||
(`string`) The commit hash.
|
||||
|
||||
```go-html-template
|
||||
{{ with .GitInfo }}
|
||||
@@ -88,8 +103,9 @@ Hash
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
Subject
|
||||
: (`string`) The commit message subject.
|
||||
###### Subject
|
||||
|
||||
(`string`) The commit message subject.
|
||||
|
||||
```go-html-template
|
||||
{{ with .GitInfo }}
|
||||
|
@@ -10,7 +10,7 @@ action:
|
||||
- methods/page/PrevInSection
|
||||
- methods/pages/Next
|
||||
- methods/pages/Prev
|
||||
returnType: hugolib.pageState
|
||||
returnType: page.Page
|
||||
signatures: [PAGE.Next]
|
||||
toc: true
|
||||
---
|
||||
|
@@ -10,7 +10,7 @@ action:
|
||||
- methods/page/Prev
|
||||
- methods/pages/Next
|
||||
- methods/pages/Prev
|
||||
returnType: hugolib.pageState
|
||||
returnType: page.Page
|
||||
signatures: [PAGE.NextInSection]
|
||||
---
|
||||
|
||||
|
@@ -5,7 +5,7 @@ categories: []
|
||||
keywords: []
|
||||
action:
|
||||
related: []
|
||||
returnType: hugolib.pageState
|
||||
returnType: page.Page
|
||||
signatures: [PAGE.Page]
|
||||
---
|
||||
|
||||
|
@@ -18,7 +18,6 @@ With this front matter:
|
||||
title = 'Annual conference'
|
||||
date = 2023-10-17T15:11:37-07:00
|
||||
display_related = true
|
||||
event-date = '2023'
|
||||
[params.author]
|
||||
email = 'jsmith@example.org'
|
||||
name = 'John Smith'
|
||||
@@ -36,8 +35,9 @@ Access the custom parameters by [chaining] the [identifiers]:
|
||||
In the template example 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:
|
||||
|
||||
```go-html-template
|
||||
{{ index .Params "event-date" }} → 2023
|
||||
{{ index .Params "key-with-hyphens" }} → 2023
|
||||
```
|
||||
|
||||
[`index`]: /functions/collections/indexfunction
|
||||
[chaining]: /getting-started/glossary/#chain
|
||||
[identifiers]: /getting-started/glossary/#identifier
|
||||
|
@@ -12,7 +12,7 @@ action:
|
||||
- methods/page/IsAncestor
|
||||
- methods/page/IsDescendant
|
||||
- methods/page/Sections
|
||||
returnType: hugolib.pageState
|
||||
returnType: page.Page
|
||||
signatures: [PAGE.Parent]
|
||||
---
|
||||
|
||||
|
@@ -21,5 +21,5 @@ Template:
|
||||
|
||||
```go-html-template
|
||||
{{ $page := .Site.GetPage "/about" }}
|
||||
{{ $page.RelPermalink }} → https://example.org/docs/about/
|
||||
{{ $page.Permalink }} → https://example.org/docs/about/
|
||||
```
|
||||
|
@@ -10,7 +10,7 @@ action:
|
||||
- methods/page/NextInSection
|
||||
- methods/pages/Prev
|
||||
- methods/pages/Next
|
||||
returnType: hugolib.pageState
|
||||
returnType: page.Page
|
||||
signatures: [PAGE.Prev]
|
||||
toc: true
|
||||
---
|
||||
|
@@ -10,7 +10,7 @@ action:
|
||||
- methods/pages/Next
|
||||
- methods/page/Prev
|
||||
- methods/pages/Prev
|
||||
returnType: hugolib.pageState
|
||||
returnType: page.Page
|
||||
signatures: [PAGE.PrevInSection]
|
||||
---
|
||||
|
||||
|
@@ -21,5 +21,5 @@ Template:
|
||||
|
||||
```go-html-template
|
||||
{{ $page := .Site.GetPage "/about" }}
|
||||
{{ $page.Permalink }} → /docs/about/
|
||||
{{ $page.RelPermalink }} → /docs/about/
|
||||
```
|
||||
|
@@ -21,8 +21,9 @@ To work with global or remote resources, see the [`resources`] functions.
|
||||
|
||||
## Methods
|
||||
|
||||
ByType
|
||||
: (`resource.Resources`) Returns a collection of page resources of the given [media type], or nil if none found. The media type is typically one of `image`, `text`, `audio`, `video`, or `application`.
|
||||
###### ByType
|
||||
|
||||
(`resource.Resources`) Returns a collection of page resources of the given [media type], or nil if none found. The media type is typically one of `image`, `text`, `audio`, `video`, or `application`.
|
||||
|
||||
```go-html-template
|
||||
{{ range .Resources.ByType "image" }}
|
||||
@@ -32,8 +33,9 @@ ByType
|
||||
|
||||
When working with global resources instead of page resources, use the [`resources.ByType`] function.
|
||||
|
||||
Get
|
||||
: (`resource.Resource`) Returns a page resource from the given path, or nil if none found.
|
||||
###### Get
|
||||
|
||||
(`resource.Resource`) Returns a page resource from the given path, or nil if none found.
|
||||
|
||||
```go-html-template
|
||||
{{ with .Resources.Get "images/a.jpg" }}
|
||||
@@ -43,8 +45,9 @@ Get
|
||||
|
||||
When working with global resources instead of page resources, use the [`resources.Get`] function.
|
||||
|
||||
GetMatch
|
||||
: (`resource.Resource`) Returns the first page resource from paths matching the given [glob pattern], or nil if none found.
|
||||
###### GetMatch
|
||||
|
||||
(`resource.Resource`) Returns the first page resource from paths matching the given [glob pattern], or nil if none found.
|
||||
|
||||
```go-html-template
|
||||
{{ with .Resources.GetMatch "images/*.jpg" }}
|
||||
@@ -54,8 +57,9 @@ GetMatch
|
||||
|
||||
When working with global resources instead of page resources, use the [`resources.GetMatch`] function.
|
||||
|
||||
Match
|
||||
: (`resource.Resources`) Returns a collection of page resources from paths matching the given [glob pattern], or nil if none found.
|
||||
###### Match
|
||||
|
||||
(`resource.Resources`) Returns a collection of page resources from paths matching the given [glob pattern], or nil if none found.
|
||||
|
||||
```go-html-template
|
||||
{{ range .Resources.Match "images/*.jpg" }}
|
||||
|
@@ -22,25 +22,28 @@ To create a locally scoped scratch pad that is not attached to a `Page` object,
|
||||
|
||||
## Methods
|
||||
|
||||
Set
|
||||
: Sets the value of a given key.
|
||||
###### Set
|
||||
|
||||
Sets the value of a given key.
|
||||
|
||||
```go-html-template
|
||||
{{ .Store.Set "greeting" "Hello" }}
|
||||
```
|
||||
|
||||
Get
|
||||
: Gets the value of a given key.
|
||||
###### Get
|
||||
|
||||
Gets the value of a given key.
|
||||
|
||||
```go-html-template
|
||||
{{ .Store.Set "greeting" "Hello" }}
|
||||
{{ .Store.Get "greeting" }} → Hello
|
||||
```
|
||||
|
||||
Add
|
||||
: Adds a given value to existing value(s) of the given key.
|
||||
###### Add
|
||||
|
||||
: For single values, `Add` accepts values that support Go's `+` operator. If the first `Add` for a key is an array or slice, the following adds will be appended to that list.
|
||||
Adds a given value to existing value(s) of the given key.
|
||||
|
||||
For single values, `Add` accepts values that support Go's `+` operator. If the first `Add` for a key is an array or slice, the following adds will be appended to that list.
|
||||
|
||||
```go-html-template
|
||||
{{ .Store.Set "greeting" "Hello" }}
|
||||
@@ -60,8 +63,9 @@ Add
|
||||
{{ .Store.Get "greetings" }} → [Hello Welcome Cheers]
|
||||
```
|
||||
|
||||
SetInMap
|
||||
: Takes a `key`, `mapKey` and `value` and adds a map of `mapKey` and `value` to the given `key`.
|
||||
###### SetInMap
|
||||
|
||||
Takes a `key`, `mapKey` and `value` and adds a map of `mapKey` and `value` to the given `key`.
|
||||
|
||||
```go-html-template
|
||||
{{ .Store.SetInMap "greetings" "english" "Hello" }}
|
||||
@@ -69,8 +73,9 @@ SetInMap
|
||||
{{ .Store.Get "greetings" }} → map[english:Hello french:Bonjour]
|
||||
```
|
||||
|
||||
DeleteInMap
|
||||
: Takes a `key` and `mapKey` and removes the map of `mapKey` from the given `key`.
|
||||
###### DeleteInMap
|
||||
|
||||
Takes a `key` and `mapKey` and removes the map of `mapKey` from the given `key`.
|
||||
|
||||
```go-html-template
|
||||
{{ .Store.SetInMap "greetings" "english" "Hello" }}
|
||||
@@ -79,8 +84,9 @@ DeleteInMap
|
||||
{{ .Store.Get "greetings" }} → map[french:Bonjour]
|
||||
```
|
||||
|
||||
GetSortedMapValues
|
||||
: Returns an array of values from `key` sorted by `mapKey`.
|
||||
###### GetSortedMapValues
|
||||
|
||||
Returns an array of values from `key` sorted by `mapKey`.
|
||||
|
||||
```go-html-template
|
||||
{{ .Store.SetInMap "greetings" "english" "Hello" }}
|
||||
@@ -88,8 +94,9 @@ GetSortedMapValues
|
||||
{{ .Store.GetSortedMapValues "greetings" }} → [Hello Bonjour]
|
||||
```
|
||||
|
||||
Delete
|
||||
: Removes the given key.
|
||||
###### Delete
|
||||
|
||||
Removes the given key.
|
||||
|
||||
```go-html-template
|
||||
{{ .Store.Set "greeting" "Hello" }}
|
||||
|
@@ -63,8 +63,9 @@ And this template:
|
||||
{{ with .Translations }}
|
||||
<ul>
|
||||
{{ range . }}
|
||||
{{ $lang := .Language.LanguageName}}
|
||||
<li><a href="{{ .RelPermalink }}">{{ .LinkTitle }} ({{ $lang }})</a></li>
|
||||
{{ $langName := or .Language.LanguageName .Language.Lang }}
|
||||
{{ $langCode := or .Language.LanguageCode .Language.Lang }}
|
||||
<li><a href="{{ .RelPermalink }}" hreflang="{{ $langCode }}">{{ .LinkTitle }} ({{ $langName }})</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
@@ -74,8 +75,8 @@ Hugo will render this list on the "Book 1" page of the English site:
|
||||
|
||||
```html
|
||||
<ul>
|
||||
<li><a href="/de/books/book-1/">Book 1 (Deutsch)</a></li>
|
||||
<li><a href="/fr/books/book-1/">Book 1 (Français)</a></li>
|
||||
<li><a href="/de/books/book-1/" hreflang="de-DE">Book 1 (Deutsch)</a></li>
|
||||
<li><a href="/fr/books/book-1/" hreflang="fr-FR">Book 1 (Français)</a></li>
|
||||
</ul>
|
||||
```
|
||||
|
||||
@@ -83,6 +84,6 @@ Hugo will render this list on the "Book 2" page of the English site:
|
||||
|
||||
```html
|
||||
<ul>
|
||||
<li><a href="/de/books/book-1/">Book 1 (Deutsch)</a></li>
|
||||
<li><a href="/de/books/book-1/" hreflang="de-DE">Book 1 (Deutsch)</a></li>
|
||||
</ul>
|
||||
```
|
||||
|
@@ -4,25 +4,28 @@
|
||||
|
||||
## Methods
|
||||
|
||||
Set
|
||||
: Sets the value of a given key.
|
||||
###### Set
|
||||
|
||||
Sets the value of a given key.
|
||||
|
||||
```go-html-template
|
||||
{{ .Scratch.Set "greeting" "Hello" }}
|
||||
```
|
||||
|
||||
Get
|
||||
: Gets the value of a given key.
|
||||
###### Get
|
||||
|
||||
Gets the value of a given key.
|
||||
|
||||
```go-html-template
|
||||
{{ .Scratch.Set "greeting" "Hello" }}
|
||||
{{ .Scratch.Get "greeting" }} → Hello
|
||||
```
|
||||
|
||||
Add
|
||||
: Adds a given value to existing value(s) of the given key.
|
||||
###### Add
|
||||
|
||||
: For single values, `Add` accepts values that support Go's `+` operator. If the first `Add` for a key is an array or slice, the following adds will be appended to that list.
|
||||
Adds a given value to existing value(s) of the given key.
|
||||
|
||||
For single values, `Add` accepts values that support Go's `+` operator. If the first `Add` for a key is an array or slice, the following adds will be appended to that list.
|
||||
|
||||
```go-html-template
|
||||
{{ .Scratch.Set "greeting" "Hello" }}
|
||||
@@ -42,8 +45,9 @@ Add
|
||||
{{ .Scratch.Get "greetings" }} → [Hello Welcome Cheers]
|
||||
```
|
||||
|
||||
SetInMap
|
||||
: Takes a `key`, `mapKey` and `value` and adds a map of `mapKey` and `value` to the given `key`.
|
||||
###### SetInMap
|
||||
|
||||
Takes a `key`, `mapKey` and `value` and adds a map of `mapKey` and `value` to the given `key`.
|
||||
|
||||
```go-html-template
|
||||
{{ .Scratch.SetInMap "greetings" "english" "Hello" }}
|
||||
@@ -51,8 +55,9 @@ SetInMap
|
||||
{{ .Scratch.Get "greetings" }} → map[english:Hello french:Bonjour]
|
||||
```
|
||||
|
||||
DeleteInMap
|
||||
: Takes a `key` and `mapKey` and removes the map of `mapKey` from the given `key`.
|
||||
###### DeleteInMap
|
||||
|
||||
Takes a `key` and `mapKey` and removes the map of `mapKey` from the given `key`.
|
||||
|
||||
```go-html-template
|
||||
{{ .Scratch.SetInMap "greetings" "english" "Hello" }}
|
||||
@@ -61,8 +66,9 @@ DeleteInMap
|
||||
{{ .Scratch.Get "greetings" }} → map[french:Bonjour]
|
||||
```
|
||||
|
||||
GetSortedMapValues
|
||||
: Returns an array of values from `key` sorted by `mapKey`.
|
||||
###### GetSortedMapValues
|
||||
|
||||
Returns an array of values from `key` sorted by `mapKey`.
|
||||
|
||||
```go-html-template
|
||||
{{ .Scratch.SetInMap "greetings" "english" "Hello" }}
|
||||
@@ -70,8 +76,9 @@ GetSortedMapValues
|
||||
{{ .Scratch.GetSortedMapValues "greetings" }} → [Hello Bonjour]
|
||||
```
|
||||
|
||||
Delete
|
||||
: Removes the given key.
|
||||
###### Delete
|
||||
|
||||
Removes the given key.
|
||||
|
||||
```go-html-template
|
||||
{{ .Scratch.Set "greeting" "Hello" }}
|
||||
|
@@ -10,7 +10,7 @@ action:
|
||||
- methods/page/NextInSection
|
||||
- methods/page/Prev
|
||||
- methods/page/PrevInSection
|
||||
returnType: hugolib.pageState
|
||||
returnType: page.Page
|
||||
signatures: [PAGES.Next PAGE]
|
||||
toc: true
|
||||
---
|
||||
|
@@ -10,7 +10,7 @@ action:
|
||||
- methods/page/NextInSection
|
||||
- methods/page/Prev
|
||||
- methods/page/PrevInSection
|
||||
returnType: hugolib.pageStates
|
||||
returnType: page.Pages
|
||||
signatures: [PAGES.Prev PAGE]
|
||||
toc: true
|
||||
---
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Exif
|
||||
description: Applicable to images, returns an EXIF object containing image metadata.
|
||||
description: Applicable to JPEG and TIFF images, returns an EXIF object containing image metadata.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
@@ -10,7 +10,7 @@ action:
|
||||
toc: true
|
||||
---
|
||||
|
||||
Applicable to images, the `Exif` method on an image `Resource` object returns an [EXIF] object containing image metadata.
|
||||
Applicable to JPEG and TIFF images, the `Exif` method on an image `Resource` object returns an [EXIF] object containing image metadata.
|
||||
|
||||
## Methods
|
||||
|
||||
|
@@ -14,7 +14,7 @@ With this content:
|
||||
{{< code-toggle file=content/books/les-miserables.md fm=true >}}
|
||||
title = 'Les Misérables'
|
||||
author = 'Victor Hugo'
|
||||
published = 1862
|
||||
publication_year = 1862
|
||||
isbn = '978-0451419439'
|
||||
{{< /code-toggle >}}
|
||||
|
||||
|
@@ -7,10 +7,7 @@ action:
|
||||
related: []
|
||||
returnType: string
|
||||
signatures: [SITE.DisqusShortname]
|
||||
# deprecated 2023-10-30
|
||||
expiryDate: 2024-10-30
|
||||
_build:
|
||||
list: never
|
||||
expiryDate: 2024-10-30 # deprecated 2023-10-30
|
||||
---
|
||||
|
||||
{{% deprecated-in 0.120.0 %}}
|
||||
|
@@ -6,7 +6,7 @@ keywords: []
|
||||
action:
|
||||
related:
|
||||
- methods/page/GetPage
|
||||
returnType: hugolib.pageState
|
||||
returnType: page.Page
|
||||
signatures: [SITE.GetPage PATH]
|
||||
toc: true
|
||||
---
|
||||
|
@@ -7,10 +7,7 @@ action:
|
||||
related: []
|
||||
returnType: string
|
||||
signatures: [SITE.GoogleAnalytics]
|
||||
# deprecated 2023-10-30
|
||||
expiryDate: 2024-10-30
|
||||
_build:
|
||||
list: never
|
||||
expiryDate: 2024-10-30 # deprecated 2023-10-30
|
||||
---
|
||||
|
||||
{{% deprecated-in 0.120.0 %}}
|
||||
|
@@ -5,7 +5,7 @@ categories: []
|
||||
keywords: []
|
||||
action:
|
||||
related: []
|
||||
returnType: hugolib.pageState
|
||||
returnType: page.Page
|
||||
signatures: [SITE.Home]
|
||||
---
|
||||
|
||||
|
@@ -7,10 +7,7 @@ action:
|
||||
related: []
|
||||
returnType: bool
|
||||
signatures: [SITE.IsDevelopment]
|
||||
# deprecated 2023-10-30
|
||||
expiryDate: 2024-10-30
|
||||
_build:
|
||||
list: never
|
||||
expiryDate: 2024-10-30 # deprecated 2023-10-30
|
||||
---
|
||||
|
||||
{{% deprecated-in 0.120.0 %}}
|
||||
@@ -18,3 +15,7 @@ Use [`hugo.IsDevelopment`] instead.
|
||||
|
||||
[`hugo.IsDevelopment`]: /functions/hugo/isdevelopment
|
||||
{{% /deprecated-in %}}
|
||||
|
||||
```go-html-template
|
||||
{{ .Site.IsDevelopment }} → true/false
|
||||
```
|
||||
|
@@ -7,10 +7,7 @@ action:
|
||||
related: []
|
||||
returnType: bool
|
||||
signatures: [SITE.IsServer]
|
||||
# deprecated 2023-10-30
|
||||
expiryDate: 2024-10-30
|
||||
_build:
|
||||
list: never
|
||||
expiryDate: 2024-10-30 # deprecated 2023-10-30
|
||||
---
|
||||
|
||||
{{% deprecated-in 0.120.0 %}}
|
||||
@@ -18,3 +15,7 @@ Use [`hugo.IsServer`] instead.
|
||||
|
||||
[`hugo.IsServer`]: /functions/hugo/isserver
|
||||
{{% /deprecated-in %}}
|
||||
|
||||
```go-html-template
|
||||
{{ .Site.IsServer }} → true/false
|
||||
```
|
||||
|
@@ -22,27 +22,27 @@ Menus can be defined and localized in several ways. Please see the [menus] secti
|
||||
A site can have multiple menus. For example, a main menu and a footer menu:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[[menu.main]]
|
||||
[[menus.main]]
|
||||
name = 'Home'
|
||||
pageRef = '/'
|
||||
weight = 10
|
||||
|
||||
[[menu.main]]
|
||||
[[menus.main]]
|
||||
name = 'Books'
|
||||
pageRef = '/books'
|
||||
weight = 20
|
||||
|
||||
[[menu.main]]
|
||||
[[menus.main]]
|
||||
name = 'Films'
|
||||
pageRef = '/films'
|
||||
weight = 30
|
||||
|
||||
[[menu.footer]]
|
||||
[[menus.footer]]
|
||||
name = 'Legal'
|
||||
pageRef = '/legal'
|
||||
weight = 10
|
||||
|
||||
[[menu.footer]]
|
||||
[[menus.footer]]
|
||||
name = 'Privacy'
|
||||
pageRef = '/privacy'
|
||||
weight = 20
|
||||
|
@@ -10,7 +10,7 @@ Count
|
||||
: (`int`) Returns the number of pages to which the term is assigned.
|
||||
|
||||
Page
|
||||
: (`hugolib.pageState`) Returns the term's `Page` object, useful for linking to the term page.
|
||||
: (`page.Page`) Returns the term's `Page` object, useful for linking to the term page.
|
||||
|
||||
Pages
|
||||
: (`page.Pages`) Returns a `Pages` object containing the `Page` objects to which the term is assigned, sorted by [taxonomic weight]. To sort or group, use any of the [methods] available to the `Pages` object. For example, sort by the last modification date.
|
||||
|
Reference in New Issue
Block a user