commit 01478b70877edec2ab7d3684899a3bd5077e9a3d parent 7b2f1d6744fdefd69fb49963efb808ab36b459dd Author: Shimmy Xu <shimmy.xu@shimmy1996.com> Date: Sat, 30 Nov 2019 09:18:51 -0500 Add site title only when page title is different from site title Diffstat:
M | README.org | | | 4 | ++-- |
M | layouts/partials/head.html | | | 6 | +----- |
2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/README.org b/README.org @@ -16,11 +16,11 @@ What is retained though is support for multilingual page contents. The result is 1 ./layouts/partials/footer.html 0 ./layouts/partials/head_custom.html 17 ./layouts/partials/nav.html - 11 ./layouts/partials/head.html + 7 ./layouts/partials/head.html 4 ./layouts/_default/single.html 14 ./layouts/_default/list.html 11 ./layouts/_default/baseof.html - 95 total + 91 total #+END_EXAMPLE ** Customization diff --git a/layouts/partials/head.html b/layouts/partials/head.html @@ -2,10 +2,6 @@ <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <style>{{ partial "css/style.css" . | safeCSS }}</style> - {{ if .IsHome }} - <title>{{ .Site.Title }}</title> - {{ else }} - <title>{{ .Title }} | {{ .Site.Title }}</title> - {{ end }} + <title>{{ .Title }}{{ if (ne .Title .Site.Title) }} | {{ .Site.Title }}{{ end }}</title> {{ partial "head_custom.html" . }} </head>