mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-09-15 17:24:49 -04:00
Add example with taxonomy for title template func
Example URL with printf.
This commit is contained in:
parent
85e28c10ea
commit
35abbc8691
@ -23,3 +23,11 @@ aliases: []
|
|||||||
```
|
```
|
||||||
{{title "BatMan"}}` → "Batman"
|
{{title "BatMan"}}` → "Batman"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
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 Intial Caps.
|
||||||
|
|
||||||
|
```
|
||||||
|
{{ 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 }}
|
||||||
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user