Back to Docker

Description

layouts/_partials/utils/description.html

18.09-release633 B
Original Source

{{- /* 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 }}