mirror of
https://github.com/thegeeklab/hugo-geekdoc.git
synced 2024-11-25 22:30:40 +00:00
fix: fix isPage detection for metatdata tags (#348)
This commit is contained in:
parent
928906b251
commit
2ecb63e7b2
@ -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
|
<meta
|
||||||
property="og:title"
|
property="og:title"
|
||||||
{{ partial "utils/title" . | printf "content=%q" | safeHTMLAttr }}
|
{{ partial "utils/title" . | printf "content=%q" | safeHTMLAttr }}
|
||||||
@ -13,7 +15,7 @@
|
|||||||
{{- with partial "utils/description" . }}
|
{{- with partial "utils/description" . }}
|
||||||
<meta property="og:description" content="{{ . | plainify | htmlUnescape | chomp }}" />
|
<meta property="og:description" content="{{ . | plainify | htmlUnescape | chomp }}" />
|
||||||
{{- end }}
|
{{- 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 }}" />
|
<meta property="og:url" content="{{ .Permalink }}" />
|
||||||
{{- with .Params.audio }}
|
{{- with .Params.audio }}
|
||||||
<meta property="og:audio" content="{{ . }}" />
|
<meta property="og:audio" content="{{ . }}" />
|
||||||
@ -43,7 +45,7 @@
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{ if .IsPage -}}
|
{{ if $isPage -}}
|
||||||
{{- $iso8601 := "2006-01-02T15:04:05-07:00" -}}
|
{{- $iso8601 := "2006-01-02T15:04:05-07:00" -}}
|
||||||
<meta property="article:section" content="{{ .Section | humanize | title }}" />
|
<meta property="article:section" content="{{ .Section | humanize | title }}" />
|
||||||
{{- with .PublishDate }}
|
{{- with .PublishDate }}
|
||||||
|
@ -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" }}
|
{{- if eq .Kind "home" }}
|
||||||
<script type="application/ld+json">
|
<script type="application/ld+json">
|
||||||
{
|
{
|
||||||
@ -17,7 +18,7 @@
|
|||||||
"inLanguage": {{ .Lang }}
|
"inLanguage": {{ .Lang }}
|
||||||
}
|
}
|
||||||
</script>
|
</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">
|
<script type="application/ld+json">
|
||||||
{
|
{
|
||||||
"@context": "http://schema.org",
|
"@context": "http://schema.org",
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
|
{{ $isPage := or (and (ne .Type "posts") (in "section page" .Kind )) (and (eq .Type "posts") (eq .Kind "page")) }}
|
||||||
{{ $description := "" }}
|
{{ $description := "" }}
|
||||||
|
|
||||||
{{ if .Description }}
|
{{ if .Description }}
|
||||||
{{ $description = .Description }}
|
{{ $description = .Description }}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
{{ if .IsPage }}
|
{{ if $isPage }}
|
||||||
{{ $description = .Summary }}
|
{{ $description = .Summary }}
|
||||||
{{ else if .Site.Params.description }}
|
{{ else if .Site.Params.description }}
|
||||||
{{ $description = .Site.Params.description }}
|
{{ $description = .Site.Params.description }}
|
||||||
|
Loading…
Reference in New Issue
Block a user