mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-25 22:00:58 +02:00
Merge commit 'f96384a3b596f9bc0a3a035970b09b2c601f0ccb'
This commit is contained in:
@@ -1,38 +1,23 @@
|
||||
---
|
||||
title: title
|
||||
# linktitle:
|
||||
description: Converts all characters in the provided string to title case.
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
description: Converts the provided string to title case.
|
||||
categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
parent: functions
|
||||
keywords: [strings]
|
||||
signature:
|
||||
- "title INPUT"
|
||||
- "strings.Title INPUT"
|
||||
workson: []
|
||||
hugoversion:
|
||||
- "title STRING"
|
||||
- "strings.Title STRING"
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
aliases: []
|
||||
---
|
||||
|
||||
|
||||
```
|
||||
{{title "BatMan"}}` → "Batman"
|
||||
```go-html-template
|
||||
{{ 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 capitalizing every word.
|
||||
|
||||
```
|
||||
{{ range $name, $items := .Site.Taxonomies.categories }}
|
||||
<li><a href="{{ printf "%s/%s" "categories" ($name | urlize | lower) | absURL }}">{{ $name | humanize | title }} ({{ len $items }})</a></li>
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
## Configure Title Case
|
||||
|
||||
The default is AP Stylebook, but you can [configure it](/getting-started/configuration/#configure-title-case).
|
||||
[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
|
||||
|
Reference in New Issue
Block a user