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

20 lines
696 B
HTML

{{- /*
Renders the definition of the given glossary term.
@param {string} (.Get 0) The glossary term.
@returns {template.HTML}
@example {{% glossary-term float %}}
@example {{% glossary-term "floating point" %}}
*/}}
{{- with .Get 0 }}
{{- $path := printf "/quick-reference/glossary/%s" (urlize .) }}
{{- with site.GetPage $path }}
{{ .RenderShortcodes }} {{/* Do not indent. Do not remove non-breaking space. */}}
{{- else }}
{{- errorf "The glossary term (%s) shortcode was unable to find %s: see %s" $.Name $path $.Position }}
{{- end }}
{{- else }}
{{- errorf "The glossary term (%s) shortcode requires one positional parameter: see %s" $.Name $.Position }}
{{- end -}}