Improve meta description
Rather than use the same description on every page, prefer the post summary if it's available and only use .Params.description on the root page. This mimics the behavior of the [opengraph internal template](https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/opengraph.html#L2) for the `og:description` tag.
This commit is contained in:
parent
1f47eeb7be
commit
117808b653
|
@ -14,9 +14,7 @@
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
{{- if isset .Site.Params "description" }}
|
<meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}" />
|
||||||
<meta name="description" content="{{ .Site.Params.description }}" />
|
|
||||||
{{- end }}
|
|
||||||
<meta property="og:image" content="{{ .Site.Params.og_image }}"/>
|
<meta property="og:image" content="{{ .Site.Params.og_image }}"/>
|
||||||
{{ with .OutputFormats.Get "rss" -}}
|
{{ with .OutputFormats.Get "rss" -}}
|
||||||
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
|
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
|
||||||
|
|
Loading…
Reference in a new issue