Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/thegeeklab/hugo-geekdoc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Kaussow <mail@thegeeklab.de>2022-02-18 16:03:19 +0300
committerGitHub <noreply@github.com>2022-02-18 16:03:19 +0300
commit2ecb63e7b2f9543ec52a4cf45d64ce89e29377ee (patch)
tree6f7f653adeb493ea90d1e24f748cf70ace17e386
parent928906b251f1621baa9138213444b952b0390190 (diff)
fix: fix isPage detection for metatdata tags (#348)v0.27.1
-rw-r--r--layouts/partials/microformats/opengraph.html8
-rw-r--r--layouts/partials/microformats/schema.html3
-rw-r--r--layouts/partials/utils/description.html3
3 files changed, 9 insertions, 5 deletions
diff --git a/layouts/partials/microformats/opengraph.html b/layouts/partials/microformats/opengraph.html
index 574420c..97716ca 100644
--- a/layouts/partials/microformats/opengraph.html
+++ b/layouts/partials/microformats/opengraph.html
@@ -1,4 +1,6 @@
-{{- if not (eq .Kind "home") }}
+{{ $isPage := or (and (ne .Type "posts") (in "section page" .Kind )) (and (eq .Type "posts") (eq .Kind "page")) }}
+
+{{- if ne .Kind "home" }}
<meta
property="og:title"
{{ partial "utils/title" . | printf "content=%q" | safeHTMLAttr }}
@@ -13,7 +15,7 @@
{{- with partial "utils/description" . }}
<meta property="og:description" content="{{ . | plainify | htmlUnescape | chomp }}" />
{{- end }}
-<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" />
+<meta property="og:type" content="{{ if $isPage }}article{{ else }}website{{ end }}" />
<meta property="og:url" content="{{ .Permalink }}" />
{{- with .Params.audio }}
<meta property="og:audio" content="{{ . }}" />
@@ -43,7 +45,7 @@
{{- end }}
{{- end }}
-{{ if .IsPage -}}
+{{ if $isPage -}}
{{- $iso8601 := "2006-01-02T15:04:05-07:00" -}}
<meta property="article:section" content="{{ .Section | humanize | title }}" />
{{- with .PublishDate }}
diff --git a/layouts/partials/microformats/schema.html b/layouts/partials/microformats/schema.html
index ba841b7..4b7ff57 100644
--- a/layouts/partials/microformats/schema.html
+++ b/layouts/partials/microformats/schema.html
@@ -1,3 +1,4 @@
+{{ $isPage := or (and (ne .Type "posts") (in "section page" .Kind )) (and (eq .Type "posts") (eq .Kind "page")) }}
{{- if eq .Kind "home" }}
<script type="application/ld+json">
{
@@ -17,7 +18,7 @@
"inLanguage": {{ .Lang }}
}
</script>
-{{- else if or (and (not (eq .Type "posts")) (in "section page" .Kind )) (and (eq .Type "posts") (eq .Kind "page")) }}
+{{- else if $isPage }}
<script type="application/ld+json">
{
"@context": "http://schema.org",
diff --git a/layouts/partials/utils/description.html b/layouts/partials/utils/description.html
index a639681..f5eafb2 100644
--- a/layouts/partials/utils/description.html
+++ b/layouts/partials/utils/description.html
@@ -1,9 +1,10 @@
+{{ $isPage := or (and (ne .Type "posts") (in "section page" .Kind )) (and (eq .Type "posts") (eq .Kind "page")) }}
{{ $description := "" }}
{{ if .Description }}
{{ $description = .Description }}
{{ else }}
- {{ if .IsPage }}
+ {{ if $isPage }}
{{ $description = .Summary }}
{{ else if .Site.Params.description }}
{{ $description = .Site.Params.description }}