From ad19aa52d3f79ac2e0472f66081f2831e4ca02b6 Mon Sep 17 00:00:00 2001 From: George Cushen Date: Tue, 2 Jan 2018 16:31:14 +0000 Subject: [PATCH] header: Improve metadata for page description See discussion in #428 --- layouts/partials/header.html | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 80b5e2ff..f464cb7b 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -8,14 +8,24 @@ {{ .Hugo.Generator }} {{ with .Site.Params.name }}{{ end }} - {{ with .Site.Params.role }}{{ end }} + + {{ $scr := .Scratch }} + {{/* Generate page description. */}} + {{ $scr.Set "description" .Site.Params.role }} + {{ if .IsPage }} + {{ if .Params.abstract }} + {{ $scr.Set "description" .Params.abstract }} + {{ else }} + {{ $scr.Set "description" .Summary }} + {{ end }} + {{ end }} + {{ range .Translations }} {{ end }} - {{ $scr := .Scratch }} {{ partial "css/parse_theme.css" . }} {{ $sri := .Site.Data.sri }} {{ if ne ($scr.Get "primary") "#fff" }} @@ -101,15 +111,7 @@ - + {{- with .Params.header.image }}{{end}} {{ if .IsPage }}