mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-25 07:48:54 +00:00
✨ Feat: add shortTitle front matter param for breadcrumb and collection navigation titles to use
This commit is contained in:
@@ -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 -}}
|
||||
|
||||
<li class="breadcrumb-item" data-separator="{{ $separator }}"><a href="{{ .RelPermalink }}" title="{{ $title }}">{{ $innerText }}</a></li>
|
||||
{{- 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 -}}
|
||||
<li class="breadcrumb-item active" data-separator="{{ $separator }}" aria-current="page">{{ $currentText }}</li>
|
||||
</ol>
|
||||
|
||||
@@ -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" . -}}
|
||||
|
||||
@@ -20,7 +20,8 @@
|
||||
<ul class="collection-list">
|
||||
{{- range $key, $page := $pages -}}
|
||||
{{- $capitalizeTitles := $page.Param "capitalizeTitles" -}}
|
||||
{{- $title := cond $capitalizeTitles (title $page.LinkTitle) $page.LinkTitle -}}
|
||||
{{- $title := $page.Params.shortTitle | default $page.LinkTitle -}}
|
||||
{{- $title = cond $capitalizeTitles (title $title) $title -}}
|
||||
<li class="collection-item">
|
||||
{{- if $.Eq $page -}}
|
||||
{{- $currentKey = $key -}}
|
||||
|
||||
@@ -19,15 +19,19 @@
|
||||
{{- $pages := (where .Pages "Params.Weight" "!=" nil) | append (where .Pages "Params.Weight" "eq" nil).ByDate -}}
|
||||
{{- with $pages.Next $ -}}
|
||||
{{- $capitalizeTitles := .Param "capitalizeTitles" -}}
|
||||
<a href="{{ .RelPermalink }}" class="collection-nav-item" rel="prev" title="{{ cond $capitalizeTitles (title .LinkTitle) .LinkTitle }}">
|
||||
{{- $title := .Params.shortTitle | default .LinkTitle -}}
|
||||
{{- $title = cond $capitalizeTitles (title $title) $title -}}
|
||||
<a href="{{ .RelPermalink }}" class="collection-nav-item" rel="prev" title="{{ $title }}">
|
||||
{{- dict "Class" "fa-solid fa-angle-left fa-fw" | partial "plugin/icon.html" -}}
|
||||
<span>{{- cond $capitalizeTitles (title .LinkTitle) .LinkTitle -}}</span>
|
||||
<span>{{ $title }}</span>
|
||||
</a>
|
||||
{{- end -}}
|
||||
{{- with $pages.Prev $ -}}
|
||||
{{- $capitalizeTitles := .Param "capitalizeTitles" -}}
|
||||
<a href="{{ .RelPermalink }}" class="collection-nav-item" rel="next" title="{{ cond $capitalizeTitles (title .LinkTitle) .LinkTitle }}">
|
||||
<span>{{- cond $capitalizeTitles (title .LinkTitle) .LinkTitle -}}</span>
|
||||
{{- $title := .Params.shortTitle | default .LinkTitle -}}
|
||||
{{- $title = cond $capitalizeTitles (title $title) $title -}}
|
||||
<a href="{{ .RelPermalink }}" class="collection-nav-item" rel="next" title="{{ $title }}">
|
||||
<span>{{ $title }}</span>
|
||||
{{- dict "Class" "fa-solid fa-angle-right fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
Reference in New Issue
Block a user