hugo-ui-blog/layouts/partials/head.html

4.1 KiB

{{ $data := (newScratch) }} {{ $title := "" }} {{ if (and (.Title) ((ne (.Title) (site.Title)))) }}{{ $title = (printf "%s /" (.Title)) }}{{ end }} {{ $description := (site.Params.description) }} {{ with (.Summary) }}{{ $description = . }}{{ end }} {{ with (.Description) }}{{ $description = . }}{{ end }} {{ ($data.Add "keywords" (slice)) }} {{ if ($.IsPage) }} {{ range ((.GetTerms "tags") | first 20) }}{{ ($data.Add "keywords" (.Title)) }}{{ end }} {{ else }} {{ range ((site.Taxonomies.tags.ByCount) | first 20) }}{{ ($data.Add "keywords" (.Page.Title)) }}{{ end }} {{ end }} {{ $preConnect := (site.Data.ui.network.pre_connect) }} {{ range ($preConnect) }} {{ end }} {{ $uiTheme := (((resources.Get "js/theme.js") | minify) | resources.Fingerprint) }} {{ (partial "ui.fonts" .) }} {{ (partial "ui.css" .) }} {{ (partial "ui.icons" .) }} {{ $scripts := (site.Data.ui.scripts) }} {{ with ($scripts.vendor.external) }} {{ range . }} {{ end }} {{ end }} {{ $canonical := (.Permalink) }} {{ if (and (.IsNode) (not (.IsHome))) }} {{ with ($.Paginator) }} {{ $canonical = ((.URL) | absURL) }} {{ if (.HasPrev) }} {{ end }} {{ if (.HasNext) }} {{ end }} {{ end }} {{ end }} {{ if (.IsTranslated) }} {{ range (.Translations) }} {{ end }} {{ end }} {{ range (.AlternativeOutputFormats) }} {{ end }} {{ with (site.Title) }} {{ end }} {{ $theme := (site.Params.ui.color.theme) }} {{ with ($theme.light) }} {{ end }} {{ with ($theme.dark) }} {{ end }} {{ template "_internal/twitter_cards.html" . }} {{ template "_internal/opengraph.html" . }} {{ (partial "seo/common" .) }} {{ (partial "seo/dc" .) }}