theme: sync Hugo templates and unification #841 #845

- description
- title
- tags
This commit is contained in:
Sören Weber 2024-04-27 14:38:19 +02:00
parent aed8845a16
commit 64b4ad751e
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
15 changed files with 65 additions and 41 deletions

View file

@ -1,14 +1,20 @@
{{- partialCached "page-meta.hugo" . .RelPermalink }} {{- partialCached "page-meta.hugo" . .RelPermalink }}
{{- $format := partial "get-format.hugo" . }}
{{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }}
{{- $pages := slice }} {{- $pages := slice }}
{{- range .Site.Pages }} {{- range .Site.Pages }}
{{- if and .Title .RelPermalink (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSearchHiddenPages true) ) }} {{- if and .Title .RelPermalink (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSearchHiddenPages true) ) }}
{{- $tags := slice }}
{{- range .GetTerms "tags" }}
{{- $tags = $tags | append (partial "pageHelper/title.hugo" (dict "page" .Page "linkTitle" true "format" $format "outputFormat" $outputFormat) | plainify) }}
{{- end }}
{{- $pages = $pages | append (dict {{- $pages = $pages | append (dict
"uri" (partial "relLangPrettyUglyURL.hugo" (dict "to" .)) "uri" (partial "relLangPrettyUglyURL.hugo" (dict "to" .))
"title" (partial "pageHelper/title.hugo" (dict "page" .)) "title" (partial "pageHelper/title.hugo" (dict "page" . "format" $format "outputFormat" $outputFormat) | plainify)
"tags" .Params.tags "tags" $tags
"breadcrumb" (trim ((partial "breadcrumbs.html" (dict "page" . "dirOnly" true)) | plainify | htmlUnescape) "\n\r\t ") "breadcrumb" (partial "breadcrumbs.html" (dict "page" . "dirOnly" true) | plainify | htmlUnescape | chomp)
"description" (or .Description .Summary) "description" (or .Description .Summary | plainify | htmlUnescape | chomp)
"content" (.Plain | htmlUnescape) "content" (.Plain | htmlUnescape | chomp)
) }} ) }}
{{- end }} {{- end }}
{{- end -}} {{- end -}}

View file

@ -1,5 +1,7 @@
{{- /* based on Hugo 0.125.3 rss.xml */}} {{- /* based on Hugo 0.125.5 rss.xml */}}
{{- partialCached "page-meta.hugo" . .RelPermalink }} {{- partialCached "page-meta.hugo" . .RelPermalink }}
{{- $format := partial "get-format.hugo" . }}
{{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }}
{{- /* Deprecate site.Author.email in favor of site.Params.author.email */}} {{- /* Deprecate site.Author.email in favor of site.Params.author.email */}}
{{- $authorEmail := "" }} {{- $authorEmail := "" }}
{{- if and .Site.Params.author (reflect.IsMap .Site.Params.author) .Site.Params.author.email }} {{- if and .Site.Params.author (reflect.IsMap .Site.Params.author) .Site.Params.author.email }}
@ -27,9 +29,9 @@
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }} {{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel> <channel>
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} on {{ end }}{{ .Site.Title }}{{ end }}</title> <title>{{ partial "pageHelper/title.hugo" (dict "page" . "fullyQualified" true "reverse" true "format" $format "outputFormat" $outputFormat) }}</title>
<link>{{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true) }}</link> <link>{{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true) }}</link>
<description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{ . }} {{ end }}{{ end }}on {{ .Site.Title }}</description> <description>{{ or .Description .Summary | plainify | htmlUnescape | chomp | transform.XMLEscape | safeHTML }}</description>
<generator>Hugo</generator> <generator>Hugo</generator>
<language>{{ site.Language.LanguageCode }}</language>{{ with $authorEmail }} <language>{{ site.Language.LanguageCode }}</language>{{ with $authorEmail }}
<managingEditor>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</managingEditor>{{ end }}{{ with $authorEmail }} <managingEditor>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</managingEditor>{{ end }}{{ with $authorEmail }}
@ -43,12 +45,12 @@
{{- $relearnIsHiddenFrom := index ($page.Scratch.Get "relearnIsHiddenFrom") .RelPermalink }} {{- $relearnIsHiddenFrom := index ($page.Scratch.Get "relearnIsHiddenFrom") .RelPermalink }}
{{- if and .Permalink .Title (or (not $relearnIsHiddenFrom) (ne .Site.Params.disableSeoHiddenPages true) ) }} {{- if and .Permalink .Title (or (not $relearnIsHiddenFrom) (ne .Site.Params.disableSeoHiddenPages true) ) }}
<item> <item>
<title>{{ .Title }}</title> <title>{{ partial "pageHelper/title.hugo" (dict "page" . "format" $format "outputFormat" $outputFormat) }}</title>
<link>{{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true) }}</link> <link>{{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true) }}</link>
<pubDate>{{ .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> <pubDate>{{ .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{- with $authorEmail }}<author>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</author>{{ end }} {{- with $authorEmail }}<author>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</author>{{ end }}
<guid>{{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true) }}</guid> <guid>{{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true) }}</guid>
<description>{{ .Summary | transform.XMLEscape | safeHTML }}</description> <description>{{ or .Description .Summary | plainify | htmlUnescape | chomp | transform.XMLEscape | safeHTML }}</description>
</item> </item>
{{- end }} {{- end }}
{{- end }} {{- end }}

View file

@ -1,4 +1,4 @@
{{- /* based on Hugo 0.125.3 sitemap.xml */}} {{- /* based on Hugo 0.125.5 sitemap.xml */}}
{{- partialCached "page-meta.hugo" . .RelPermalink }} {{- partialCached "page-meta.hugo" . .RelPermalink }}
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>" | safeHTML }} {{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>" | safeHTML }}
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml"> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">

View file

@ -22,7 +22,7 @@
{{- /* display pages of a term */}} {{- /* display pages of a term */}}
{{- $breadcrumb := "" }} {{- $breadcrumb := "" }}
{{- if (ne .Page.Site.Params.disableTermBreadcrumbs true) }} {{- if (ne .Page.Site.Params.disableTermBreadcrumbs true) }}
{{- $breadcrumb = (trim ((partial "breadcrumbs.html" (dict "page" .Page "dirOnly" true)) | plainify | htmlUnescape) "\n\r\t ") }} {{- $breadcrumb = partial "breadcrumbs.html" (dict "page" .Page "dirOnly" true) | plainify | htmlUnescape | chomp }}
{{- end }} {{- end }}
<li><a href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" .Page) }}">{{ .Title }}</a>{{ with $breadcrumb }}<div class="breadcrumbs highlightable" title="{{ . }}">{{ . }}</div>{{ end }}</li> <li><a href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" .Page) }}">{{ .Title }}</a>{{ with $breadcrumb }}<div class="breadcrumbs highlightable" title="{{ . }}">{{ . }}</div>{{ end }}</li>
{{- $lastCapital = $capital }} {{- $lastCapital = $capital }}

View file

@ -1,4 +1,4 @@
{{- /* based on Hugo 0.125.3 alias.html */}} {{- /* based on Hugo 0.125.5 alias.html */}}
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>

View file

@ -13,7 +13,7 @@
{{- if not (and .Title (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSeoHiddenPages true) ) ) }} {{- if not (and .Title (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSeoHiddenPages true) ) ) }}
<meta name="robots" content="noindex, nofollow, noarchive, noimageindex"> <meta name="robots" content="noindex, nofollow, noarchive, noimageindex">
{{- end }} {{- end }}
<meta name="description" content="{{ with or .Description .Summary }}{{ . }}{{ end }}"> <meta name="description" content="{{ with or .Description .Summary | plainify | htmlUnescape | chomp }}{{ . }}{{ end }}">
{{- $authorName := partialCached "authorname.hugo" . }} {{- $authorName := partialCached "authorname.hugo" . }}
<meta name="author" content="{{ $authorName }}"> <meta name="author" content="{{ $authorName }}">
{{- partial "twitter_cards.html" . }} {{- partial "twitter_cards.html" . }}

View file

@ -1,4 +1,4 @@
{{- /* based on Hugo 0.125.3 opengraph.html */}} {{- /* based on Hugo 0.125.5 opengraph.html */}}
{{- $format := partial "get-format.hugo" . }} {{- $format := partial "get-format.hugo" . }}
{{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }} {{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }}
{{- $basename := "index" }} {{- $basename := "index" }}
@ -7,12 +7,15 @@
{{- end }} {{- end }}
<meta property="og:url" content="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true "basename" $basename) }}"> <meta property="og:url" content="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true "basename" $basename) }}">
{{- with or site.Title site.Params.title | plainify }} {{- with site.Title | plainify }}
<meta property="og:site_name" content="{{ . }}"> <meta property="og:site_name" content="{{ . }}">
{{- end }} {{- end }}
<meta property="og:title" content="{{ partial "pageHelper/title.hugo" (dict "page" . "fullyQualified" true "reverse" true "format" $format "outputFormat" $outputFormat) | plainify }}">
{{- with or .Description .Summary | plainify }} {{- with partial "pageHelper/title.hugo" (dict "page" . "fullyQualified" true "reverse" true "format" $format "outputFormat" $outputFormat) | plainify }}
<meta property="og:title" content="{{ . }}">
{{- end }}
{{- with or .Description .Summary | plainify | htmlUnescape | chomp }}
<meta property="og:description" content="{{ . }}"> <meta property="og:description" content="{{ . }}">
{{- end }} {{- end }}
@ -23,7 +26,7 @@
{{- if .IsPage }} {{- if .IsPage }}
<meta property="og:type" content="article"> <meta property="og:type" content="article">
{{- with .FirstSection }} {{- with .FirstSection }}
<meta property="article:section" content="{{ partial "pageHelper/title.hugo" (dict "page" . "fullyQualified" true "reverse" true "format" $format "outputFormat" $outputFormat) | plainify }}"> <meta property="article:section" content="{{ partial "pageHelper/title.hugo" (dict "page" . "format" $format "outputFormat" $outputFormat) | plainify }}">
{{- end }} {{- end }}
{{- $iso8601 := "2006-01-02T15:04:05-07:00" }} {{- $iso8601 := "2006-01-02T15:04:05-07:00" }}
{{- with .PublishDate }} {{- with .PublishDate }}
@ -33,7 +36,7 @@
<meta property="article:modified_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }}> <meta property="article:modified_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }}>
{{- end }} {{- end }}
{{- range .GetTerms "tags" | first 6 }} {{- range .GetTerms "tags" | first 6 }}
<meta property="article:tag" content="{{ .Page.Title | plainify }}"> <meta property="article:tag" content="{{ partial "pageHelper/title.hugo" (dict "page" .Page "linkTitle" true "format" $format "outputFormat" $outputFormat) | plainify }}">
{{- end }} {{- end }}
{{- else }} {{- else }}
<meta property="og:type" content="website"> <meta property="og:type" content="website">

View file

@ -1,3 +1,5 @@
{{- $format := partial "get-format.hugo" . }}
{{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }}
{{- $pages := slice }} {{- $pages := slice }}
{{- range .Data.Terms }} {{- range .Data.Terms }}
{{- $count := 0 }} {{- $count := 0 }}
@ -8,7 +10,7 @@
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if $count }} {{- if $count }}
{{- $pages = $pages| append (dict "Title" (default (humanize .Page.Data.Term | strings.Title) .Page.Title) "Page" .Page "Count" $count )}} {{- $pages = $pages| append (dict "Title" (partial "pageHelper/title.hugo" (dict "page" .Page "linkTitle" true "format" $format "outputFormat" $outputFormat)) "Page" .Page "Count" $count )}}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- $pages = sort $pages ".Title" }} {{- $pages = sort $pages ".Title" }}

View file

@ -5,6 +5,7 @@
{{- end }} {{- end }}
{{- $format := $.format | default (partial "get-format.hugo" .) }} {{- $format := $.format | default (partial "get-format.hugo" .) }}
{{- $outputFormat := $.outputFormat | default (partial "output-format.hugo" (dict "page" . "format" $format)) }} {{- $outputFormat := $.outputFormat | default (partial "output-format.hugo" (dict "page" . "format" $format)) }}
{{- $siteTitle := site.Title }}
{{- $title = .Title }} {{- $title = .Title }}
{{- if $.linkTitle }} {{- if $.linkTitle }}
{{- $title = or $.page.LinkTitle $title }} {{- $title = or $.page.LinkTitle $title }}
@ -13,7 +14,7 @@
{{- if eq $outputFormat "searchpage" }} {{- if eq $outputFormat "searchpage" }}
{{- $title = T "Search" }} {{- $title = T "Search" }}
{{- else if eq .Kind "home" }} {{- else if eq .Kind "home" }}
{{- $title = or $title site.Title }} {{- $title = or $title $siteTitle }}
{{- else if eq .Kind "taxonomy" }} {{- else if eq .Kind "taxonomy" }}
{{- $title = default (default .Data.Plural (i18n .Data.Plural)) .Params.Title }} {{- $title = default (default .Data.Plural (i18n .Data.Plural)) .Params.Title }}
{{- else if eq .Kind "term" }} {{- else if eq .Kind "term" }}
@ -30,11 +31,11 @@
{{- end }} {{- end }}
{{- if $.fullyQualified }} {{- if $.fullyQualified }}
{{- if and $title site.Title (not (eq $title site.Title)) }} {{- if and $title $siteTitle (not (eq $title $siteTitle)) }}
{{- if $.reverse }} {{- if $.reverse }}
{{- $title = printf "%s %s %s" $title (default "::" site.Params.titleSeparator) site.Title }} {{- $title = printf "%s %s %s" $title (default "::" site.Params.titleSeparator) $siteTitle }}
{{- else }} {{- else }}
{{- $title = printf "%s %s %s" site.Title (default "::" site.Params.titleSeparator) $title }} {{- $title = printf "%s %s %s" $siteTitle (default "::" site.Params.titleSeparator) $title }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}

View file

@ -1,9 +1,11 @@
{{- /* based on Hugo 0.125.3 schema.html */}} {{- /* based on Hugo 0.125.5 schema.html */}}
{{- with partial "pageHelper/title.hugo" (dict "page" . "fullyQualified" true "reverse" true) }} {{- $format := partial "get-format.hugo" . }}
{{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }}
{{- with partial "pageHelper/title.hugo" (dict "page" . "fullyQualified" true "reverse" true "format" $format "outputFormat" $outputFormat) | plainify }}
<meta itemprop="name" content="{{ . }}"> <meta itemprop="name" content="{{ . }}">
{{- end }} {{- end }}
{{- with or .Description .Summary }} {{- with or .Description .Summary | plainify | htmlUnescape | chomp }}
<meta itemprop="description" content="{{ . }}"> <meta itemprop="description" content="{{ . }}">
{{- end }} {{- end }}
@ -36,17 +38,17 @@ Keywords precedence:
*/}} */}}
{{- $keywords := slice }} {{- $keywords := slice }}
{{- range .GetTerms "keywords" }} {{- range .GetTerms "keywords" }}
{{- $keywords = $keywords | append .Title }} {{- $keywords = $keywords | append (partial "pageHelper/title.hugo" (dict "page" .Page "linkTitle" true "format" $format "outputFormat" $outputFormat) | plainify) }}
{{- else }} {{- else }}
{{- with .Keywords }} {{- with .Keywords }}
{{- $keywords = . }} {{- $keywords = . }}
{{- else }} {{- else }}
{{- range .GetTerms "tags" }} {{- range .GetTerms "tags" }}
{{- $keywords = $keywords | append .Title }} {{- $keywords = $keywords | append (partial "pageHelper/title.hugo" (dict "page" .Page "linkTitle" true "format" $format "outputFormat" $outputFormat) | plainify) }}
{{- else }} {{- else }}
{{- range $taxonomy, $_ := site.Taxonomies }} {{- range $taxonomy, $_ := site.Taxonomies }}
{{- range $.GetTerms $taxonomy }} {{- range $.GetTerms $taxonomy }}
{{- $keywords = $keywords | append .Title }} {{- $keywords = $keywords | append (partial "pageHelper/title.hugo" (dict "page" .Page "linkTitle" true "format" $format "outputFormat" $outputFormat) | plainify) }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}

View file

@ -1,4 +1,4 @@
{{- /* based on Hugo 0.125.3 render-image.html */}} {{- /* based on Hugo 0.125.5 render-image.html */}}
{{- $page := .page }} {{- $page := .page }}
{{- if and (not $page) .context }} {{- if and (not $page) .context }}
{{- $page = .context }} {{- $page = .context }}

View file

@ -1,4 +1,4 @@
{{- /* based on Hugo 0.125.3 render-link.html */}} {{- /* based on Hugo 0.125.5 render-link.html */}}
{{- $page := .page }} {{- $page := .page }}
{{- if and (not $page) .context }} {{- if and (not $page) .context }}
{{- $page = .context }} {{- $page = .context }}

View file

@ -1,4 +1,6 @@
{{- $page := .page }} {{- $page := .page }}
{{- $format := partial "get-format.hugo" $page }}
{{- $outputFormat := partial "output-format.hugo" (dict "page" $page "format" $format) }}
{{- $taxonomy := .taxonomy }} {{- $taxonomy := .taxonomy }}
{{- $class := .class }} {{- $class := .class }}
{{- $color := .color | default "" }} {{- $color := .color | default "" }}
@ -18,7 +20,7 @@
{{- $term := . }} {{- $term := . }}
{{- $term_key := $term }} {{- $term_key := $term }}
{{- with $page.Site.GetPage (printf "%s/%s" $taxonomy $term_key) }} {{- with $page.Site.GetPage (printf "%s/%s" $taxonomy $term_key) }}
{{- $term_pages = $term_pages | append (dict "Title" (default (humanize .Data.Term | strings.Title) .Title) "Term" . )}} {{- $term_pages = $term_pages | append (dict "Title" (partial "pageHelper/title.hugo" (dict "page" . "linkTitle" true "format" $format "outputFormat" $outputFormat)) "Term" . )}}
{{- else }} {{- else }}
{{- $term = trim $term " " }} {{- $term = trim $term " " }}
{{- if not $term }} {{- if not $term }}
@ -26,16 +28,16 @@
{{- end }} {{- end }}
{{- $term_key = ($term | plainify | anchorize) }} {{- $term_key = ($term | plainify | anchorize) }}
{{- with $page.Site.GetPage (printf "%s/%s" $taxonomy $term_key) }} {{- with $page.Site.GetPage (printf "%s/%s" $taxonomy $term_key) }}
{{- $term_pages = $term_pages | append (dict "Title" (default (humanize .Data.Term | strings.Title) .Title) "Term" . )}} {{- $term_pages = $term_pages | append (dict "Title" (partial "pageHelper/title.hugo" (dict "page" . "linkTitle" true "format" $format "outputFormat" $outputFormat)) "Term" . )}}
{{- else }} {{- else }}
{{- $term_key = ($term | urlize) }} {{- $term_key = ($term | urlize) }}
{{- with $page.Site.GetPage (printf "%s/%s" $taxonomy $term_key) }} {{- with $page.Site.GetPage (printf "%s/%s" $taxonomy $term_key) }}
{{- $term_pages = $term_pages | append (dict "Title" (default (humanize .Data.Term | strings.Title) .Title) "Term" . )}} {{- $term_pages = $term_pages | append (dict "Title" (partial "pageHelper/title.hugo" (dict "page" . "linkTitle" true "format" $format "outputFormat" $outputFormat)) "Term" . )}}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- $taxonomy_title := default (default $taxonomy_page.Data.Plural (i18n $taxonomy_page.Data.Plural)) $taxonomy_page.Params.Title }} {{- $taxonomy_title := partial "pageHelper/title.hugo" (dict "page" $taxonomy_page "format" $format "outputFormat" $outputFormat) }}
{{- with $term_pages }} {{- with $term_pages }}
<div class=" taxonomy-{{ $taxonomy }} term-list cstyle {{ $style }} {{ $class }}" title="{{ $taxonomy_title }}"{{ if $color }}{{ printf " style=\"--VARIABLE-TAGS-BG-color: %s;\"" $color | safeHTMLAttr }}{{ end }}> <div class=" taxonomy-{{ $taxonomy }} term-list cstyle {{ $style }} {{ $class }}" title="{{ $taxonomy_title }}"{{ if $color }}{{ printf " style=\"--VARIABLE-TAGS-BG-color: %s;\"" $color | safeHTMLAttr }}{{ end }}>
{{- if $icon }} {{- if $icon }}

View file

@ -9,7 +9,7 @@
{{- $currentDisableToc := .Params.disableToc | default $defaultDisableToc }} {{- $currentDisableToc := .Params.disableToc | default $defaultDisableToc }}
{{- if and (eq $outputFormat "html") (not $currentDisableToc) }} {{- if and (eq $outputFormat "html") (not $currentDisableToc) }}
{{- $content := partial "toc-class.html" . }} {{- $content := partial "toc-class.html" . }}
{{- $hascontent := not (eq 0 (int (len (trim ($content | plainify) "\n\r\t ")))) }} {{- $hascontent := not (eq 0 (int (len ($content | plainify | chomp)))) }}
{{- if not $hascontent }} {{- if not $hascontent }}
{{- $content = " " }} {{- $content = " " }}
{{- end }} {{- end }}

View file

@ -1,4 +1,4 @@
{{- /* based on Hugo 0.125.3 twitter_cards.html */}} {{- /* based on Hugo 0.125.5 twitter_cards.html */}}
{{- $images := partial "_funcs/get-page-images" . }} {{- $images := partial "_funcs/get-page-images" . }}
{{- with index $images 0 }} {{- with index $images 0 }}
<meta name="twitter:card" content="summary_large_image"> <meta name="twitter:card" content="summary_large_image">
@ -6,8 +6,14 @@
{{- else }} {{- else }}
<meta name="twitter:card" content="summary"> <meta name="twitter:card" content="summary">
{{- end }} {{- end }}
<meta name="twitter:title" content="{{ partial "pageHelper/title.hugo" (dict "page" . "fullyQualified" true "reverse" true) }}">
<meta name="twitter:description" content="{{ with or .Description .Summary }}{{ . }}{{ end }}"> {{- with partial "pageHelper/title.hugo" (dict "page" . "fullyQualified" true "reverse" true) | plainify }}
<meta name="twitter:title" content="{{ . }}">
{{- end }}
{{- with or .Description .Summary | plainify | htmlUnescape | chomp }}
<meta name="twitter:description" content="{{ . }}">
{{- end }}
{{- $twitterSite := "" }} {{- $twitterSite := "" }}
{{- with site.Params.social }} {{- with site.Params.social }}