diff options
author | Yihui Xie <xie@yihui.name> | 2017-07-16 09:35:04 +0300 |
---|---|---|
committer | Yihui Xie <xie@yihui.name> | 2017-07-16 09:37:10 +0300 |
commit | bc3c0900242f3a72aabf3b850c763bc26dcf9691 (patch) | |
tree | f5d68168fddcf3c396558f43a0a67183888ad067 | |
parent | 0806780215fcd4a6dc792c609363fbc5ab114d5e (diff) |
an ugly hack to make categories/tags names customizable
if only Hugo could allow us to easily change the text "Categories"/"Tags"
-rw-r--r-- | layouts/_default/terms.html | 2 | ||||
-rw-r--r-- | layouts/partials/header.html | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/layouts/_default/terms.html b/layouts/_default/terms.html index fa91d47..2f432ed 100644 --- a/layouts/_default/terms.html +++ b/layouts/_default/terms.html @@ -3,7 +3,7 @@ <div class="container"> <article> <main> -<h1>{{ .Title }}</h1> +<h1>{{ $.Scratch.Get "Title" }}</h1> <ul class="terms"> {{ range $key, $value := .Data.Terms }} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index bff1bd1..87263fc 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -3,7 +3,8 @@ <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> - <title>{{ .Title }} | {{ .Site.Title }}</title> + {{ $.Scratch.Set "Title" (default .Title (index .Site.Params.text (print "title_" (lower .Title)))) }} + <title>{{ if eq ($.Scratch.Get "Title") .Site.Title }}{{ .Site.Title }}{{ else }}{{ ($.Scratch.Get "Title") }} | {{ .Site.Title }}{{ end }}</title> <link rel="stylesheet" href="{{ "/css/style.css" | relURL }}" /> <link rel="stylesheet" href="{{ "/css/fonts.css" | relURL }}" /> {{ partial "head_custom.html" . }} @@ -28,7 +29,7 @@ {{ end }} {{ end }} {{ else }} - <span>{{ .Title }}</span> + <span>{{ $.Scratch.Get "Title" }}</span> <span>{{ now.Format "2006/01/02" }}</span> {{ $paginator := .Paginate (where .Data.Pages "Section" "!=" "") }} {{ with $paginator }}<span>{{ .PageNumber }} / {{ .TotalPages }}</span>{{ end }} |