mirror of
https://github.com/docker/docs.git
synced 2026-03-27 06:18:55 +07:00
- layouts/partials/ → layouts/_partials/ - layouts/shortcodes/ → layouts/_shortcodes/ - layouts/_default/_markup/ → layouts/_markup/ - layouts/_default/*.html → layouts/*.html (flatten _default/) - layouts/index.html → layouts/home.html - layouts/index.*.json/txt → layouts/home.*.json/txt - layouts/_default/index.llms.txt → layouts/home.llms.txt - layouts/tag/ → layouts/tags/ (match /tags/ URL path)
20 lines
674 B
HTML
20 lines
674 B
HTML
{{- /*
|
|
Utility template to extract a description for the current page.
|
|
- Prioritizes `.Description` or falls back to front matter in `site.Data.frontmatter`.
|
|
- Replaces newlines with spaces and trims trailing spaces.
|
|
- Designed for reuse via `partial` calls to generate meta descriptions or similar content.
|
|
*/ -}}
|
|
{{ $desc := "" }}
|
|
{{ if .Description }}
|
|
{{ $desc = strings.Replace .Description "\n" " " }}
|
|
{{ else }}
|
|
{{ with .File }}
|
|
{{ with (index (site.Data.frontmatter) .Path) }}
|
|
{{ with .description }}
|
|
{{ $desc = strings.Replace . "\n" " " | strings.TrimRight " " }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ return $desc }}
|