mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-09-10 16:37:50 -04:00
Clarify title function
This commit is contained in:
parent
47535dc873
commit
59f8a1f48e
@ -1,29 +1,23 @@
|
|||||||
---
|
---
|
||||||
title: title
|
title: title
|
||||||
description: Converts all characters in the provided string to title case.
|
description: Converts the provided string to title case.
|
||||||
categories: [functions]
|
categories: [functions]
|
||||||
menu:
|
menu:
|
||||||
docs:
|
docs:
|
||||||
parent: functions
|
parent: functions
|
||||||
keywords: [strings]
|
keywords: [strings]
|
||||||
signature:
|
signature:
|
||||||
- "title INPUT"
|
- "title STRING"
|
||||||
- "strings.Title INPUT"
|
- "strings.Title STRING"
|
||||||
relatedfuncs: []
|
relatedfuncs: []
|
||||||
---
|
---
|
||||||
|
|
||||||
```go-html-template
|
```go-html-template
|
||||||
{{ title "BatMan"}}` → "Batman"
|
{{ title "table of contents (TOC)" }} → "Table of Contents (TOC)"
|
||||||
```
|
```
|
||||||
|
|
||||||
Can be combined in pipes. In the following snippet, the link text is cleaned up using `humanize` to remove dashes and `title` to convert the value of `$name` to Initial Caps.
|
By default, Hugo adheres to the capitalization rules in the [Associated Press (AP) Stylebook]. Change your [site configuration] if you would prefer to follow the [Chicago Manual of Style], or to use Go's convention of captilalizing every word.
|
||||||
|
|
||||||
```go-html-template
|
[Associated Press (AP) Stylebook]: https://www.apstylebook.com/
|
||||||
{{ range $name, $items := .Site.Taxonomies.categories }}
|
[Chicago Manual of Style]: https://www.chicagomanualofstyle.org/home.html
|
||||||
<li><a href="{{ printf "%s/%s" "categories" ($name | urlize | lower) | absURL }}">{{ $name | humanize | title }} ({{ len $items }})</a></li>
|
[site configuration]: /getting-started/configuration/#configure-title-case
|
||||||
{{ end }}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Configure Title Case
|
|
||||||
|
|
||||||
The default is AP Stylebook, but you can [configure it](/getting-started/configuration/#configure-title-case).
|
|
||||||
|
@ -575,7 +575,13 @@ status = 404
|
|||||||
|
|
||||||
## Configure Title Case
|
## Configure Title Case
|
||||||
|
|
||||||
Set `titleCaseStyle` to specify the title style used by the [title](/functions/title/) template function and the automatic section titles in Hugo. It defaults to [AP Stylebook](https://www.apstylebook.com/) for title casing, but you can also set it to `Chicago` or `Go` (every word starts with a capital letter).
|
Set `titleCaseStyle` to specify the title style used by the [title](/functions/title/) template function and the automatic section titles in Hugo.
|
||||||
|
|
||||||
|
By default, Hugo adheres to the capitalization rules in the [Associated Press (AP) Stylebook]. Set `titleCaseStyle` to `chicago` if you would prefer to follow the [Chicago Manual of Style], or set if to `go` to use Go's convention of captilalizing every word.
|
||||||
|
|
||||||
|
[Associated Press (AP) Stylebook]: https://www.apstylebook.com/
|
||||||
|
[Chicago Manual of Style]: https://www.chicagomanualofstyle.org/home.html
|
||||||
|
[site configuration]: /getting-started/configuration/#configure-title-case
|
||||||
|
|
||||||
## Configuration Environment Variables
|
## Configuration Environment Variables
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user