1
0
mirror of https://github.com/docker/docs.git synced 2026-10-23 18:09:02 +03:00
Files
docs/layouts/_partials/utils/keywords.html
2026-05-01 09:22:27 +02:00

20 lines
725 B
HTML

{{- /*
Utility template to extract keywords for the current page.
- Uses `.Keywords` if available or falls back to front matter in `hugo.Data.frontmatter`.
- Cleans and trims keywords, joining them into a comma-separated string.
- Intended for reuse in meta tags or other keyword-based contexts.
*/ -}}
{{ $keywords := "" }}
{{ if .Keywords }}
{{ $keywords = collections.Apply .Keywords "strings.Trim" "." ", " }}
{{ else }}
{{ with .File }}
{{ with (index (hugo.Data.frontmatter) .Path) }}
{{ with .keywords }}
{{ $keywords = collections.Apply (strings.Split (strings.Replace . "\n" " ") ",") "strings.Trim" "." " " }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{ return $keywords }}