You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| 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]|
| 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 |
| 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]|
| 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 |
Copy file name to clipboardExpand all lines: content/en/functions/fmt/Erroridf.md
+4-3
Original file line number
Diff line number
Diff line change
@@ -8,14 +8,15 @@ action:
8
8
related:
9
9
- functions/fmt/Errorf
10
10
- functions/fmt/Warnf
11
+
- functions/fmt/Warnidf
11
12
returnType: string
12
13
signatures: ['fmt.Erroridf ID FORMAT [INPUT]']
13
14
aliases: [/functions/erroridf]
14
15
---
15
16
16
17
{{% include "functions/fmt/_common/fmt-layout.md" %}}
17
18
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.
19
20
20
21
This template code:
21
22
@@ -28,13 +29,13 @@ Produces this console log:
28
29
```text
29
30
ERROR You should consider fixing this.
30
31
You can suppress this error by adding the following to your site configuration:
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:
- 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`.
69
69
- 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
83
83
84
84
### Configure output formats
85
85
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:
87
87
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`.
90
90
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`.
93
93
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`.
96
96
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
99
99
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.
102
102
103
-
isPlainText
104
-
: use Go's plain text templates parser for the templates. **Default:**`false`.
: 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`.
: 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`.
111
112
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.
114
115
115
116
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`.
117
133
118
134
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.
120
136
121
137
## Output formats for pages
122
138
@@ -172,7 +188,7 @@ Each `Page` has both an `.OutputFormats` (all formats, including the current) an
172
188
173
189
## Link to output formats
174
190
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.
Copy file name to clipboardExpand all lines: content/en/troubleshooting/faq.md
-11
Original file line number
Diff line number
Diff line change
@@ -39,17 +39,6 @@ In the content/_index.md file:
39
39
40
40
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`.
41
41
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
-
53
42
###### Why is a given page not published?
54
43
55
44
In the content/section/page.md file, or in the content/section/page/index.md file:
0 commit comments