diff --git a/layouts/_default/index.search.js b/layouts/_default/index.search.js index f37a740ab1..20d2eb296c 100644 --- a/layouts/_default/index.search.js +++ b/layouts/_default/index.search.js @@ -1,14 +1,20 @@ {{- partialCached "page-meta.hugo" . .RelPermalink }} +{{- $format := partial "get-format.hugo" . }} +{{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }} {{- $pages := slice }} {{- range .Site.Pages }} {{- 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 "uri" (partial "relLangPrettyUglyURL.hugo" (dict "to" .)) - "title" (partial "pageHelper/title.hugo" (dict "page" .)) - "tags" .Params.tags - "breadcrumb" (trim ((partial "breadcrumbs.html" (dict "page" . "dirOnly" true)) | plainify | htmlUnescape) "\n\r\t ") - "description" (or .Description .Summary) - "content" (.Plain | htmlUnescape) + "title" (partial "pageHelper/title.hugo" (dict "page" . "format" $format "outputFormat" $outputFormat) | plainify) + "tags" $tags + "breadcrumb" (partial "breadcrumbs.html" (dict "page" . "dirOnly" true) | plainify | htmlUnescape | chomp) + "description" (or .Description .Summary | plainify | htmlUnescape | chomp) + "content" (.Plain | htmlUnescape | chomp) ) }} {{- end }} {{- end -}} diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index 4290e751b1..7b2d7b8921 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -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 }} +{{- $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 */}} {{- $authorEmail := "" }} {{- if and .Site.Params.author (reflect.IsMap .Site.Params.author) .Site.Params.author.email }} @@ -27,9 +29,9 @@ {{- printf "" | safeHTML }} - {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} on {{ end }}{{ .Site.Title }}{{ end }} + {{ partial "pageHelper/title.hugo" (dict "page" . "fullyQualified" true "reverse" true "format" $format "outputFormat" $outputFormat) }} {{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true) }} - Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{ . }} {{ end }}{{ end }}on {{ .Site.Title }} + {{ or .Description .Summary | plainify | htmlUnescape | chomp | transform.XMLEscape | safeHTML }} Hugo {{ site.Language.LanguageCode }}{{ with $authorEmail }} {{ . }}{{ with $authorName }} ({{ . }}){{ end }}{{ end }}{{ with $authorEmail }} @@ -43,12 +45,12 @@ {{- $relearnIsHiddenFrom := index ($page.Scratch.Get "relearnIsHiddenFrom") .RelPermalink }} {{- if and .Permalink .Title (or (not $relearnIsHiddenFrom) (ne .Site.Params.disableSeoHiddenPages true) ) }} - {{ .Title }} + {{ partial "pageHelper/title.hugo" (dict "page" . "format" $format "outputFormat" $outputFormat) }} {{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true) }} {{ .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} {{- with $authorEmail }}{{ . }}{{ with $authorName }} ({{ . }}){{ end }}{{ end }} {{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true) }} - {{ .Summary | transform.XMLEscape | safeHTML }} + {{ or .Description .Summary | plainify | htmlUnescape | chomp | transform.XMLEscape | safeHTML }} {{- end }} {{- end }} diff --git a/layouts/_default/sitemap.xml b/layouts/_default/sitemap.xml index cfcb7feb26..003043df21 100644 --- a/layouts/_default/sitemap.xml +++ b/layouts/_default/sitemap.xml @@ -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 }} {{- printf "" | safeHTML }} diff --git a/layouts/_default/term.html b/layouts/_default/term.html index 46fc5c79eb..b42e1c04dc 100644 --- a/layouts/_default/term.html +++ b/layouts/_default/term.html @@ -22,7 +22,7 @@

{{ $capital }}

{{- /* display pages of a term */}} {{- $breadcrumb := "" }} {{- 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 }}
  • {{ .Title }}{{ with $breadcrumb }}{{ end }}
  • {{- $lastCapital = $capital }} diff --git a/layouts/alias.html b/layouts/alias.html index 336578b1d9..233efaf165 100644 --- a/layouts/alias.html +++ b/layouts/alias.html @@ -1,4 +1,4 @@ -{{- /* based on Hugo 0.125.3 alias.html */}} +{{- /* based on Hugo 0.125.5 alias.html */}} diff --git a/layouts/partials/meta.html b/layouts/partials/meta.html index 5cf42c66bc..fa676eb136 100644 --- a/layouts/partials/meta.html +++ b/layouts/partials/meta.html @@ -13,7 +13,7 @@ {{- if not (and .Title (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSeoHiddenPages true) ) ) }} {{- end }} - + {{- $authorName := partialCached "authorname.hugo" . }} {{- partial "twitter_cards.html" . }} diff --git a/layouts/partials/opengraph.html b/layouts/partials/opengraph.html index b297239b7c..5b86d859f7 100644 --- a/layouts/partials/opengraph.html +++ b/layouts/partials/opengraph.html @@ -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" . }} {{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }} {{- $basename := "index" }} @@ -7,12 +7,15 @@ {{- end }} -{{- with or site.Title site.Params.title | plainify }} +{{- with site.Title | plainify }} {{- end }} - -{{- with or .Description .Summary | plainify }} +{{- with partial "pageHelper/title.hugo" (dict "page" . "fullyQualified" true "reverse" true "format" $format "outputFormat" $outputFormat) | plainify }} + +{{- end }} + +{{- with or .Description .Summary | plainify | htmlUnescape | chomp }} {{- end }} @@ -23,7 +26,7 @@ {{- if .IsPage }} {{- with .FirstSection }} - + {{- end }} {{- $iso8601 := "2006-01-02T15:04:05-07:00" }} {{- with .PublishDate }} @@ -33,7 +36,7 @@ {{- end }} {{- range .GetTerms "tags" | first 6 }} - + {{- end }} {{- else }} diff --git a/layouts/partials/pageHelper/taxonomyPages.html b/layouts/partials/pageHelper/taxonomyPages.html index cab1bd1c0d..404eb4183e 100644 --- a/layouts/partials/pageHelper/taxonomyPages.html +++ b/layouts/partials/pageHelper/taxonomyPages.html @@ -1,3 +1,5 @@ +{{- $format := partial "get-format.hugo" . }} +{{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }} {{- $pages := slice }} {{- range .Data.Terms }} {{- $count := 0 }} @@ -8,7 +10,7 @@ {{- end }} {{- end }} {{- 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 }} {{- $pages = sort $pages ".Title" }} diff --git a/layouts/partials/pageHelper/title.hugo b/layouts/partials/pageHelper/title.hugo index 00a12497f7..8d9a8b8219 100644 --- a/layouts/partials/pageHelper/title.hugo +++ b/layouts/partials/pageHelper/title.hugo @@ -5,6 +5,7 @@ {{- end }} {{- $format := $.format | default (partial "get-format.hugo" .) }} {{- $outputFormat := $.outputFormat | default (partial "output-format.hugo" (dict "page" . "format" $format)) }} + {{- $siteTitle := site.Title }} {{- $title = .Title }} {{- if $.linkTitle }} {{- $title = or $.page.LinkTitle $title }} @@ -13,7 +14,7 @@ {{- if eq $outputFormat "searchpage" }} {{- $title = T "Search" }} {{- else if eq .Kind "home" }} - {{- $title = or $title site.Title }} + {{- $title = or $title $siteTitle }} {{- else if eq .Kind "taxonomy" }} {{- $title = default (default .Data.Plural (i18n .Data.Plural)) .Params.Title }} {{- else if eq .Kind "term" }} @@ -30,11 +31,11 @@ {{- end }} {{- if $.fullyQualified }} - {{- if and $title site.Title (not (eq $title site.Title)) }} + {{- if and $title $siteTitle (not (eq $title $siteTitle)) }} {{- 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 }} - {{- $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 }} diff --git a/layouts/partials/schema.html b/layouts/partials/schema.html index d2f4a4e438..9bbca1fe10 100644 --- a/layouts/partials/schema.html +++ b/layouts/partials/schema.html @@ -1,9 +1,11 @@ -{{- /* based on Hugo 0.125.3 schema.html */}} -{{- with partial "pageHelper/title.hugo" (dict "page" . "fullyQualified" true "reverse" true) }} +{{- /* based on Hugo 0.125.5 schema.html */}} +{{- $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 }} {{- end }} -{{- with or .Description .Summary }} +{{- with or .Description .Summary | plainify | htmlUnescape | chomp }} {{- end }} @@ -36,17 +38,17 @@ */}} {{- $keywords := slice }} {{- 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 }} {{- with .Keywords }} {{- $keywords = . }} {{- else }} {{- 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 }} {{- range $taxonomy, $_ := site.Taxonomies }} {{- 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 }} diff --git a/layouts/partials/shortcodes/image.html b/layouts/partials/shortcodes/image.html index 8e5b4da999..5d067c685d 100644 --- a/layouts/partials/shortcodes/image.html +++ b/layouts/partials/shortcodes/image.html @@ -1,4 +1,4 @@ -{{- /* based on Hugo 0.125.3 render-image.html */}} +{{- /* based on Hugo 0.125.5 render-image.html */}} {{- $page := .page }} {{- if and (not $page) .context }} {{- $page = .context }} diff --git a/layouts/partials/shortcodes/link.html b/layouts/partials/shortcodes/link.html index 73429a2e99..8773240883 100644 --- a/layouts/partials/shortcodes/link.html +++ b/layouts/partials/shortcodes/link.html @@ -1,4 +1,4 @@ -{{- /* based on Hugo 0.125.3 render-link.html */}} +{{- /* based on Hugo 0.125.5 render-link.html */}} {{- $page := .page }} {{- if and (not $page) .context }} {{- $page = .context }} diff --git a/layouts/partials/term-list.html b/layouts/partials/term-list.html index beacfc1356..03131c5d59 100644 --- a/layouts/partials/term-list.html +++ b/layouts/partials/term-list.html @@ -1,4 +1,6 @@ {{- $page := .page }} +{{- $format := partial "get-format.hugo" $page }} +{{- $outputFormat := partial "output-format.hugo" (dict "page" $page "format" $format) }} {{- $taxonomy := .taxonomy }} {{- $class := .class }} {{- $color := .color | default "" }} @@ -18,7 +20,7 @@ {{- $term := . }} {{- $term_key := $term }} {{- 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 }} {{- $term = trim $term " " }} {{- if not $term }} @@ -26,16 +28,16 @@ {{- end }} {{- $term_key = ($term | plainify | anchorize) }} {{- 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 }} {{- $term_key = ($term | urlize) }} {{- 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 }} -{{- $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 }}
    {{- if $icon }} diff --git a/layouts/partials/topbar/button/toc.html b/layouts/partials/topbar/button/toc.html index d7d8dcf708..6b8a8beae3 100644 --- a/layouts/partials/topbar/button/toc.html +++ b/layouts/partials/topbar/button/toc.html @@ -9,7 +9,7 @@ {{- $currentDisableToc := .Params.disableToc | default $defaultDisableToc }} {{- if and (eq $outputFormat "html") (not $currentDisableToc) }} {{- $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 }} {{- $content = " " }} {{- end }} diff --git a/layouts/partials/twitter_cards.html b/layouts/partials/twitter_cards.html index fd4c6f9fbb..cc640f123d 100644 --- a/layouts/partials/twitter_cards.html +++ b/layouts/partials/twitter_cards.html @@ -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" . }} {{- with index $images 0 }} @@ -6,8 +6,14 @@ {{- else }} {{- end }} - - + +{{- with partial "pageHelper/title.hugo" (dict "page" . "fullyQualified" true "reverse" true) | plainify }} + +{{- end }} + +{{- with or .Description .Summary | plainify | htmlUnescape | chomp }} + +{{- end }} {{- $twitterSite := "" }} {{- with site.Params.social }}