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/_default/baseof.html | 5 +---- layouts/_default/list.html | 1 + layouts/_default/single.html | 7 ++++++- layouts/partials/head.html | 18 +++++++++++++++++- layouts/partials/toc.html | 6 +++++- 5 files changed, 30 insertions(+), 7 deletions(-) (limited to 'layouts') diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index bd9f83d..f53932d 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -4,12 +4,9 @@ SPDX-FileCopyrightText: 2022 Ngô Ngọc Đức Huy SPDX-License-Identifier: MIT */}} + -{{ with .Page.Params.Lang }} - -{{ else }} -{{ end }} {{ block "head" . }} {{ partial "head.html" . }} diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 46310ad..9a4672e 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -9,6 +9,7 @@ SPDX-License-Identifier: MIT {{ .Content }} {{ if in .Params.categories "book" }} + {{ partial "post-navigation-top.html" . }}
{{ partial "toc.html" . }}
diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 79b493d..a170823 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -7,7 +7,12 @@ SPDX-License-Identifier: MIT {{ define "main" }}
-

{{ trim .Title " " }}

+

+ {{ trim .Title " " }} + {{ with .Params.chapterName }} + – {{ . }} + {{ end }} +

{{ i18n "word count" . }} ({{ i18n "reading time" .ReadingTime }}) 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