Skip to content

Commit

Permalink
Document the capitalizeListTitles site config option
Browse files Browse the repository at this point in the history
  • Loading branch information
jmooring authored Feb 23, 2024
1 parent 2ed3b77 commit 46dd282
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
10 changes: 9 additions & 1 deletion content/en/getting-started/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,14 @@ See [Configure Build](#configure-build).

See [Configure File Caches](#configure-file-caches).

###### capitalizeListTitles

{{< new-in 0.123.3 >}}

(`bool`) Whether to capitalize automatic list titles. Applicable to section, taxonomy, and term pages. Default is `true`. You can change the capitalization style in your site configuration to one of `ap`, `chicago`, `go`, `firstupper`, or `none`. See [details].

[details]: /getting-started/configuration/#configure-title-case

###### cascade

Pass down down default configuration values (front matter) to pages in the content tree. The options in site config is the same as in page front matter, see [Front Matter Cascade](/content-management/front-matter#cascade).
Expand Down Expand Up @@ -385,7 +393,7 @@ See [Content Management](/content-management/urls/#permalinks).

###### pluralizeListTitles

(`bool`) Pluralize titles in lists. Default is `true`.
(`bool`) Whether to pluralize automatic list titles. Applicable to section pages. Default is `true`.

###### publishDir

Expand Down
16 changes: 9 additions & 7 deletions content/en/methods/page/Title.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,21 @@ title = 'About us'
{{ .Title }} → About us
```

With section pages not backed by a file, the `Title` method returns the section name, pluralized and converted to title case.

To disable [pluralization]:
With section, taxonomy, and term pages not backed by a file, the `Title` method returns the section name, capitalized and pluralized. You can disable these transformations by setting [`capitalizeListTitles`] and [`pluralizeListTitles`] in your site configuration. For example:

{{< code-toggle file=hugo >}}
capitalizeListTitles = false
pluralizeListTitles = false
{{< /code-toggle >}}

To change the [title case style], specify one of `ap`, `chicago`, `go`, `firstupper`, or `none`:
You can change the capitalization style in your site configuration to one of `ap`, `chicago`, `go`, `firstupper`, or `none`. For example:

{{< code-toggle file=hugo >}}
titleCaseStyle = "ap"
titleCaseStyle = "firstupper"
{{< /code-toggle >}}

[pluralization]: /functions/inflect/pluralize/
[title case style]: /getting-started/configuration/#configure-title-case
See [details].

[`capitalizeListTitles`]: /getting-started/configuration/#capitalizelisttitles
[`pluralizeListTitles`]: /getting-started/configuration/#pluralizelisttitles
[details]: /getting-started/configuration/#configure-title-case
8 changes: 7 additions & 1 deletion content/en/templates/lists/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,13 @@ Using this same `layouts/_default/list.html` template and applying it to the `qu
{{< /code >}}

{{% note %}}
The default behavior of Hugo is to pluralize list titles; hence the inflection of the `quote` section to "Quotes" when called with the `.Title` [page variable](/methods/page/). You can change this via the `pluralizeListTitles` directive in your [site configuration](/getting-started/configuration/).
By default, Hugo capitalizes and pluralizes automatic list titles including section, taxonomy, and term pages. You can disable these transformations by setting [`capitalizeListTitles`] and [`pluralizeListTitles`] in your site configuration.

You can change the capitalization style in your site configuration to one of `ap`, `chicago`, `go`, `firstupper`, or `none`. See [details].

[`capitalizeListTitles`]: /getting-started/configuration/#capitalizelisttitles
[`pluralizeListTitles`]: /getting-started/configuration/#pluralizelisttitles
[details]: /getting-started/configuration/#configure-title-case
{{% /note %}}

## Example list templates
Expand Down

0 comments on commit 46dd282

Please sign in to comment.