From d5b87cb15e820e3ee8335363b26f4fcbf0e8d783 Mon Sep 17 00:00:00 2001 From: Den McHenry Date: Mon, 15 Jan 2018 17:26:37 -0800 Subject: [PATCH] Don't duplicate site title in home page TITLE tag (#78) Let's say your `.Site.Title` is "My Website". The code grabs `.Site.Title`, and then then checks to see if there's a `.Title`. When you're on the homepage, `.Title` is equivalent to `.Site.Title`, so that the browser bar will read: > My Website | My Website If we qualify `.Title` by confining to the `.Params` namespace, then the site title isn't duplicated: ```{{ block "title" . }}{{ .Site.Title }} {{ with .Params.Title }} | {{ . }}{{ end }}{{ end }}``` > My Website But it still picks up `.Title` from posts and pages, where a content title exists in front matter: > My Website | About Me --- layouts/_default/baseof.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 577940a..cf7f6eb 100755 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -4,7 +4,7 @@ {{/* NOTE: the Site's title, and if there is a page title, that is set too */}} - {{ block "title" . }}{{ .Site.Title }} {{ with .Title }} | {{ . }}{{ end }}{{ end }} + {{ block "title" . }}{{ .Site.Title }} {{ with .Params.Title }} | {{ . }}{{ end }}{{ end }}