Files
Cell 5322a15ceb docs(layouts): add header comments to undocumented partials
Add `{{/* ... */}}` header comments to 25 partials that had no documentation,
enabling `pnpm gen:docs` to generate their reference docs. Also fix
base/head/index.html leading blank line that prevented parser matching.

Groups covered: base/, feed/, function/, home/, init/, plugin/, single/, store/, (root).
2026-07-23 12:56:40 +08:00

47 lines
2.0 KiB
HTML

{{- /*
Render breadcrumb navigation for the current page.
Displays a hierarchical path from the site root to the current page.
Supports configurable separator, sticky mode, home visibility, and title capitalization.
Called from: layouts/baseof.html.
*/ -}}
{{- 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 -}}
{{- if .IsHome | and (not .Site.Params.breadcrumb.show_home) -}}
{{- continue -}}
{{- end -}}
{{- $title := "" -}}
{{- $capitalizeTitles := .Param "capitalize_titles" -}}
{{- with .Description -}}
{{- $title = . -}}
{{- else -}}
{{- $title = cond $capitalizeTitles (title .LinkTitle) .LinkTitle -}}
{{- if .IsPage | and .Summary -}}
{{- $title = .Summary | plainify -}}
{{- end -}}
{{- end -}}
{{- $innerText := "" -}}
{{- if .IsHome -}}
{{- $innerText = T "single.home" -}}
{{- else -}}
{{- $innerText = .Page.Params.shortTitle | default (lower .LinkTitle | T) | default .LinkTitle -}}
{{- $innerText = cond (.Site.Params.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 := .Page.Params.shortTitle | default (lower .LinkTitle | T) | default .LinkTitle -}}
{{- $currentText = cond (.Site.Params.breadcrumb.capitalize | and (.Param "capitalize_titles")) (title $currentText) $currentText -}}
<li class="breadcrumb-item active" data-separator="{{ $separator }}" aria-current="page">{{ $currentText }}</li>
</ol>
</nav>
{{- end -}}