mirror of
https://github.com/docker/docs.git
synced 2026-03-28 14:58:53 +07:00
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 }}
|