mirror of
https://github.com/thegeeklab/hugo-geekdoc.git
synced 2024-11-22 04:40: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
|
||||
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 }}
|
||||
|
@ -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",
|
||||
|
@ -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 }}
|
||||
|
Loading…
Reference in New Issue
Block a user