mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
theme: dry out title generation #825
This commit is contained in:
parent
36e6ccdf5b
commit
24c7258eb4
17 changed files with 89 additions and 156 deletions
|
@ -4,13 +4,7 @@
|
|||
<html lang="{{ .Page.Language.LanguageCode | default "en" }}" dir="{{ .Page.Language.LanguageDirection | default (T "Reading-direction") | default "ltr" }}">
|
||||
<head>
|
||||
{{- partial "meta.html" . }}
|
||||
{{- $title := .Title }}
|
||||
{{- if eq .Site.Data.titles .Title }}
|
||||
{{- $title = (index .Site.Data.titles .Title).title }}
|
||||
{{- end }}
|
||||
{{- if and $title .Site.Title (not (eq $title .Site.Title)) }}
|
||||
{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) .Site.Title }}
|
||||
{{- end }}
|
||||
{{- $title := partial "pageHelper/fullTitle.hugo" (dict "page" . "invert" true) }}
|
||||
<title>{{ $title }}</title>
|
||||
<base href="{{ .Site.BaseURL }}">
|
||||
{{- partialCached "favicon.html" . }}
|
||||
|
|
|
@ -2,17 +2,9 @@
|
|||
{{- $pages := slice }}
|
||||
{{- range .Site.Pages }}
|
||||
{{- if and .Title .RelPermalink (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSearchHiddenPages true) ) }}
|
||||
{{- $title := .Title }}
|
||||
{{- if eq .Kind "taxonomy" }}
|
||||
{{- $title = default (default .Data.Plural (i18n .Data.Plural)) .Params.Title }}
|
||||
{{- else if eq .Kind "term" }}
|
||||
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
||||
{{- $title = default (default .Data.Singular (i18n .Data.Singular)) $taxonomy_page.Params.SingularTitle }}
|
||||
{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) (default (humanize .Data.Term | strings.Title) .Title) }}
|
||||
{{- end }}
|
||||
{{- $pages = $pages | append (dict
|
||||
"uri" (partial "relLangPrettyUglyURL.hugo" (dict "to" .))
|
||||
"title" $title
|
||||
"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" .Description
|
||||
|
|
|
@ -2,17 +2,9 @@
|
|||
{{- $pages := slice }}
|
||||
{{- range .Site.Pages }}
|
||||
{{- if and .Title .RelPermalink (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSearchHiddenPages true) ) }}
|
||||
{{- $title := .Title }}
|
||||
{{- if eq .Kind "taxonomy" }}
|
||||
{{- $title = default (default .Data.Plural (i18n .Data.Plural)) .Params.Title }}
|
||||
{{- else if eq .Kind "term" }}
|
||||
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
||||
{{- $title = default (default .Data.Singular (i18n .Data.Singular)) $taxonomy_page.Params.SingularTitle }}
|
||||
{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) (default (humanize .Data.Term | strings.Title) .Title) }}
|
||||
{{- end }}
|
||||
{{- $pages = $pages | append (dict
|
||||
"uri" (partial "relLangPrettyUglyURL.hugo" (dict "to" .))
|
||||
"title" $title
|
||||
"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" .Description
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
</header>
|
||||
{{- $page := . }}
|
||||
|
||||
{{- $title := default (default .Data.Plural (i18n .Data.Plural)) .Params.Title }}
|
||||
{{- $title := partial "pageHelper/title.hugo" (dict "page" .) }}
|
||||
<h1 id="{{ $title | plainify | anchorize }}">{{ $title }}</h1>
|
||||
{{- .Content }}
|
||||
{{- $lastCapital := "" }}
|
||||
|
|
|
@ -5,9 +5,7 @@
|
|||
</header>
|
||||
{{- $page := . }}
|
||||
|
||||
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
||||
{{- $title := default (default .Data.Singular (i18n .Data.Singular)) $taxonomy_page.Params.SingularTitle }}
|
||||
{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) (default (humanize .Data.Term | strings.Title) .Title) }}
|
||||
{{- $title := partial "pageHelper/title.hugo" (dict "page" .) }}
|
||||
<h1 id="{{ $title | plainify | anchorize }}">{{ $title }}</h1>
|
||||
{{- .Content }}
|
||||
{{- $lastCapital := "" }}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{{- $page := .page }}
|
||||
{{- $title := T "Search" }}
|
||||
{{- $title := partial "pageHelper/title.hugo" (dict "page" .page) }}
|
||||
<article class="default">
|
||||
<header class="headline">
|
||||
</header>
|
||||
|
|
|
@ -31,17 +31,7 @@
|
|||
{{- range $i, $e := $breadcrumbReversed }}
|
||||
{{- $to := $e }}
|
||||
{{- $depth = add $depth 1 }}
|
||||
{{- $title := or $to.Params.menuTitle $to.LinkTitle $to.Title }}
|
||||
{{- if eq $to.Kind "taxonomy" }}
|
||||
{{- $title = default (default $to.Data.Plural (i18n $to.Data.Plural)) $to.Params.Title }}
|
||||
{{- else if eq $to.Kind "term" }}
|
||||
{{- $taxonomy_page := $to.Site.GetPage $to.Data.Plural }}
|
||||
{{- $title = default (default $to.Data.Singular (i18n $to.Data.Singular)) $taxonomy_page.Params.SingularTitle }}
|
||||
{{- $title = printf "%s %s %s" $title (default "::" $to.Site.Params.titleSeparator) (default (humanize $to.Data.Term | strings.Title) $to.Title) }}
|
||||
{{- end }}
|
||||
{{- if not $title }}
|
||||
{{- $title = $to.Site.Title }}
|
||||
{{- end }}
|
||||
{{- $title := partial "pageHelper/title.hugo" (dict "page" $to "useLinkTitle" true) }}
|
||||
{{- $url := partial "relLangPrettyUglyURL.hugo" (dict "to" $to) }}
|
||||
{{- $isPage := eq $url $pageurl }}
|
||||
{{- $isLast := eq $url $lasturl }}
|
||||
|
|
|
@ -16,22 +16,7 @@
|
|||
{{- partial "meta.html" . }}
|
||||
{{- $page := . }}
|
||||
{{- $link := "<link href=\"%s\" rel=\"%s\" type=\"%s\" title=\"%s\">" }}
|
||||
{{- $title := .Title }}
|
||||
{{- if eq $outputFormat "searchpage" }}
|
||||
{{- $title = T "Search" }}
|
||||
{{- else if eq .Kind "taxonomy" }}
|
||||
{{- $title = default (default .Data.Plural (i18n .Data.Plural)) .Params.Title }}
|
||||
{{- else if eq .Kind "term" }}
|
||||
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
||||
{{- $title = default (default .Data.Singular (i18n .Data.Singular)) $taxonomy_page.Params.SingularTitle }}
|
||||
{{- $title = printf "%s %s %s" (default (humanize .Data.Term | strings.Title) .Title) (default "::" .Site.Params.titleSeparator) $title }}
|
||||
{{- end }}
|
||||
{{- if and $title .Site.Title (not (eq $title .Site.Title)) }}
|
||||
{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) .Site.Title }}
|
||||
{{- end }}
|
||||
{{- if .Params.menuTitle }}
|
||||
{{- warnf "%q: DEPRECATED frontmatter 'menutitle' found, use 'linktitle' instead" $page.File.Filename }}
|
||||
{{- end }}
|
||||
{{- $title := partial "pageHelper/fullTitle.hugo" (dict "page" . "invert" true "format" $format "outputFormat" $outputFormat) }}
|
||||
<title>{{ $title }}</title>
|
||||
|
||||
{{- if .IsTranslated -}}
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
<h1 id="{{ .Title | plainify | anchorize }}">{{ .Title }}</h1>
|
||||
{{- $title := partial "pageHelper/title.hugo" (dict "page" .) }}
|
||||
<h1 id="{{ $title | plainify | anchorize }}">{{ $title }}</h1>
|
|
@ -1,5 +1,6 @@
|
|||
{{- if not .Title }}
|
||||
{{- $title := .Site.Title }}
|
||||
{{- $title := partial "pageHelper/title.hugo" (dict "page" .) }}
|
||||
{{- if not $title }}
|
||||
{{- $title := site.Title }}
|
||||
<h1 id="{{ $title | plainify | anchorize }}">{{ $title }}</h1>
|
||||
{{- end }}
|
||||
|
||||
|
|
|
@ -4,26 +4,13 @@
|
|||
{{- $basename := "index" }}
|
||||
{{- if eq $outputFormat "searchpage" }}
|
||||
{{- $basename = partial "BaseName.hugo" $format.RelPermalink }}
|
||||
{{- end }}
|
||||
{{- $title := .Title }}
|
||||
{{- if eq $outputFormat "searchpage" }}
|
||||
{{- $title = T "Search" }}
|
||||
{{- else if eq .Kind "taxonomy" }}
|
||||
{{- $title = default (default .Data.Plural (i18n .Data.Plural)) .Params.Title }}
|
||||
{{- else if eq .Kind "term" }}
|
||||
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
||||
{{- $title = default (default .Data.Singular (i18n .Data.Singular)) $taxonomy_page.Params.SingularTitle }}
|
||||
{{- $title = printf "%s %s %s" (default (humanize .Data.Term | strings.Title) .Title) (default "::" .Site.Params.titleSeparator) $title }}
|
||||
{{- end }}
|
||||
{{- if and $title .Site.Title (not (eq $title .Site.Title)) }}
|
||||
{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) .Site.Title }}
|
||||
{{- end }}
|
||||
<meta property="og:url" content="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true "basename" $basename) }}">
|
||||
|
||||
{{- with or site.Title site.Params.title | plainify }}
|
||||
<meta property="og:site_name" content="{{ . }}">
|
||||
{{- end }}
|
||||
<meta property="og:title" content="{{ $title | plainify }}">
|
||||
<meta property="og:title" content="{{ partial "pageHelper/fullTitle.hugo" (dict "page" . "invert" true "format" $format "outputFormat" $outputFormat) | plainify }}">
|
||||
|
||||
{{- with or .Description .Summary site.Params.description | plainify }}
|
||||
<meta property="og:description" content="{{ . }}">
|
||||
|
@ -36,20 +23,7 @@
|
|||
{{- if .IsPage }}
|
||||
<meta property="og:type" content="article">
|
||||
{{- with .FirstSection }}
|
||||
{{- $title := .Title }}
|
||||
{{- if eq $outputFormat "searchpage" }}
|
||||
{{- $title = T "Search" }}
|
||||
{{- else if eq .Kind "taxonomy" }}
|
||||
{{- $title = default (default .Data.Plural (i18n .Data.Plural)) .Params.Title }}
|
||||
{{- else if eq .Kind "term" }}
|
||||
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
||||
{{- $title = default (default .Data.Singular (i18n .Data.Singular)) $taxonomy_page.Params.SingularTitle }}
|
||||
{{- $title = printf "%s %s %s" (default (humanize .Data.Term | strings.Title) .Title) (default "::" .Site.Params.titleSeparator) $title }}
|
||||
{{- end }}
|
||||
{{- if and $title .Site.Title (not (eq $title .Site.Title)) }}
|
||||
{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) .Site.Title }}
|
||||
{{- end }}
|
||||
<meta property="article:section" content="{{ $title | plainify }}">
|
||||
<meta property="article:section" content="{{ partial "pageHelper/fullTitle.hugo" (dict "page" . "invert" true "format" $format "outputFormat" $outputFormat) | plainify }}">
|
||||
{{- end }}
|
||||
{{- $iso8601 := "2006-01-02T15:04:05-07:00" }}
|
||||
{{- with .PublishDate }}
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
{{- $currentNode.Store.Set $has true }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- template "relearn-structure" dict "node" .Site.Home "currentnode" $currentNode "hiddenstem" false "hiddencurrent" false }}
|
||||
{{- define "relearn-structure" }}
|
||||
{{- $currentNode := .currentnode }}
|
||||
|
@ -24,7 +25,7 @@
|
|||
{{- $isChildren := eq $currentNode .node.Parent }}
|
||||
{{- if $isSelf }}
|
||||
{{- $currentNode.Scratch.Set "relearnIsSelfFound" true }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- $isSelfFound := eq ($currentNode.Scratch.Get "relearnIsSelfFound") true }}
|
||||
{{- $isPreSelf := and (not $isSelfFound) (not $isSelf) }}
|
||||
{{- $isPostSelf := and ($isSelfFound) (not $isSelf) }}
|
||||
|
@ -36,19 +37,21 @@
|
|||
{{- if $isSelf }}
|
||||
{{- $currentNode.Scratch.Set "relearnIsHiddenNode" $hidden_node }}
|
||||
{{- $currentNode.Scratch.Set "relearnIsHiddenStem" $hidden_stem }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- $currentNode.Scratch.SetInMap "relearnIsHiddenFrom" .node.RelPermalink $hidden_current_stem }}
|
||||
|
||||
{{- if or (eq $currentNode.Kind "home") (eq $currentNode.Kind "section") (eq $currentNode.Kind "page") }}
|
||||
{{- if not $hidden_from_current }}
|
||||
{{- if and $isPreSelf .node.RelPermalink }}
|
||||
{{- $currentNode.Scratch.Set "relearnPrevPage" .node }}
|
||||
{{- else if and $isPostSelf .node.RelPermalink (eq ($currentNode.Scratch.Get "relearnNextPage") nil) }}
|
||||
{{- $currentNode.Scratch.Set "relearnNextPage" .node }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- $pages := partial "pageHelper/pagesBy.html" (dict "page" .node "hidden" true) }}
|
||||
{{- range $pages }}
|
||||
{{- template "relearn-structure" dict "node" . "currentnode" $currentNode "hiddenstem" $hidden_stem "hiddencurrent" $hidden_from_current }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
{{- end }}
|
11
layouts/partials/pageHelper/fullTitle.hugo
Normal file
11
layouts/partials/pageHelper/fullTitle.hugo
Normal file
|
@ -0,0 +1,11 @@
|
|||
{{- $title := partial "pageHelper/title.hugo" . }}
|
||||
{{- with .page }}
|
||||
{{- if and $title site.Title (not (eq $title site.Title)) }}
|
||||
{{- if $.invert }}
|
||||
{{- $title = printf "%s %s %s" $title (default "::" site.Params.titleSeparator) site.Title }}
|
||||
{{- else }}
|
||||
{{- $title = printf "%s %s %s" site.Title (default "::" site.Params.titleSeparator) $title }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- return $title }}
|
32
layouts/partials/pageHelper/title.hugo
Normal file
32
layouts/partials/pageHelper/title.hugo
Normal file
|
@ -0,0 +1,32 @@
|
|||
{{- $title := "" }}
|
||||
{{- with .page }}
|
||||
{{- if .Params.menuTitle }}
|
||||
{{- warnf "%q: DEPRECATED frontmatter 'menutitle' found, use 'linktitle' instead" $.File.Filename }}
|
||||
{{- end }}
|
||||
{{- $format := $.format | default (partial "get-format.hugo" .) }}
|
||||
{{- $outputFormat := $.outputFormat | default (partial "output-format.hugo" (dict "page" . "format" $format)) }}
|
||||
{{- $title = .Title }}
|
||||
{{- if $.useLinkTitle }}
|
||||
{{- $title = or $.page.Params.menuTitle $.page.LinkTitle $title }}
|
||||
{{- end }}
|
||||
|
||||
{{- if eq $outputFormat "searchpage" }}
|
||||
{{- $title = T "Search" }}
|
||||
{{- else if eq .Kind "home" }}
|
||||
{{- $title = or $title site.Title }}
|
||||
{{- else if eq .Kind "taxonomy" }}
|
||||
{{- $title = default (default .Data.Plural (i18n .Data.Plural)) .Params.Title }}
|
||||
{{- else if eq .Kind "term" }}
|
||||
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
||||
{{- $taxonomy_title := default (default $taxonomy_page.Data.Singular (i18n $taxonomy_page.Data.Singular)) $taxonomy_page.Params.SingularTitle }}
|
||||
{{- $term_title := default (humanize .Data.Term | strings.Title) .Title }}
|
||||
{{- if $.useLinkTitle }}
|
||||
{{- $title = printf "%s" $term_title }}
|
||||
{{- else if $.invert }}
|
||||
{{- $title = printf "%s %s %s" $term_title (default "::" .Site.Params.titleSeparator) $taxonomy_title }}
|
||||
{{- else }}
|
||||
{{- $title = printf "%s %s %s" $taxonomy_title (default "::" .Site.Params.titleSeparator) $term_title }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- return $title }}
|
|
@ -5,36 +5,25 @@
|
|||
{{- $format := partial "get-format.hugo" . }}
|
||||
{{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }}
|
||||
{{- $showPrevNext := (and (not .Params.disableNextPrev) (not .Site.Params.disableNextPrev)) }}
|
||||
{{- if and (or (eq $outputFormat "html") (eq $outputFormat "searchpage")) $showPrevNext }}
|
||||
{{- if $showPrevNext }}
|
||||
{{- $endarrow := "🡒" }}
|
||||
{{- if eq (.Language.LanguageDirection | default (T "Reading-direction") | default "ltr") "rtl" }}
|
||||
{{- $endarrow = "🡐" }}
|
||||
{{- end }}
|
||||
{{- $next := "" }}
|
||||
{{- $nextTitle := .Title }}
|
||||
{{- if eq .Page.Kind "taxonomy" }}
|
||||
{{- /* go to first term page */}}
|
||||
{{- $pages := partialCached "partials/pageHelper/taxonomyPages.html" . . }}
|
||||
{{- $next = (index $pages 0).Page }}
|
||||
{{- if $next }}
|
||||
{{- $taxonomy_page := .Page }}
|
||||
{{- $nextTitle = default (default $next.Data.Singular (i18n $next.Data.Singular)) $taxonomy_page.Params.SingularTitle }}
|
||||
{{- $nextTitle = printf "%s %s %s" $nextTitle (default "::" $next.Site.Params.titleSeparator) (default (humanize $next.Data.Term | strings.Title) $next.Title) }}
|
||||
{{- end }}
|
||||
{{- $next := .Scratch.Get "relearnNextPage" }}
|
||||
{{- if eq $outputFormat "searchpage" }}
|
||||
{{- $next = "" }}
|
||||
{{- else if eq .Page.Kind "term" }}
|
||||
{{- /* go to next term page */}}
|
||||
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
||||
{{- $pages := partialCached "partials/pageHelper/taxonomyPages.html" $taxonomy_page $taxonomy_page }}
|
||||
{{- $next = partial "partials/pageHelper/next.html" (dict "collection" $pages "item" .) }}
|
||||
{{- if $next }}
|
||||
{{- $nextTitle = default (default $next.Data.Singular (i18n $next.Data.Singular)) $taxonomy_page.Params.SingularTitle }}
|
||||
{{- $nextTitle = printf "%s %s %s" $nextTitle (default "::" $next.Site.Params.titleSeparator) (default (humanize $next.Data.Term | strings.Title) $next.Title) }}
|
||||
{{- end }}
|
||||
{{- else if or (ne $outputFormat "html") (not (.Scratch.Get "relearnNextPage")) }}
|
||||
{{- else }}
|
||||
{{- $next = .Scratch.Get "relearnNextPage" }}
|
||||
{{- $nextTitle = $next.Title }}
|
||||
{{- else if eq .Page.Kind "taxonomy" }}
|
||||
{{- /* go to first term page */}}
|
||||
{{- $pages := partialCached "partials/pageHelper/taxonomyPages.html" . . }}
|
||||
{{- $next = (index $pages 0).Page }}
|
||||
{{- end }}
|
||||
{{- $nextTitle := partial "pageHelper/title.hugo" (dict "page" $next "format" $format "outputFormat" $outputFormat) }}
|
||||
{{- partial "topbar/func/button.html" (dict
|
||||
"page" .
|
||||
"class" "topbar-button-next"
|
||||
|
|
|
@ -5,36 +5,23 @@
|
|||
{{- $format := partial "get-format.hugo" . }}
|
||||
{{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }}
|
||||
{{- $showPrevNext := (and (not .Params.disableNextPrev) (not .Site.Params.disableNextPrev)) }}
|
||||
{{- if and (or (eq $outputFormat "html") (eq $outputFormat "searchpage")) $showPrevNext }}
|
||||
{{- if $showPrevNext }}
|
||||
{{- $startarrow := "🡐" }}
|
||||
{{- if eq (.Language.LanguageDirection | default (T "Reading-direction") | default "ltr") "rtl" }}
|
||||
{{- $startarrow = "🡒" }}
|
||||
{{- end }}
|
||||
{{- $prev := "" }}
|
||||
{{- $prevTitle := .Title }}
|
||||
{{- if and (eq .RelPermalink .Site.Home.RelPermalink) (eq $outputFormat "html") }}
|
||||
{{- else if eq .Page.Kind "taxonomy" }}
|
||||
{{- $prev = .Site.Home }}
|
||||
{{- $prevTitle = $prev.Title }}
|
||||
{{- $prev := .Scratch.Get "relearnPrevPage" | default .Site.Home }}
|
||||
{{- if eq $outputFormat "searchpage" }}
|
||||
{{- $outputFormat = "html" }}
|
||||
{{- else if eq .Page.Kind "home" }}
|
||||
{{- $prev = "" }}
|
||||
{{- else if eq .Page.Kind "term" }}
|
||||
{{- /* go to previous term page or taxonomy page if it is the first term */}}
|
||||
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
||||
{{- $pages := partialCached "partials/pageHelper/taxonomyPages.html" $taxonomy_page $taxonomy_page }}
|
||||
{{- $prev = partial "partials/pageHelper/prev.html" (dict "collection" $pages "item" .) }}
|
||||
{{- if not $prev }}
|
||||
{{- $prev = $taxonomy_page }}
|
||||
{{- $prevTitle = default (default $prev.Data.Plural (i18n $prev.Data.Plural)) $prev.Params.Title }}
|
||||
{{- else }}
|
||||
{{- $prevTitle = default (default $prev.Data.Singular (i18n $prev.Data.Singular)) $taxonomy_page.Params.SingularTitle }}
|
||||
{{- $prevTitle = printf "%s %s %s" $prevTitle (default "::" $prev.Site.Params.titleSeparator) (default (humanize $prev.Data.Term | strings.Title) $prev.Title) }}
|
||||
{{- $prev = partial "partials/pageHelper/prev.html" (dict "collection" $pages "item" .) | default $taxonomy_page }}
|
||||
{{- end }}
|
||||
{{- else if or (ne $outputFormat "html") (not (.Scratch.Get "relearnPrevPage")) }}
|
||||
{{- $prev = .Site.Home }}
|
||||
{{- $prevTitle = $prev.Title }}
|
||||
{{- else }}
|
||||
{{- $prev = .Scratch.Get "relearnPrevPage" }}
|
||||
{{- $prevTitle = $prev.Title }}
|
||||
{{- end}}
|
||||
{{- $prevTitle := partial "pageHelper/title.hugo" (dict "page" $prev "format" $format "outputFormat" $outputFormat) }}
|
||||
{{- partial "topbar/func/button.html" (dict
|
||||
"page" .
|
||||
"class" "topbar-button-prev"
|
||||
|
|
|
@ -1,20 +1,4 @@
|
|||
{{- /* based on Hugo 0.125.0 _internal/twitter_cardss.html but with modified title */}}
|
||||
{{- $format := partial "get-format.hugo" . }}
|
||||
{{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }}
|
||||
{{- $title := .Title }}
|
||||
{{- if eq $outputFormat "searchpage" }}
|
||||
{{- $title = T "Search" }}
|
||||
{{- else if eq .Kind "taxonomy" }}
|
||||
{{- $title = default (default .Data.Plural (i18n .Data.Plural)) .Params.Title }}
|
||||
{{- else if eq .Kind "term" }}
|
||||
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
||||
{{- $title = default (default .Data.Singular (i18n .Data.Singular)) $taxonomy_page.Params.SingularTitle }}
|
||||
{{- $title = printf "%s %s %s" (default (humanize .Data.Term | strings.Title) .Title) (default "::" .Site.Params.titleSeparator) $title }}
|
||||
{{- end }}
|
||||
{{- if and $title .Site.Title (not (eq $title .Site.Title)) }}
|
||||
{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) .Site.Title }}
|
||||
{{- end }}
|
||||
|
||||
{{- $images := partial "_funcs/get-page-images" . }}
|
||||
{{- with index $images 0 }}
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
|
@ -22,7 +6,7 @@
|
|||
{{- else }}
|
||||
<meta name="twitter:card" content="summary">
|
||||
{{- end }}
|
||||
<meta name="twitter:title" content="{{ $title }}">
|
||||
<meta name="twitter:title" content="{{ partial "pageHelper/fullTitle.hugo" (dict "page" . "invert" true) }}">
|
||||
<meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}">
|
||||
|
||||
{{- $twitterSite := "" }}
|
||||
|
|
Loading…
Reference in a new issue