Skip to content

Commit 33691da

Browse files
committed
content: Define canonical output format and default site
Closes gohugoio#3339
1 parent 84b7279 commit 33691da

File tree

24 files changed

+213
-97
lines changed

24 files changed

+213
-97
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
_comment: Do not remove front matter.
3+
---
4+
5+
To use this method you must first select a specific [output format](g) from a page's [`OutputFormats`][] collection using the [`Get`][] or [`Canonical`][] methods.
6+
7+
[`Canonical`]: /methods/page/outputformats/#canonical
8+
[`Get`]: /methods/page/outputformats/#get
9+
[`OutputFormats`]: /methods/page/outputformats/

content/en/_common/methods/page/output-format-methods.md

Lines changed: 0 additions & 47 deletions
This file was deleted.

content/en/about/features.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ weight: 20
6060

6161
## Content management
6262

63-
[Multi-dimensional content model]
63+
[Multidimensional content model]
6464
: Generate pages across any combination of language, role, and version from a single source. This allows a single piece of content to be published to multiple [sites](g) within your project, removing the need to duplicate files for different audiences or versions.
6565

6666
[Content adapters]
@@ -123,7 +123,7 @@ weight: 20
123123
[Syntax highlighting]: /content-management/syntax-highlighting/
124124
[Shortcodes]: /content-management/shortcodes/
125125

126-
[Multi-dimensional content model]: /quick-reference/glossary/#sites-matrix
126+
[Multidimensional content model]: /quick-reference/glossary/#sites-matrix
127127
[Content adapters]: /content-management/content-adapters/
128128
[Taxonomies]: /content-management/taxonomies/
129129
[Data]: /content-management/data-sources/

content/en/configuration/all.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ disableDefaultLanguageRedirect
9494

9595
disableDefaultSiteRedirect
9696
: {{< new-in 0.154.5 />}}
97-
: (bool) Whether to disable generation of the alias redirect to the default site. When [`defaultContentLanguageInSubdir`][], [`defaultContentRoleInSubdir`][], or [`defaultContentVersionInSubdir`][] is `true`, this prevents the root directory from redirecting to the default site's subdirectory. Conversely, when these are `false`, it prevents the subdirectories from redirecting back to the root. The default site is the site with the default content language, version, and role. Default is `false`.
97+
: (bool) Whether to disable generation of the alias redirect to the [default site](g). When [`defaultContentLanguageInSubdir`][], [`defaultContentRoleInSubdir`][], or [`defaultContentVersionInSubdir`][] is `true`, this prevents the root directory from redirecting to the default site's subdirectory. Conversely, when these are `false`, it prevents the subdirectories from redirecting back to the root. The default site is the site with the default content language, version, and role. Default is `false`.
9898

9999
disableHugoGeneratorInject
100100
: (`bool`) Whether to disable injection of a `<meta name="generator">` tag into the home page. Default is `false`.

content/en/configuration/markup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ backend
212212
: (`string`) The backend output file format. Default is `html5`.
213213

214214
extensions
215-
: (`string array`) An array of enabled extensions, such as `asciidoctor-html5s`, `asciidoctor-bibtex`, or `asciidoctor-diagram`.
215+
: (`[]string`) An array of enabled extensions, such as `asciidoctor-html5s`, `asciidoctor-bibtex`, or `asciidoctor-diagram`.
216216

217217
> [!note]
218218
> To mitigate security risks, entries in the extension array may not contain forward slashes (`/`), backslashes (`\`), or periods. Due to this restriction, extensions must be in Ruby's `$LOAD_PATH`.

content/en/configuration/output-formats.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ protocol
6565
: (`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://`.
6666

6767
rel
68-
: (`string`) If provided, you can assign this value to `rel` attributes in `link` elements when iterating over output formats in your templates. Default is `alternate`.
68+
: (`string`) The relationship of the output format to the current page. Hugo uses this property to determine the [canonical output format](g) of the current page. For the predefined `html` output format, the default value is `canonical`; for all other predefined output formats, the default value is `alternate`.
6969

7070
root
7171
: (`bool`) Whether to publish files to the root of the publish directory. Default is `false`.

content/en/content-management/front-matter.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ The most common front matter fields are `date`, `draft`, `title`, and `weight`,
4141
[parameters]: #parameters
4242

4343
aliases
44-
: (`string array`) An array of one or more [page-relative](g) or [site-relative](g) paths that should redirect to the current page. Hugo resolves these to [server-relative](g) URLs during the build process. Access these values from a template using the [`Aliases`] method on a `Page` object. See the [aliases] section for details.
44+
: (`[]string`) An array of one or more [page-relative](g) or [site-relative](g) paths that should redirect to the current page. Hugo resolves these to [server-relative](g) URLs during the build process. Access these values from a template using the [`Aliases`] method on a `Page` object. See the [aliases] section for details.
4545

4646
build
4747
: (`map`) A map of [build options].
@@ -68,7 +68,7 @@ isCJKLanguage
6868
: (`bool`) Whether the content language is in the [CJK](g) family. This value determines how Hugo calculates word count, and affects the values returned by the [`WordCount`], [`FuzzyWordCount`], [`ReadingTime`], and [`Summary`] methods on a `Page` object.
6969

7070
keywords
71-
: (`string array`) An array of keywords, typically rendered within a `meta` element within the `head` element of the published HTML file, or used as a [taxonomy](g) to classify content. Access these values from a template using the [`Keywords`] method on a `Page` object.
71+
: (`[]string`) An array of keywords, typically rendered within a `meta` element within the `head` element of the published HTML file, or used as a [taxonomy](g) to classify content. Access these values from a template using the [`Keywords`] method on a `Page` object.
7272

7373
lastmod
7474
: (`string`) The date that the page was last modified. Note that the TOML format also supports unquoted date/time values. See the [dates](#dates) section for examples. Access this value from a template using the [`Lastmod`] method on a `Page` object.
@@ -83,13 +83,13 @@ markup
8383
: (`string`) An identifier corresponding to one of the supported [content formats]. If not provided, Hugo determines the content renderer based on the file extension.
8484

8585
menus
86-
: (`string`, `string array`, or `map`) If set, Hugo adds the page to the given menu or menus. See the [menus] page for details.
86+
: (`string`, `[]string`, or `map`) If set, Hugo adds the page to the given menu or menus. See the [menus] page for details.
8787

8888
modified
8989
: Alias to [lastmod](#lastmod).
9090

9191
outputs
92-
: (`string array`) The [output formats] to render. See [configure outputs] for more information.
92+
: (`[]string`) The [output formats] to render. See [configure outputs] for more information.
9393

9494
params
9595
: (`map`) A map of custom [page parameters].

content/en/functions/images/Dither.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ params:
1313
## Options
1414

1515
colors
16-
: (`string array`) A slice of two or more colors that make up the dithering palette, each expressed as an RGB or RGBA [hexadecimal] value, with or without a leading hash mark. The default values are opaque black (`000000ff`) and opaque white (`ffffffff`).
16+
: (`[]string`) A slice of two or more colors that make up the dithering palette, each expressed as an RGB or RGBA [hexadecimal] value, with or without a leading hash mark. The default values are opaque black (`000000ff`) and opaque white (`ffffffff`).
1717

1818
[hexadecimal]: https://developer.mozilla.org/en-US/docs/Web/CSS/hex-color
1919

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
title: MediaType
3+
description: Returns the media type of the given output format.
4+
categories: []
5+
keywords: []
6+
params:
7+
functions_and_methods:
8+
returnType: media.Type
9+
signatures: [OUTPUTFORMAT.MediaType]
10+
---
11+
12+
{{% include "/_common/methods/output-formats/to-use-this-method.md" %}}
13+
14+
```go-html-template
15+
{{ with .Site.Home.OutputFormats.Get "rss" }}
16+
{{ with .MediaType }}
17+
{{ .Type }} → application/rss+xml
18+
{{ .MainType }} → application
19+
{{ .SubType }} → rss
20+
{{ end }}
21+
{{ end }}
22+
```
23+
24+
## Methods
25+
26+
### MainType
27+
28+
(`string`) Returns the main type of the output format's media type.
29+
30+
### SubType
31+
32+
(`string`) Returns the subtype of the current format's media type.
33+
34+
### Type
35+
36+
(`string`) Returns the the current format's media type.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
title: Name
3+
description: Returns the identifier of the given output format.
4+
categories: []
5+
keywords: []
6+
params:
7+
functions_and_methods:
8+
returnType: string
9+
signatures: [OUTPUTFORMAT.Name]
10+
---
11+
12+
{{% include "/_common/methods/output-formats/to-use-this-method.md" %}}
13+
14+
```go-html-template
15+
{{ with .Site.Home.OutputFormats.Get "rss" }}
16+
{{ .Name }} → rss
17+
{{ end }}
18+
```

0 commit comments

Comments
 (0)