From 5c9e0ecbb5e5d8c777bef62a0074c91b4ff80553 Mon Sep 17 00:00:00 2001 From: Ngô Ngọc Đức Huy Date: Mon, 31 Jul 2023 15:32:53 +0700 Subject: Set chapterName variable to unclutter navigation --- layouts/partials/head.html | 18 +++++++++++++++++- layouts/partials/toc.html | 6 +++++- 2 files changed, 22 insertions(+), 2 deletions(-) (limited to 'layouts/partials') 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 }} + -{{ if and (.Title) (not .IsHome) }}{{ .Title }} - {{ end }}{{ .Site.Title }} + + {{ if and (.Title) (not .IsHome) }} + {{ $fullTitle }} - + {{ end }} + {{ .Site.Title }} + 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 @@
    {{ range sort $chapters "Weight" }}
  1. - {{ trim .Title " " }} + {{ $fullTitle := .Title }} + {{ with .Params.chapterName }} + {{ $fullTitle = printf "%s – %s" $fullTitle . }} + {{ end }} + {{ trim $fullTitle " " }} {{ partial "post-info.html" . }} {{ if .IsSection}} {{ partial "toc.html" . }} -- cgit 1.4.1