hugo-wasm/docs/layouts/shortcodes/quick-reference.html
2025-02-13 10:40:34 +01:00

39 lines
1 KiB
HTML

{{/*
Renders the child sections of the given top-level section, listing each child's immediate descendants.
@param {string} section The top-level section to render.
@returns template.HTML
@example {{% quick-reference section="functions" %}}
*/}}
{{ $section := "" }}
{{ with .Get "section" }}
{{ $section = . }}
{{ else }}
{{ errorf "The %q shortcodes requires a 'section' parameter. See %s" .Name .Position }}
{{ end }}
{{/* Do not change the markdown indentation, and do not remove blank lines. */}}
{{ with site.GetPage $section }}
{{ range .Sections }}
## {{ .LinkTitle }}
{{ .RawContent }}
{{ range .Pages }}
{{ $aliases := "" }}
{{ if eq .Section "functions" }}
{{ with .Params.action.aliases }}
{{ $aliases = delimit . " or " }}
{{ end }}
{{ end }}
[{{ .LinkTitle }}]({{ .RelPermalink }}) {{ with $aliases }}({{ . }}){{ end }}
: {{ .Description }}
{{ end }}
{{ end }}
{{ else }}
{{ errorf "The %q shortcodes was unable to find the %q section. See %s" .Name $section .Position }}
{{ end }}