diff options
author | Ngô Ngọc Đức Huy <huyngo@disroot.org> | 2023-07-31 15:32:53 +0700 |
---|---|---|
committer | Ngô Ngọc Đức Huy <huyngo@disroot.org> | 2023-07-31 15:32:53 +0700 |
commit | 5c9e0ecbb5e5d8c777bef62a0074c91b4ff80553 (patch) | |
tree | 8163add677ad3c3f563af8a06ab16ee4eba3fd0a /layouts/partials | |
parent | dcbadc3b6117f23107822d80e2d78a365b3970fe (diff) | |
download | victor-5c9e0ecbb5e5d8c777bef62a0074c91b4ff80553.tar.gz |
Set chapterName variable to unclutter navigation
Diffstat (limited to 'layouts/partials')
-rw-r--r-- | layouts/partials/head.html | 18 | ||||
-rw-r--r-- | layouts/partials/toc.html | 6 |
2 files changed, 22 insertions, 2 deletions
diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 3857a99..cfacfb9 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -3,11 +3,27 @@ {{ $custom := resources.Get "css/custom.css" }} {{ $style := slice $readable $theme $custom | resources.Concat "css/style.css" | minify | fingerprint }} +{{ $fullTitle := .Title }} +{{ with .Params.chapterName }} + {{ $fullTitle = printf "%s – %s" $fullTitle . }} +{{ end }} + +{{ range .Ancestors }} +{{ if in .Params.categories "book" }} + {{ $fullTitle = printf "%s, %s" .Title $fullTitle }} +{{ end }} +{{ end }} + <meta charset="utf-8"> <meta name="HandheldFriendly" content="True"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="referrer" content="no-referrer-when-downgrade"> -<title>{{ if and (.Title) (not .IsHome) }}{{ .Title }} - {{ end }}{{ .Site.Title }}</title> +<title> + {{ if and (.Title) (not .IsHome) }} + {{ $fullTitle }} - + {{ end }} + {{ .Site.Title }} +</title> <meta name="description" content="{{ .Site.Params.Description }}"> <link rel="stylesheet" type="text/css" href="{{ $style.RelPermalink }}"> diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html index f6af753..607e7f0 100644 --- a/layouts/partials/toc.html +++ b/layouts/partials/toc.html @@ -5,7 +5,11 @@ <ol> {{ range sort $chapters "Weight" }} <li> - <a href="{{ .RelPermalink }}">{{ trim .Title " " }}</a> + {{ $fullTitle := .Title }} + {{ with .Params.chapterName }} + {{ $fullTitle = printf "%s – %s" $fullTitle . }} + {{ end }} + <a href="{{ .RelPermalink }}">{{ trim $fullTitle " " }}</a> {{ partial "post-info.html" . }} {{ if .IsSection}} {{ partial "toc.html" . }} |