mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 15:57:57 +00:00
theme: sync to Hugo's implementation #841
This commit is contained in:
parent
f4df3a06ad
commit
af29d89995
7 changed files with 32 additions and 44 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
{{- /* based on Hugo 0.125.3 rss.xml */}}
|
||||||
{{- partialCached "page-meta.hugo" . .RelPermalink }}
|
{{- partialCached "page-meta.hugo" . .RelPermalink }}
|
||||||
{{- /* Deprecate site.Author.email in favor of site.Params.author.email */}}
|
{{- /* Deprecate site.Author.email in favor of site.Params.author.email */}}
|
||||||
{{- $authorEmail := "" }}
|
{{- $authorEmail := "" }}
|
||||||
|
@ -29,15 +30,15 @@
|
||||||
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} on {{ end }}{{ .Site.Title }}{{ end }}</title>
|
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} on {{ end }}{{ .Site.Title }}{{ end }}</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>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{ . }} {{ end }}{{ end }}on {{ .Site.Title }}</description>
|
||||||
<generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
|
<generator>Hugo</generator>
|
||||||
<language>{{ . }}</language>{{end}}{{ 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 }}
|
||||||
<webMaster>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</webMaster>{{ end }}{{ with .Site.Copyright }}
|
<webMaster>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</webMaster>{{ end }}{{ with .Site.Copyright }}
|
||||||
<copyright>{{ . }}</copyright>{{ end }}{{ if not .Date.IsZero }}
|
<copyright>{{ . }}</copyright>{{ end }}{{ if not .Date.IsZero }}
|
||||||
<lastBuildDate>{{ (index $pages.ByLastmod.Reverse 0).Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
|
<lastBuildDate>{{ (index $pages.ByLastmod.Reverse 0).Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
|
||||||
{{- with .OutputFormats.Get "rss" }}
|
{{- with .OutputFormats.Get "rss" }}
|
||||||
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" ( partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true)) .MediaType | safeHTML }}
|
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" ( partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true)) .MediaType | safeHTML }}
|
||||||
{{- end -}}
|
{{- end }}
|
||||||
{{- range $pages }}
|
{{- range $pages }}
|
||||||
{{- $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) ) }}
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
|
{{- /* based on Hugo 0.125.3 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">
|
||||||
{{- range where .Pages "Sitemap.Disable" "ne" true }}
|
{{- range where .Pages "Sitemap.Disable" "ne" true }}
|
||||||
{{- if and .Title .RelPermalink (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSeoHiddenPages true) ) }}
|
{{- if and .Title .RelPermalink (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSeoHiddenPages true) ) }}
|
||||||
<url>
|
<url>
|
||||||
<loc>{{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true) }}</loc>{{ if not .Lastmod.IsZero }}
|
<loc>{{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true) }}</loc>{{ if not .Lastmod.IsZero }}
|
||||||
<lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>{{ end }}{{ with .Sitemap.ChangeFreq }}
|
<lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>{{ end }}{{ with .Sitemap.ChangeFreq }}
|
||||||
|
@ -11,6 +12,6 @@
|
||||||
<xhtml:link rel="alternate" hreflang="x-default" href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true) }}" />{{ end }}
|
<xhtml:link rel="alternate" hreflang="x-default" href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true) }}" />{{ end }}
|
||||||
<xhtml:link rel="alternate" hreflang="{{ .Language.LanguageCode }}" href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true) }}" />{{ end }}{{ end }}
|
<xhtml:link rel="alternate" hreflang="{{ .Language.LanguageCode }}" href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true) }}" />{{ end }}{{ end }}
|
||||||
</url>
|
</url>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
</urlset>
|
</urlset>
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
{{- /* based on Hugo 0.125.3 alias.html */}}
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
@ -22,9 +23,9 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="robots" content="noindex">
|
<meta name="robots" content="noindex">
|
||||||
<meta http-equiv="refresh" content="0; url={{ $url }}">
|
<meta http-equiv="refresh" content="0; url={{ $url }}">
|
||||||
{{- $link := "<link href=\"%s\" rel=\"%s\" type=\"%s\" title=\"%s\">" }}
|
{{- $link := "<link href=\"%s\" rel=\"%s\">" }}
|
||||||
<title>{{ $url }}</title>
|
<title>{{ $url }}</title>
|
||||||
|
|
||||||
{{ (printf $link $url "canonical" "text/html" ($url | htmlEscape)) | safeHTML }}
|
{{ (printf $link $url "canonical" ($url | htmlEscape)) | safeHTML }}
|
||||||
</head>
|
</head>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{{- /* based on Hugo 0.125.0 _internal/opengraph.html but with modified title */}}
|
{{- /* based on Hugo 0.125.3 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" }}
|
||||||
|
@ -74,23 +74,14 @@
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- $facebookAdmin := "" }}
|
{{- with site.Params.social }}
|
||||||
{{- with site.Params.social.facebook_admin }}
|
{{- if reflect.IsMap . }}
|
||||||
{{- $facebookAdmin = . }}
|
{{- with .facebook_app_id }}
|
||||||
{{- else }}
|
<meta property="fb:app_id" content="{{ . }}">
|
||||||
{{- with site.Social.facebook_admin }}
|
{{- else }}
|
||||||
{{- $facebookAdmin = . }}
|
{{- with .facebook_admin }}
|
||||||
{{- $hugoVersion := "0.120.0" }}
|
<meta property="fb:admins" content="{{ . }}">
|
||||||
{{- if ge hugo.Version $hugoVersion }}
|
{{- end }}
|
||||||
{{- warnf "The social key in site configuration is deprecated. Use params.social.facebook_admin instead." }}
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- with $facebookApp }}
|
|
||||||
<meta property="fb:app_id" content="{{ . }}">
|
|
||||||
{{- else }}
|
|
||||||
{{- with $facebookAdmin }}
|
|
||||||
<meta property="fb:admins" content="{{ . }}">
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
{{- /* based on Hugo 0.125.3 render-image.html */}}
|
||||||
{{- $page := .page }}
|
{{- $page := .page }}
|
||||||
{{- if and (not $page) .context }}
|
{{- if and (not $page) .context }}
|
||||||
{{- $page = .context }}
|
{{- $page = .context }}
|
||||||
|
@ -77,7 +78,7 @@
|
||||||
{{- $classes = $classes | append $c }}
|
{{- $classes = $classes | append $c }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- $id := cond (or (eq .id nil) (eq .id "")) (partial "make-random-md5.hugo" $page) .id }}
|
{{- $id := cond (or (eq .id nil) (eq .id "")) (partial "make-random-md5.hugo" $page) .id }}
|
||||||
{{- $attributes = merge $attributes (dict "alt" $alt "src" $url "title" $title) }}
|
{{- $attributes = merge $attributes (dict "alt" $alt "src" $url "title" ($title | transform.HTMLEscape)) }}
|
||||||
{{- if $effects.lazy }}
|
{{- if $effects.lazy }}
|
||||||
{{- $attributes = merge $attributes (dict "loading" "lazy") }}
|
{{- $attributes = merge $attributes (dict "loading" "lazy") }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
{{- /* based on Hugo 0.125.3 render-link.html */}}
|
||||||
{{- $page := .page }}
|
{{- $page := .page }}
|
||||||
{{- if and (not $page) .context }}
|
{{- if and (not $page) .context }}
|
||||||
{{- $page = .context }}
|
{{- $page = .context }}
|
||||||
|
@ -10,7 +11,7 @@
|
||||||
{{- $attributes := dict }}
|
{{- $attributes := dict }}
|
||||||
{{- $title := .title | default "" }}
|
{{- $title := .title | default "" }}
|
||||||
{{- $title = trim $title " " }}
|
{{- $title = trim $title " " }}
|
||||||
{{- $attributes = $attributes | merge (dict "title" $title) }}
|
{{- $attributes = $attributes | merge (dict "title" ($title | transform.HTMLEscape)) }}
|
||||||
{{- $content := .content }}
|
{{- $content := .content }}
|
||||||
{{- $target := .target | default "" }}
|
{{- $target := .target | default "" }}
|
||||||
{{- $u := urls.Parse $url }}
|
{{- $u := urls.Parse $url }}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{{- /* based on Hugo 0.125.0 _internal/twitter_cardss.html but with modified title */}}
|
{{- /* based on Hugo 0.125.3 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">
|
||||||
|
@ -10,22 +10,14 @@
|
||||||
<meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}">
|
<meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}">
|
||||||
|
|
||||||
{{- $twitterSite := "" }}
|
{{- $twitterSite := "" }}
|
||||||
{{- with site.Params.social.twitter }}
|
{{- with site.Params.social }}
|
||||||
{{- $twitterSite = . }}
|
{{- if reflect.IsMap . }}
|
||||||
{{- else }}
|
{{- with .twitter }}
|
||||||
{{- with site.Social.twitter }}
|
{{- $content := . }}
|
||||||
{{- $twitterSite = . }}
|
{{- if not (strings.HasPrefix . "@") }}
|
||||||
{{- $hugoVersion := "0.120.0" }}
|
{{- $content = printf "@%v" . }}
|
||||||
{{- if ge hugo.Version $hugoVersion }}
|
{{- end }}
|
||||||
{{- warnf "The social key in site configuration is deprecated. Use params.social.twitter instead." }}
|
<meta name="twitter:site" content="{{ $content }}"/>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- with $twitterSite }}
|
|
||||||
{{- $content := . }}
|
|
||||||
{{- if not (strings.HasPrefix . "@") }}
|
|
||||||
{{- $content = printf "@%v" . }}
|
|
||||||
{{- end }}
|
|
||||||
<meta name="twitter:site" content="{{ $content }}">
|
|
||||||
{{- end }}
|
|
Loading…
Reference in a new issue