Files
tiennm99 d1828c9590 feat: v0.3.0 — Tier A parity, per-kind CSS, llm.txt, a11y baseline
Headline outcomes:
- Feature parity with Stack/PaperMod on Tier A polish: breadcrumbs
  (+BreadcrumbList JSON-LD), prev/next post navigation (rel=prev/next),
  language switcher UI (gated on hugo.IsMultilingual), code-copy button
  polish, <details> styling.
- Per-page-kind CSS bundles: core loads everywhere; home/single/archive/
  search bundles load only where needed. Frees ~1 KB gz from non-post
  pages. code-copy.js gated to post pages.
- Lighthouse-relevant network polish: Pagefind UI CSS preload-swap,
  conditional preconnect to giscus.app on comment-enabled posts,
  hreflang alternates on multilingual sites, <meta name=theme-color>
  light/dark variants, aria-pressed SSR-rendered on theme-toggle.
- WCAG AA contrast: --tsuki-fg-subtle darkened to #6b6b6b (light); was
  3.54:1 on bg, now 5:1. Pagination disabled uses --tsuki-fg-muted
  without opacity compound. Header tap targets bumped to 40×40; pagination
  to 44×44.
- i18n: full i18n/en.yml mirror (~50 keys); render-heading aria-label
  i18n-driven via linkToSection key; new keys for breadcrumb*, prevPost,
  nextPost, copyCode, copiedCode.
- Discovery: /llm.txt output format (llmstxt.org) on home; Speculation
  Rules opt-in via params.prefetch.enable.
- <html lang> fallback: site.Language.LanguageCode → Lang → "en"
  (was hard-coded "vi").

Per-kind bundle gz sizes on demo: home 3673 / post 4167 / list 2897 /
archives 3363 / search 3179 B (all under 4200 B cap).

Plan: plans/260510-0144-tsuki-v0.3.0/
2026-05-15 18:55:47 +07:00

35 lines
1.6 KiB
HTML

{{- /*
Breadcrumbs trail + BreadcrumbList schema.org JSON-LD.
Gated by params.breadcrumbs.enable (default off for backwards compat).
Skipped on home; renders Home → Section → Page for posts, Home → Section for section listings.
*/ -}}
{{- if site.Params.breadcrumbs.enable -}}
{{- if not .IsHome -}}
{{- $home := site.Home -}}
{{- $section := .CurrentSection -}}
{{- $isSection := and $section (ne $section.RelPermalink $home.RelPermalink) (ne $section.RelPermalink .RelPermalink) -}}
{{- $isLeaf := and (eq .Kind "page") $isSection -}}
{{- $homeName := i18n "breadcrumbHome" | default "Home" -}}
<nav class="breadcrumbs" aria-label="{{ i18n "breadcrumb" | default "Breadcrumb" }}">
<ol>
<li><a href="{{ $home.Permalink }}">{{ $homeName }}</a></li>
{{- if $isSection }}
<li><a href="{{ $section.Permalink }}">{{ $section.LinkTitle | default $section.Title }}</a></li>
{{- end }}
{{- if $isLeaf }}
<li aria-current="page">{{ .LinkTitle | default .Title }}</li>
{{- end }}
</ol>
</nav>
{{- $items := slice (dict "@type" "ListItem" "position" 1 "name" $homeName "item" $home.Permalink) -}}
{{- if $isSection -}}
{{- $items = $items | append (dict "@type" "ListItem" "position" 2 "name" ($section.LinkTitle | default $section.Title) "item" $section.Permalink) -}}
{{- end -}}
{{- if $isLeaf -}}
{{- $items = $items | append (dict "@type" "ListItem" "position" 3 "name" (.LinkTitle | default .Title) "item" .Permalink) -}}
{{- end -}}
{{- $bc := dict "@context" "https://schema.org" "@type" "BreadcrumbList" "itemListElement" $items -}}
<script type="application/ld+json">{{ $bc | jsonify | safeJS }}</script>
{{- end -}}
{{- end -}}