Skip to content

Commit 9117f1d

Browse files
committed
all: Updates required for v0.123.0
Closes gohugoio#2385
1 parent 33d8c10 commit 9117f1d

File tree

14 files changed

+209
-71
lines changed

14 files changed

+209
-71
lines changed

content/en/content-management/page-bundles.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ A Page Bundle can be one of:
1818
- Leaf Bundle (leaf means it has no children)
1919
- Branch Bundle (home page, section, taxonomy terms, taxonomy list)
2020

21-
| | Leaf Bundle | Branch Bundle |
22-
|-------------------------------------|----------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
23-
| Usage | Collection of content and attachments for single pages | Collection of attachments for section pages (home page, section, taxonomy terms, taxonomy list) |
24-
| Index file name | `index.md` [^fn:1] | `_index.md` [^fn:1] |
25-
| Allowed Resources | Page and non-page (like images, PDF, etc.) types | Only non-page (like images, PDF, etc.) types |
26-
| Where can the Resources live? | At any directory level within the leaf bundle directory. | Only in the directory level **of** the branch bundle directory i.e. the directory containing the `_index.md` ([ref](https://discourse.gohugo.io/t/question-about-content-folder-structure/11822/4?u=kaushalmodi)). |
27-
| Layout type | [`single`](/templates/single-page-templates/) | [`list`](/templates/lists) |
28-
| Nesting | Does not allow nesting of more bundles under it | Allows nesting of leaf or branch bundles under it |
29-
| Example | `content/posts/my-post/index.md` | `content/posts/_index.md` |
30-
| Content from non-index page files...| Accessed only as page resources | Accessed only as regular pages |
21+
| | Leaf Bundle | Branch Bundle |
22+
|-------------------------------------|----------------------------------------------------------|-------------------------------------------------------------------------------------------------|
23+
| Usage | Collection of content and attachments for single pages | Collection of attachments for section pages (home page, section, taxonomy terms, taxonomy list) |
24+
| Index file name | `index.md` [^fn:1] | `_index.md` [^fn:1] |
25+
| Allowed Resources | Page and non-page (like images, PDF, etc.) types | Only non-page (like images, PDF, etc.) types |
26+
| Where can the Resources live? | At any directory level within the leaf bundle directory. | At any directory level within the branch bundle directory. |
27+
| Layout type | [`single`](/templates/single-page-templates/) | [`list`](/templates/lists) |
28+
| Nesting | Does not allow nesting of more bundles under it | Allows nesting of leaf or branch bundles under it |
29+
| Example | `content/posts/my-post/index.md` | `content/posts/_index.md` |
30+
| Content from non-index page files...| Accessed only as page resources | Accessed only as regular pages |
3131

3232
## Leaf bundles
3333

content/en/functions/data/GetCSV.md

+12
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,18 @@ action:
1515
toc: true
1616
---
1717

18+
{{% deprecated-in 0.123.0 %}}
19+
Instead, use [`transform.Unmarshal`] with a [global], [page], or [remote] resource.
20+
21+
See the [remote data example].
22+
23+
[`transform.Unmarshal`]: /functions/transform/unmarshal/
24+
[global]: /getting-started/glossary/#global-resource
25+
[page]: /getting-started/glossary/#page-resource
26+
[remote data example]: /functions/resources/getremote/#remote-data
27+
[remote]: /getting-started/glossary/#remote-resource
28+
{{% /deprecated-in %}}
29+
1830
Given the following directory structure:
1931

2032
```text

content/en/functions/data/GetJSON.md

+12
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,18 @@ action:
1515
toc: true
1616
---
1717

18+
{{% deprecated-in 0.123.0 %}}
19+
Instead, use [`transform.Unmarshal`] with a [global], [page], or [remote] resource.
20+
21+
See the [remote data example].
22+
23+
[`transform.Unmarshal`]: /functions/transform/unmarshal/
24+
[global]: /getting-started/glossary/#global-resource
25+
[page]: /getting-started/glossary/#page-resource
26+
[remote data example]: /functions/resources/getremote/#remote-data
27+
[remote]: /getting-started/glossary/#remote-resource
28+
{{% /deprecated-in %}}
29+
1830
Given the following directory structure:
1931

2032
```text

content/en/functions/fmt/Errorf.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ action:
88
related:
99
- functions/fmt/Erroridf
1010
- functions/fmt/Warnf
11+
- functions/fmt/Warnidf
1112
returnType: string
1213
signatures: ['fmt.Errorf FORMAT [INPUT]']
1314
aliases: [/functions/errorf]

content/en/functions/fmt/Erroridf.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ action:
88
related:
99
- functions/fmt/Errorf
1010
- functions/fmt/Warnf
11+
- functions/fmt/Warnidf
1112
returnType: string
1213
signatures: ['fmt.Erroridf ID FORMAT [INPUT]']
1314
aliases: [/functions/erroridf]
1415
---
1516

1617
{{% include "functions/fmt/_common/fmt-layout.md" %}}
1718

18-
The `erroridf` function evaluates the format string, then prints the result to the ERROR log and fails the build. Unlike the [`errorf`] function, you may suppress errors logged by the `erroridf` function by adding the message ID to the `ignoreErrors` array in your site configuration.
19+
The `erroridf` function evaluates the format string, then prints the result to the ERROR log and fails the build. Unlike the [`errorf`] function, you may suppress errors logged by the `erroridf` function by adding the message ID to the `ignoreLogs` array in your site configuration.
1920

2021
This template code:
2122

@@ -28,13 +29,13 @@ Produces this console log:
2829
```text
2930
ERROR You should consider fixing this.
3031
You can suppress this error by adding the following to your site configuration:
31-
ignoreErrors = ['error-42']
32+
ignoreLogs = ['error-42']
3233
```
3334

3435
To suppress this message:
3536

3637
{{< code-toggle file=hugo >}}
37-
ignoreErrors = ["error-42"]
38+
ignoreLogs = ["error-42"]
3839
{{< /code-toggle >}}
3940

4041
[`errorf`]: /functions/fmt/errorf

content/en/functions/fmt/Warnf.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ action:
88
related:
99
- functions/fmt/Errorf
1010
- functions/fmt/Erroridf
11+
- functions/fmt/Warnidf
1112
returnType: string
1213
signatures: ['fmt.Warnf FORMAT [INPUT]']
1314
aliases: [/functions/warnf]

content/en/functions/fmt/Warnidf.md

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
title: fmt.Warnidf
3+
description: Log a suppressable WARNING from a template.
4+
categories: []
5+
keywords: []
6+
action:
7+
aliases: [warnidf]
8+
related:
9+
- functions/fmt/Errorf
10+
- functions/fmt/Erroridf
11+
- functions/fmt/Warnf
12+
returnType: string
13+
signatures: ['fmt.Warnidf ID FORMAT [INPUT]']
14+
aliases: [/functions/warnidf]
15+
---
16+
17+
{{< new-in 0.123.0 >}}
18+
19+
{{% include "functions/fmt/_common/fmt-layout.md" %}}
20+
21+
The `warnidf` function evaluates the format string, then prints the result to the WARNING log. Unlike the [`warnf`] function, you may suppress warnings logged by the `warnidf` function by adding the message ID to the `ignoreLogs` array in your site configuration.
22+
23+
This template code:
24+
25+
```go-html-template
26+
{{ warnidf "warning-42" "You should consider fixing this." }}
27+
```
28+
29+
Produces this console log:
30+
31+
```text
32+
WARN You should consider fixing this.
33+
You can suppress this warning by adding the following to your site configuration:
34+
ignoreLogs = ['warning-42']
35+
```
36+
37+
To suppress this message:
38+
39+
{{< code-toggle file=hugo >}}
40+
ignoreLogs = ["warning-42"]
41+
{{< /code-toggle >}}
42+
43+
[`warnf`]: /functions/fmt/warnf

content/en/methods/page/BundleType.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ categories: []
55
keywords: []
66
action:
77
related: []
8-
returnType: files.ContentClass
8+
returnType: string
99
signatures: [PAGE.BundleType]
1010
---
1111

content/en/methods/site/LastChange.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,16 @@ action:
99
signatures: [SITE.LastChange]
1010
---
1111

12+
{{% deprecated-in 0.123.0 %}}
13+
Use [`.Site.Lastmod`] instead.
14+
15+
[`.Site.Lastmod`]: /methods/site/lastmod/
16+
{{% /deprecated-in %}}
17+
1218
The `LastChange` method on a `Site` object returns a [`time.Time`] value. Use this with time [functions] and [methods]. For example:
1319

1420
```go-html-template
15-
{{ .Site.LastChange | time.Format ":date_long" }} → October 16, 2023
21+
{{ .Site.LastChange | time.Format ":date_long" }} → January 31, 2024
1622
1723
```
1824

content/en/methods/site/Lastmod.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
title: Lastmod
3+
description: Returns the last modification date of site content.
4+
categories: []
5+
keywords: []
6+
action:
7+
related: []
8+
returnType: time.Time
9+
signatures: [SITE.Lastmod]
10+
---
11+
12+
{{< new-in 0.123.0 >}}
13+
14+
The `Lastmod` method on a `Site` object returns a [`time.Time`] value. Use this with time [functions] and [methods]. For example:
15+
16+
```go-html-template
17+
{{ .Site.Lastmod | time.Format ":date_long" }} → October 16, 2023
18+
19+
```
20+
21+
[`time.Time`]: https://pkg.go.dev/time#Time
22+
[functions]: /functions/time
23+
[methods]: /methods/time

content/en/methods/site/Sites.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Sites
3-
description: Returns a collection of all Site objects, one for each language, ordered by language weight.
3+
description: Returns a collection of all Site objects, one for each language, ordered by default content language then by language weight.
44
categories: []
55
keywords: []
66
action:

content/en/templates/output-formats.md

+38-22
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Given a media type and some additional configuration, you get an **Output Format
6363

6464
This is the full set of Hugo's built-in output formats:
6565

66-
{{< datatable "config" "outputFormats" "name" "mediaType" "path" "baseName" "rel" "protocol" "isPlainText" "isHTML" "noUgly" "permalinkable" >}}
66+
{{< datatable "config" "outputFormats" "name" "baseName" "isHTML" "isPlainText" "mediaType" "noUgly" "path" "permalinkable" "protocol" "rel" >}}
6767

6868
- A page can be output in as many output formats as you want, and you can have an infinite amount of output formats defined **as long as they resolve to a unique path on the file system**. In the above table, the best example of this is `amp` vs. `html`. `amp` has the value `amp` for `path` so it doesn't overwrite the `html` version; e.g. we can now have both `/index.html` and `/amp/index.html`.
6969
- The `mediaType` must match a defined media type.
@@ -83,40 +83,56 @@ The above example is fictional, but if used for the homepage on a site with `bas
8383

8484
### Configure output formats
8585

86-
The following is the full list of configuration options for output formats and their default values:
86+
Use these parameters when configuring an output format:
8787

88-
mediaType
89-
: this must match the `Type` of a defined media type.
88+
baseName
89+
: (`string`) The base name of the published file. Default is `index`.
9090

91-
path
92-
: sub path to save the output files.
91+
isHTML
92+
: (`bool`) If `true`, classifies the output format as HTML. Hugo uses this value to determine when to create alias redirects, when to inject the LiveReload script, etc. Default is `false`.
9393

94-
baseName
95-
: the base file name for the list file names (homepage, etc.). **Default:** `index`.
94+
isPlainText
95+
: (`bool`) If `true`, Hugo parses templates for this output format with Go's [text/template] package instead of the [html/template] package. Default is `false`.
9696

97-
rel
98-
: can be used to create `rel` values in `link` tags. **Default:** `alternate`.
97+
[html/template]: https://pkg.go.dev/html/template
98+
[text/template]: https://pkg.go.dev/text/template
9999

100-
protocol
101-
: will replace the "http://" or "https://" in your `baseURL` for this output format.
100+
mediaType
101+
: (`string`) The [media type] of the published file. This must match a defined media type, either [built-in](#media-types) or custom.
102102

103-
isPlainText
104-
: use Go's plain text templates parser for the templates. **Default:** `false`.
103+
[media type]: https://en.wikipedia.org/wiki/Media_type
105104

106-
isHTML
107-
: used in situations only relevant for `HTML`-type formats; e.g., page aliases. **Default:** `false`.
105+
notAlternative
106+
: (`bool`) If `true`, excludes this output format from the values returned by the [`AlternativeOutputFormats`] method on a `Page` object. Default is `false`.
107+
108+
[`AlternativeOutputFormats`]: /methods/page/alternativeoutputformats/
108109

109110
noUgly
110-
: used to turn off ugly URLs If `uglyURLs` is set to `true` in your site. **Default:** `false`.
111+
: (`bool`) If `true`, disables ugly URLs for this output format when `uglyURLs` is `true` in your site configuration. Default is `false`.
111112

112-
notAlternative
113-
: enable if it doesn't make sense to include this format in an `AlternativeOutputFormats` format listing on `Page` (e.g., with `CSS`). Note that we use the term _alternative_ and not _alternate_ here, as it does not necessarily replace the other format. **Default:** `false`.
113+
path
114+
: (`string`) The path to the directory containing the published files, relative to the root of the publish directory.
114115

115116
permalinkable
116-
: make `.Permalink` and `.RelPermalink` return the rendering Output Format rather than main ([see below](#link-to-output-formats)). This is enabled by default for `HTML` and `AMP`. **Default:** `false`.
117+
: (`bool`) If `true`, the [`Permalink`] and [`RelPermalink`] methods on a `Page` object return the rendering output format rather than main ouptut format ([see below](#link-to-output-formats)). Enabled by default for the `html` and `amp` output formats. Default is `false`.
118+
119+
[`Permalink`]: /methods/page/permalink/
120+
[`RelPermalink`]: /methods/page/relpermalink/
121+
122+
protocol
123+
: (`string`) The protocol (scheme) of the URL for this output format. For example, `https://` or `webcal://`. Default is the scheme of the `baseURL` parameter in your site configuration, typically `https://`.
124+
125+
rel
126+
: (`string`) If provided, you can assign this value to `rel` attributes in `link` elements when iterating over ouput formats in your templates. Default is `alternate`.
127+
128+
root
129+
: (`bool`) If `true`, files will be published to the root of the publish directory. Default is `false`.
130+
131+
ugly
132+
: (`bool`) If `true`, enables uglyURLs for this output format when `uglyURLs` is `false` in your site configuration. Default is `false`.
117133

118134
weight
119-
: Setting this to a non-zero value will be used as the first sort criteria.
135+
: (`int`) When set to a non-zero value, Hugo uses the `weight` as the first criteria when sorting output formats, falling back to the name of the output format. Lighter items float to the top, while heavier items sink to the bottom. Hugo renders output formats sequentially based on the sort order.
120136

121137
## Output formats for pages
122138

@@ -172,7 +188,7 @@ Each `Page` has both an `.OutputFormats` (all formats, including the current) an
172188

173189
## Link to output formats
174190

175-
`.Permalink` and `.RelPermalink` on `Page` will return the first output format defined for that page (usually `HTML` if nothing else is defined). This is regardless of the template file they are being called from.
191+
The `Permalink` and `RelPermalink` methods on a `Page` object return the first output format defined for that page (usually `HTML` if nothing else is defined). This is regardless of the template from which they are called.
176192

177193
__from `single.json.json`:__
178194
```go-html-template

content/en/troubleshooting/faq.md

-11
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,6 @@ In the content/_index.md file:
3939

4040
If the answer to any of these questions is yes, either change the field values, or use one of these command line flags: `--buildDrafts`, `--buildFuture`, or `--buildExpired`.
4141

42-
###### Why is a given section not published?
43-
44-
In the content/section/_index.md file:
45-
46-
- Is `draft` set to `true`?
47-
- Is the `date` in the future?
48-
- Is the `publishDate` in the future?
49-
- Is the `expiryDate` in the past?
50-
51-
If the answer to any of these questions is yes, either change the field values, or use one of these command line flags: `--buildDrafts`, `--buildFuture`, or `--buildExpired`.
52-
5342
###### Why is a given page not published?
5443

5544
In the content/section/page.md file, or in the content/section/page/index.md file:

0 commit comments

Comments
 (0)