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 | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 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 }} + {{ $title = $defaultTitle }} + {{ $description = .Site.Params.description }} + {{ $keywords = .Site.Params.keywords }} + {{- end }} + {{- with $description }} {{- end }} - {{- with .Site.Params.keywords }} + {{- with $keywords }} {{- end }} - - {{- else if in .Page.URL "/posts/" }} - {{- with .Page.Description }} - - {{- end }} - {{- with .Page.Keywords }} - - {{- end }} - {{- with .Page.Params.Author }} - {{- $author := index $.Site.Data.authors . }} + {{- with $author }} {{- end }} - {{- end }} - {{ .Site.Title }} - {{ .Site.Params.longTitle }} + {{ $title }}