From fe351c7e38d6ee5366dcda0765f966db6a89593e Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Tue, 5 Aug 2025 12:14:23 +0800 Subject: [PATCH] :sparkles: Feat: add `shortTitle` front matter param for breadcrumb and collection navigation titles to use --- layouts/_partials/breadcrumb.html | 4 ++-- layouts/_partials/init/index.html | 2 +- layouts/_partials/single/collection-list.html | 3 ++- layouts/_partials/single/collection-nav.html | 12 ++++++++---- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/layouts/_partials/breadcrumb.html b/layouts/_partials/breadcrumb.html index eab78a39..67cfda95 100644 --- a/layouts/_partials/breadcrumb.html +++ b/layouts/_partials/breadcrumb.html @@ -22,14 +22,14 @@ {{- if .IsHome -}} {{- $innerText = T "single.home" -}} {{- else -}} - {{- $innerText = (T (add .TranslationKey ".breadcrumbTitle")) | default (lower .LinkTitle | T) | default .LinkTitle -}} + {{- $innerText = .Page.Params.shortTitle | default (lower .LinkTitle | T) | default .LinkTitle -}} {{- $innerText = cond ((.Param "breadcrumb.capitalize") | and $capitalizeTitles) (title $innerText) $innerText -}} {{- end -}} {{- end -}} - {{- $currentText := (T (add .TranslationKey ".breadcrumbTitle")) | default (lower .LinkTitle | T) | default .LinkTitle -}} + {{- $currentText := .Page.Params.shortTitle | default (lower .LinkTitle | T) | default .LinkTitle -}} {{- $currentText = cond ((.Param "breadcrumb.capitalize") | and (.Param "capitalizeTitles")) (title $currentText) $currentText -}} diff --git a/layouts/_partials/init/index.html b/layouts/_partials/init/index.html index 19df5765..cb0af318 100644 --- a/layouts/_partials/init/index.html +++ b/layouts/_partials/init/index.html @@ -1,4 +1,4 @@ -{{- hugo.Store.Set "version" "v0.4.0-alpha-20250721024521-a1cd700b" -}} +{{- hugo.Store.Set "version" "v0.4.0-alpha-20250805041424-57ccd470" -}} {{- .Store.Set "this" dict -}} {{- partial "init/detection-env.html" . -}} diff --git a/layouts/_partials/single/collection-list.html b/layouts/_partials/single/collection-list.html index eb958f30..b2a8b471 100644 --- a/layouts/_partials/single/collection-list.html +++ b/layouts/_partials/single/collection-list.html @@ -20,7 +20,8 @@