From 4d151144e3122d38c8af57ca0bea8c8f378f2104 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Thu, 7 Feb 2019 00:31:34 +0100 Subject: [PATCH] add site specific title and meta attributes --- layouts/partials/head.html | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/layouts/partials/head.html b/layouts/partials/head.html index a117acc..cf1d71e 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -1,27 +1,25 @@ + {{- $defaultTitle := ( printf "%s - %s" .Site.Title .Site.Params.longTitle ) }} + {{- $title := .Title | default $defaultTitle }} + {{- $description := .Page.Description }} + {{- $keywords := .Page.Keywords }} + {{- $author := index $.Site.Data.authors (.Page.Params.Author | default .Site.Params.author) }} {{- if .IsHome }} - {{- $author := index $.Site.Data.authors .Site.Params.author }} - {{- with .Site.Params.description }} - - {{- end }} - {{- with .Site.Params.keywords }} - + {{ $title = $defaultTitle }} + {{ $description = .Site.Params.description }} + {{ $keywords = .Site.Params.keywords }} {{- end }} - - {{- else if in .Page.URL "/posts/" }} - {{- with .Page.Description }} + {{- with $description }} {{- end }} - {{- with .Page.Keywords }} + {{- with $keywords }} {{- end }} - {{- with .Page.Params.Author }} - {{- $author := index $.Site.Data.authors . }} + {{- with $author }} {{- end }} - {{- end }} - {{ .Site.Title }} - {{ .Site.Params.longTitle }} + {{ $title }}