Use description-or-summary partial in SEO tags

This commit is contained in:
BBaoVanC 2021-11-22 14:24:13 -06:00
parent 502fc36b0d
commit f9e7eeeaa6
Signed by: bbaovanc
GPG Key ID: 18089E4E3CCF1D3A
5 changed files with 13 additions and 9 deletions

View File

@ -1,5 +1,9 @@
{{ with .Description }}
<p>{{ . | markdownify }}</p>
{{ else }}
{{ .Summary }}
{{ end }}
{{- with .Description -}}
<p>{{- . | markdownify -}}</p>
{{- else -}}
{{- with .Summary -}}
{{- . -}}
{{- else -}}
{{- .Site.Params.description -}}
{{- end -}}
{{- end -}}

View File

@ -33,5 +33,5 @@
{{ partial "seo-tags/author.html" . }}
<meta name="language" content="{{ .Language.Lang }}">
<meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage }}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}">
<meta name="description" content="{{ (partial "description-or-summary.html" .) | plainify }}">
</head>

View File

@ -1,5 +1,5 @@
<meta property="og:title" content="{{ .Title | plainify }}">
<meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{ if .IsPage }}{{ .Summary | plainify }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}">
<meta property="og:description" content="{{ (partial "description-or-summary.html" .) | plainify }}">
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}">
<meta property="og:url" content="{{ .Permalink }}">

View File

@ -1,5 +1,5 @@
<meta itemprop="name" content="{{ .Title | plainify }}">
<meta itemprop="description" content="{{ with .Description }}{{ . }}{{ else }}{{ if .IsPage }}{{ .Summary | plainify }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}">
<meta itemprop="description" content="{{ (partial "description-or-summary.html" .) | plainify }}">
{{ $format := "2006-01-02T15:04:05-07:00" }}
{{ with .Date }}

View File

@ -22,7 +22,7 @@
{{ end }}
<meta name="twitter:title" content="{{ .Title | plainify }}">
<meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{ if .IsPage }}{{ .Summary | plainify }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}">
<meta name="twitter:description" content="{{ (partial "description-or-summary.html" .) | plainify }}">
{{ with .Site.Social.twitter }}
<meta name="twitter:site" content="@{{ . }}">