| 1 |
{{/* |
| 2 |
Renders a comma-separated list of links to the root key configuration pages. |
| 3 |
|
| 4 |
@example {{< root-configuration-keys >}} |
| 5 |
*/}} |
| 6 |
|
| 7 |
{{- /* Create scratch map of key:filename. */}} |
| 8 |
{{- $s := newScratch }} |
| 9 |
{{- range $k, $v := hugo.Data.docs.config }} |
| 10 |
{{- if or (reflect.IsMap .) (reflect.IsSlice .) }} |
| 11 |
{{- $s.Set $k ($k | humanize | anchorize) }} |
| 12 |
{{- end }} |
| 13 |
{{- end }} |
| 14 |
|
| 15 |
{{- /* Deprecated. */}} |
| 16 |
{{- $s.Delete "author" }} |
| 17 |
|
| 18 |
{{- /* Use mounts instead. */}} |
| 19 |
{{- $s.Delete "staticDir" }} |
| 20 |
{{- $s.Delete "ignoreFiles" }} |
| 21 |
|
| 22 |
{{- /* This key is "HTTPCache" not "httpCache". */}} |
| 23 |
{{- $s.Set "HTTPCache" "http-cache" }} |
| 24 |
|
| 25 |
{{- /* This key is "frontmatter" not "frontMatter" */}} |
| 26 |
{{- $s.Set "frontmatter" "front-matter" }} |
| 27 |
|
| 28 |
{{- /* The page title is "Related content" not "related". */}} |
| 29 |
{{- $s.Set "related" "related-content" }} |
| 30 |
|
| 31 |
{{- /* It can be configured as bool or map; we want to show map. */}} |
| 32 |
{{- $s.Set "uglyURLs" "ugly-urls" }} |
| 33 |
|
| 34 |
{{- $links := slice }} |
| 35 |
{{- range $k, $v := $s.Values }} |
| 36 |
{{- $path := printf "/configuration/%s" $v }} |
| 37 |
{{- with site.GetPage $path }} |
| 38 |
{{- $links = $links | append (printf "<a href=%q><code>%s</code></a>" .RelPermalink $k) }} |
| 39 |
{{- else }} |
| 40 |
{{- errorf "The %q shortcode was unable to find the page %s. See %s." $.Name $path $.Position }} |
| 41 |
{{- end }} |
| 42 |
{{- end }} |
| 43 |
|
| 44 |
{{- delimit $links ", " ", and " | safeHTML -}} |