mirror of
https://github.com/tiennm99/tsuki.git
synced 2026-08-02 14:22:46 +00:00
- Extract duplicated TOC predicate to _partials/toc-enabled.html (single.html + footer.html were both computing the same 6-line gate). - Inline _partials/head/og-image.html into head/seo.html — single caller, the fallback chain is the contract; the partial wasn't earning its override surface. - Drop 6 unused i18n keys: postedOn, tags, categories, archive, noResults, copyright. None referenced by any template (verified via grep). Also removed an accidental duplicate of the callout title block; vi.yml reorganized into thematic groups. Behavior unchanged. Smoke (11 checks) + Hugo build clean. CSS bundle unchanged at 3962 B gz.
14 lines
632 B
HTML
14 lines
632 B
HTML
{{- /*
|
|
Single source of truth for whether to render the TOC for the current page.
|
|
Returns the literal string "true" when enabled, empty otherwise.
|
|
Callers: `single.html` (TOC partial), `footer.html` (toc-active.js loader).
|
|
Site config: `params.toc.enable` (default true), `params.toc.minWordCount` (default 400).
|
|
Per-page override: frontmatter `toc: false` always wins.
|
|
*/ -}}
|
|
{{- $cfg := site.Params.toc | default dict -}}
|
|
{{- $enabled := $cfg.enable | default true -}}
|
|
{{- $min := $cfg.minWordCount | default 400 -}}
|
|
{{- if and $enabled (eq .Kind "page") (gt .WordCount $min) (ne .Params.toc false) -}}
|
|
true
|
|
{{- end -}}
|