mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
✨ Feat: add separator and capitalize options for breadcrumb config
This commit is contained in:
@@ -30,8 +30,8 @@
|
||||
.breadcrumb-item {
|
||||
display: flex;
|
||||
|
||||
+.breadcrumb-item::before {
|
||||
content: "/";
|
||||
+ .breadcrumb-item::before {
|
||||
content: attr(data-separator);
|
||||
display: inline-block;
|
||||
padding-inline: 0.5rem;
|
||||
color: $global-font-secondary-color;
|
||||
|
||||
@@ -439,6 +439,9 @@ enableEmoji = true
|
||||
enable = false
|
||||
sticky = false
|
||||
showHome = false
|
||||
# FixIt 0.3.13 | NEW
|
||||
separator = "/"
|
||||
capitalize = false
|
||||
|
||||
# FixIt 0.3.10 | NEW Post navigation config
|
||||
[params.navigation]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{{- if (gt (len .Ancestors.Reverse) 1) | and (eq .Site.Params.breadcrumb.enable true) -}}
|
||||
{{- $separator := .Site.Params.breadcrumb.separator | default "/" -}}
|
||||
<nav aria-label="breadcrumb" class="breadcrumb-container{{ if .Site.Params.breadcrumb.sticky }} sticky{{ end }}">
|
||||
<ol class="breadcrumb">
|
||||
{{- range .Ancestors.Reverse -}}
|
||||
@@ -20,13 +21,16 @@
|
||||
{{- if .IsHome -}}
|
||||
{{- $innerText = T "single.home" -}}
|
||||
{{- else -}}
|
||||
{{- $innerText = ((T (add .TranslationKey ".breadcrumbTitle")) | default (lower .LinkTitle | T) | default .LinkTitle) | title -}}
|
||||
{{- $innerText = (T (add .TranslationKey ".breadcrumbTitle")) | default (lower .LinkTitle | T) | default .LinkTitle -}}
|
||||
{{- $innerText = cond (.Param "breadcrumb.capitalize") (title $innerText) $innerText -}}
|
||||
{{- end -}}
|
||||
|
||||
<li class="breadcrumb-item"><a href="{{ .RelPermalink }}" title="{{ $title }}">{{ $innerText }}</a></li>
|
||||
<li class="breadcrumb-item" data-separator="{{ $separator }}"><a href="{{ .RelPermalink }}" title="{{ $title }}">{{ $innerText }}</a></li>
|
||||
{{- end -}}
|
||||
|
||||
<li class="breadcrumb-item active" aria-current="page">{{ (T (add .TranslationKey ".breadcrumbTitle")) | default (lower .LinkTitle | T) | default .LinkTitle | title }}</li>
|
||||
{{- $currentText := (T (add .TranslationKey ".breadcrumbTitle")) | default (lower .LinkTitle | T) | default .LinkTitle -}}
|
||||
{{- $currentText = cond (.Param "breadcrumb.capitalize") (title $currentText) $currentText -}}
|
||||
<li class="breadcrumb-item active" data-separator="{{ $separator }}" aria-current="page">{{ $currentText }}</li>
|
||||
</ol>
|
||||
</nav>
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{{- .Scratch.Set "version" "v0.3.12" -}}
|
||||
{{- .Scratch.Set "version" "v0.3.13-b029036c" -}}
|
||||
{{- .Scratch.Set "this" dict -}}
|
||||
|
||||
{{- partial "init/detection-env.html" . -}}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
{{- $src = printf "%v/%v.svg" $prefix . -}}
|
||||
{{- end -}}
|
||||
|
||||
{{ if not $src }}
|
||||
{{- if not $src -}}
|
||||
{{- errorf "Icon src is missing" -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
{{- end -}}
|
||||
{{- if
|
||||
(.ExternalIcon | default false)
|
||||
| and $external | and (eq (hasPrefix .Content `<img` ) false)
|
||||
| and $external | and (eq (hasPrefix .Content `<img`) false)
|
||||
| and (eq ((strings.HasSuffix .Content `</i>`) | or (strings.HasSuffix .Content `):`)) false)
|
||||
-}}
|
||||
{{- if .Download -}}
|
||||
|
||||
@@ -18,13 +18,14 @@
|
||||
<div class="details-content collection-content">
|
||||
<nav>
|
||||
<ul class="collection-list">
|
||||
{{- range $key, $value := $pages -}}
|
||||
{{- $title := title $value.LinkTitle -}}
|
||||
{{- if $value.LinkTitle | eq $.LinkTitle -}}
|
||||
{{- range $key, $page := $pages -}}
|
||||
{{- /* whether to capitalize the title, consistent with breadcrumb */ -}}
|
||||
{{- $title := cond ($page.Param "breadcrumb.capitalize") (title $page.LinkTitle) $page.LinkTitle -}}
|
||||
{{- if $page.LinkTitle | eq $.LinkTitle -}}
|
||||
{{- $currentKey = $key -}}
|
||||
<li class="collection-item"><span class="active" title="{{ $title }}">{{ $title }}</span></li>
|
||||
{{- else }}
|
||||
<li class="collection-item"><a href="{{ $value.RelPermalink }}" title="{{ $title }}">{{ $title }}</a></li>
|
||||
<li class="collection-item"><a href="{{ $page.RelPermalink }}" title="{{ $title }}">{{ $title }}</a></li>
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
</ul>
|
||||
|
||||
Reference in New Issue
Block a user