mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
title: avoid to much dependency on outputFormat #685
This commit is contained in:
parent
be860ccbf7
commit
926bea4727
11 changed files with 50 additions and 48 deletions
|
@ -1,16 +1,14 @@
|
|||
{{- 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) }}
|
||||
{{- $tags = $tags | append (partial "pageHelper/title.hugo" (dict "page" .Page "linkTitle" true) | plainify) }}
|
||||
{{- end }}
|
||||
{{- $pages = $pages | append (dict
|
||||
"uri" (partial "relLangPrettyUglyURL.hugo" (dict "to" .))
|
||||
"title" (partial "pageHelper/title.hugo" (dict "page" . "format" $format "outputFormat" $outputFormat) | plainify)
|
||||
"title" (partial "pageHelper/title.hugo" (dict "page" .) | plainify)
|
||||
"tags" $tags
|
||||
"breadcrumb" (partial "breadcrumbs.html" (dict "page" . "dirOnly" true) | plainify | htmlUnescape | chomp)
|
||||
"description" (or .Description .Summary | plainify | htmlUnescape | chomp)
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
{{- /* 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 }}
|
||||
|
@ -29,7 +27,7 @@
|
|||
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>{{ partial "pageHelper/title.hugo" (dict "page" . "fullyQualified" true "reverse" true "format" $format "outputFormat" $outputFormat) }}</title>
|
||||
<title>{{ partial "pageHelper/title.hugo" (dict "page" . "fullyQualified" true "reverse" true) }}</title>
|
||||
<link>{{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true) }}</link>
|
||||
<description>{{ or .Description .Summary | plainify | htmlUnescape | chomp | transform.XMLEscape | safeHTML }}</description>
|
||||
<generator>Hugo</generator>
|
||||
|
@ -51,7 +49,7 @@
|
|||
{{- end }}
|
||||
{{- if $visible }}
|
||||
<item>
|
||||
<title>{{ partial "pageHelper/title.hugo" (dict "page" . "format" $format "outputFormat" $outputFormat) }}</title>
|
||||
<title>{{ partial "pageHelper/title.hugo" (dict "page" .) }}</title>
|
||||
<link>{{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true) }}</link>
|
||||
<pubDate>{{ (or .PublishDate .Date).Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
|
||||
{{- with $authorEmail }}<author>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</author>{{ end }}
|
||||
|
|
|
@ -2,8 +2,10 @@
|
|||
{{- $format := partial "get-format.hugo" . }}
|
||||
{{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }}
|
||||
{{- $basename := "index" }}
|
||||
{{- if eq $outputFormat "searchpage" }}
|
||||
{{- $basename = partial "BaseName.hugo" $format.RelPermalink }}
|
||||
{{- if eq .Kind "home" }}
|
||||
{{- if eq $outputFormat "searchpage" }}
|
||||
{{- $basename = partial "BaseName.hugo" $format.RelPermalink }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if eq . .Site.Sites.First.Home }}
|
||||
{{- $hugoVersion := "0.121.0" }}
|
||||
|
@ -19,7 +21,7 @@
|
|||
{{- partial "meta.html" . }}
|
||||
{{- $page := . }}
|
||||
{{- $link := "<link href=\"%s\" rel=\"%s\" type=\"%s\" title=\"%s\">" }}
|
||||
{{- $title := partial "pageHelper/title.hugo" (dict "page" . "fullyQualified" true "reverse" true "format" $format "outputFormat" $outputFormat) }}
|
||||
{{- $title := partial "pageHelper/title.hugo" (dict "page" . "fullyQualified" true "reverse" true) }}
|
||||
<title>{{ $title }}</title>
|
||||
|
||||
{{- if .IsTranslated -}}
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
|
||||
{{- $showvisitedlinks := .Site.Params.showVisitedLinks }}
|
||||
{{- $format := partial "get-format.hugo" . }}
|
||||
{{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }}
|
||||
{{- $basename := "index" }}
|
||||
{{- if eq $outputFormat "searchpage" }}
|
||||
{{- $basename = partial "BaseName.hugo" $format.RelPermalink }}
|
||||
{{- if eq .Kind "home" }}
|
||||
{{- $format := partial "get-format.hugo" . }}
|
||||
{{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }}
|
||||
{{- if eq $outputFormat "searchpage" }}
|
||||
{{- $basename = partial "BaseName.hugo" $format.RelPermalink }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
<aside id="R-sidebar" class="default-animation{{ if $showvisitedlinks }} showVisitedLinks{{ end }}">
|
||||
{{- $currentNode := . }}
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
{{- /* based on Hugo 0.125.5 opengraph.html */}}
|
||||
{{- $format := partial "get-format.hugo" . }}
|
||||
{{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }}
|
||||
{{- $basename := "index" }}
|
||||
{{- if eq $outputFormat "searchpage" }}
|
||||
{{- $basename = partial "BaseName.hugo" $format.RelPermalink }}
|
||||
{{- if eq .Kind "home" }}
|
||||
{{- $format := partial "get-format.hugo" . }}
|
||||
{{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }}
|
||||
{{- if eq $outputFormat "searchpage" }}
|
||||
{{- $basename = partial "BaseName.hugo" $format.RelPermalink }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
<meta property="og:url" content="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true "basename" $basename) }}">
|
||||
|
||||
|
@ -11,7 +13,7 @@
|
|||
<meta property="og:site_name" content="{{ . }}">
|
||||
{{- end }}
|
||||
|
||||
{{- with partial "pageHelper/title.hugo" (dict "page" . "fullyQualified" true "reverse" true "format" $format "outputFormat" $outputFormat) | plainify }}
|
||||
{{- with partial "pageHelper/title.hugo" (dict "page" . "fullyQualified" true "reverse" true) | plainify }}
|
||||
<meta property="og:title" content="{{ . }}">
|
||||
{{- end }}
|
||||
|
||||
|
@ -26,7 +28,7 @@
|
|||
{{- if .IsPage }}
|
||||
<meta property="og:type" content="article">
|
||||
{{- with .FirstSection }}
|
||||
<meta property="article:section" content="{{ partial "pageHelper/title.hugo" (dict "page" . "format" $format "outputFormat" $outputFormat) | plainify }}">
|
||||
<meta property="article:section" content="{{ partial "pageHelper/title.hugo" (dict "page" .) | plainify }}">
|
||||
{{- end }}
|
||||
{{- $iso8601 := "2006-01-02T15:04:05-07:00" }}
|
||||
{{- with or .PublishDate .Date }}
|
||||
|
@ -36,7 +38,7 @@
|
|||
<meta property="article:modified_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }}>
|
||||
{{- end }}
|
||||
{{- range .GetTerms "tags" | first 6 }}
|
||||
<meta property="article:tag" content="{{ partial "pageHelper/title.hugo" (dict "page" .Page "linkTitle" true "format" $format "outputFormat" $outputFormat) | plainify }}">
|
||||
<meta property="article:tag" content="{{ partial "pageHelper/title.hugo" (dict "page" .Page "linkTitle" true) | plainify }}">
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
<meta property="og:type" content="website">
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
{{- $format := partial "get-format.hugo" . }}
|
||||
{{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }}
|
||||
{{- $pages := slice }}
|
||||
{{- range .Data.Terms }}
|
||||
{{- $count := 0 }}
|
||||
|
@ -10,7 +8,7 @@
|
|||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if $count }}
|
||||
{{- $pages = $pages| append (dict "Title" (partial "pageHelper/title.hugo" (dict "page" .Page "linkTitle" true "format" $format "outputFormat" $outputFormat)) "Page" .Page "Count" $count )}}
|
||||
{{- $pages = $pages| append (dict "Title" (partial "pageHelper/title.hugo" (dict "page" .Page "linkTitle" true)) "Page" .Page "Count" $count )}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $pages = sort $pages ".Title" }}
|
||||
|
|
|
@ -11,8 +11,11 @@
|
|||
|
||||
{{- if eq .Kind "home" }}
|
||||
{{- $title = $title | default $siteTitle }}
|
||||
{{- $format := $.format | default (partial "get-format.hugo" .) }}
|
||||
{{- $outputFormat := $.outputFormat | default (partial "output-format.hugo" (dict "page" . "format" $format)) }}
|
||||
{{- $outputFormat := $.outputFormat }}
|
||||
{{- if not $outputFormat }}
|
||||
{{- $format := $.format | default (partial "get-format.hugo" .) }}
|
||||
{{- $outputFormat = $.outputFormat | default (partial "output-format.hugo" (dict "page" . "format" $format)) }}
|
||||
{{- end }}
|
||||
{{- if eq $outputFormat "searchpage" }}
|
||||
{{- $title = T "Search" }}
|
||||
{{- end }}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
{{- /* 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 }}
|
||||
{{- with partial "pageHelper/title.hugo" (dict "page" . "fullyQualified" true "reverse" true) | plainify }}
|
||||
<meta itemprop="name" content="{{ . }}">
|
||||
{{- end }}
|
||||
|
||||
|
@ -38,17 +36,17 @@ Keywords precedence:
|
|||
*/}}
|
||||
{{- $keywords := slice }}
|
||||
{{- range .GetTerms "keywords" }}
|
||||
{{- $keywords = $keywords | append (partial "pageHelper/title.hugo" (dict "page" .Page "linkTitle" true "format" $format "outputFormat" $outputFormat) | plainify) }}
|
||||
{{- $keywords = $keywords | append (partial "pageHelper/title.hugo" (dict "page" .Page "linkTitle" true) | plainify) }}
|
||||
{{- else }}
|
||||
{{- with .Keywords }}
|
||||
{{- $keywords = . }}
|
||||
{{- else }}
|
||||
{{- range .GetTerms "tags" }}
|
||||
{{- $keywords = $keywords | append (partial "pageHelper/title.hugo" (dict "page" .Page "linkTitle" true "format" $format "outputFormat" $outputFormat) | plainify) }}
|
||||
{{- $keywords = $keywords | append (partial "pageHelper/title.hugo" (dict "page" .Page "linkTitle" true) | plainify) }}
|
||||
{{- else }}
|
||||
{{- range $taxonomy, $_ := site.Taxonomies }}
|
||||
{{- range $.GetTerms $taxonomy }}
|
||||
{{- $keywords = $keywords | append (partial "pageHelper/title.hugo" (dict "page" .Page "linkTitle" true "format" $format "outputFormat" $outputFormat) | plainify) }}
|
||||
{{- $keywords = $keywords | append (partial "pageHelper/title.hugo" (dict "page" .Page "linkTitle" true) | plainify) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
{{- $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 "" }}
|
||||
|
@ -16,9 +14,9 @@
|
|||
{{- $taxonomy_page := $page.Site.GetPage $taxonomy }}
|
||||
{{- $term_pages := slice }}
|
||||
{{- range $page.GetTerms $taxonomy }}
|
||||
{{- $term_pages = $term_pages | append (dict "Title" (partial "pageHelper/title.hugo" (dict "page" . "linkTitle" true "format" $format "outputFormat" $outputFormat)) "Term" . )}}
|
||||
{{- $term_pages = $term_pages | append (dict "Title" (partial "pageHelper/title.hugo" (dict "page" . "linkTitle" true)) "Term" . )}}
|
||||
{{- end }}
|
||||
{{- $taxonomy_title := partial "pageHelper/title.hugo" (dict "page" $taxonomy_page "format" $format "outputFormat" $outputFormat) }}
|
||||
{{- $taxonomy_title := partial "pageHelper/title.hugo" (dict "page" $taxonomy_page) }}
|
||||
{{- 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 }}>
|
||||
{{- if $icon }}
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
{{- $onwidthm := cond (isset . "onwidthm") .onwidthm "show" }}
|
||||
{{- $onwidthl := cond (isset . "onwidthl") .onwidthl "show" }}
|
||||
{{- with .page }}
|
||||
{{- $format := partial "get-format.hugo" . }}
|
||||
{{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }}
|
||||
{{- $showPrevNext := (and (not .Params.disableNextPrev) (not .Site.Params.disableNextPrev)) }}
|
||||
{{- if $showPrevNext }}
|
||||
{{- $endarrow := "🡒" }}
|
||||
|
@ -11,8 +9,12 @@
|
|||
{{- $endarrow = "🡐" }}
|
||||
{{- end }}
|
||||
{{- $next := .Scratch.Get "relearnNextPage" }}
|
||||
{{- if eq $outputFormat "searchpage" }}
|
||||
{{- $next = "" }}
|
||||
{{- if eq .Page.Kind "home" }}
|
||||
{{- $format := partial "get-format.hugo" .Page }}
|
||||
{{- $outputFormat := partial "output-format.hugo" (dict "page" .Page "format" $format) }}
|
||||
{{- if eq $outputFormat "searchpage" }}
|
||||
{{- $next = "" }}
|
||||
{{- end }}
|
||||
{{- else if eq .Page.Kind "term" }}
|
||||
{{- /* go to next term page */}}
|
||||
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
||||
|
@ -23,7 +25,7 @@
|
|||
{{- $pages := partialCached "partials/pageHelper/taxonomyPages.html" . . }}
|
||||
{{- $next = (index $pages 0).Page }}
|
||||
{{- end }}
|
||||
{{- $nextTitle := partial "pageHelper/title.hugo" (dict "page" $next "format" $format "outputFormat" $outputFormat) }}
|
||||
{{- $nextTitle := partial "pageHelper/title.hugo" (dict "page" $next "outputFormat" "html") }}
|
||||
{{- partial "topbar/func/button.html" (dict
|
||||
"page" .
|
||||
"class" "topbar-button-next"
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
{{- $onwidthm := cond (isset . "onwidthm") .onwidthm "show" }}
|
||||
{{- $onwidthl := cond (isset . "onwidthl") .onwidthl "show" }}
|
||||
{{- with .page }}
|
||||
{{- $format := partial "get-format.hugo" . }}
|
||||
{{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }}
|
||||
{{- $showPrevNext := (and (not .Params.disableNextPrev) (not .Site.Params.disableNextPrev)) }}
|
||||
{{- if $showPrevNext }}
|
||||
{{- $startarrow := "🡐" }}
|
||||
|
@ -11,9 +9,12 @@
|
|||
{{- $startarrow = "🡒" }}
|
||||
{{- end }}
|
||||
{{- $prev := .Scratch.Get "relearnPrevPage" }}
|
||||
{{- if eq $outputFormat "searchpage" }}
|
||||
{{- $outputFormat = "html" }}
|
||||
{{- $prev = .Site.Home }}
|
||||
{{- if eq .Page.Kind "home" }}
|
||||
{{- $format := partial "get-format.hugo" .Page }}
|
||||
{{- $outputFormat := partial "output-format.hugo" (dict "page" .Page "format" $format) }}
|
||||
{{- if eq $outputFormat "searchpage" }}
|
||||
{{- $prev = .Site.Home }}
|
||||
{{- end }}
|
||||
{{- 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 }}
|
||||
|
@ -22,7 +23,7 @@
|
|||
{{- else if eq .Page.Kind "taxonomy" }}
|
||||
{{- $prev = .Site.Home }}
|
||||
{{- end }}
|
||||
{{- $prevTitle := partial "pageHelper/title.hugo" (dict "page" $prev "format" $format "outputFormat" $outputFormat) }}
|
||||
{{- $prevTitle := partial "pageHelper/title.hugo" (dict "page" $prev "outputFormat" "html") }}
|
||||
{{- partial "topbar/func/button.html" (dict
|
||||
"page" .
|
||||
"class" "topbar-button-prev"
|
||||
|
|
Loading…
Reference in a new issue