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

github.com/athul/archie.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Wittman <dave@wittman.xyz>2021-05-22 18:54:55 +0300
committerAthul Cyriac Ajay <athul8720@gmail.com>2021-05-22 19:08:59 +0300
commit117808b653817e8ff7c7fc747361d2227de07a82 (patch)
treee56a607658434aad38b60b019db4df7298b44efd
parent1f47eeb7bedefd8fee4d8bae7072766cfa2219ad (diff)
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.
-rw-r--r--layouts/partials/header.html4
1 files changed, 1 insertions, 3 deletions
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
index c594dfb..14b1248 100644
--- a/layouts/partials/header.html
+++ b/layouts/partials/header.html
@@ -14,9 +14,7 @@
{{- end -}}
<meta name="viewport" content="width=device-width, initial-scale=1">
- {{- if isset .Site.Params "description" }}
- <meta name="description" content="{{ .Site.Params.description }}" />
- {{- end }}
+ <meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}" />
<meta property="og:image" content="{{ .Site.Params.og_image }}"/>
{{ with .OutputFormats.Get "rss" -}}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}