Files
tsuki/layouts/_partials/comments.html
T
tiennm99 c96cea81c6 feat: Pagefind search and Giscus comments (Phase 7)
- search/list.html: Pagefind UI container + module init with full vi
  i18n strings; loads /pagefind/pagefind-ui.{css,js} from generated dir
- search-button.html in header, gated by params.search.enable
- comments.html for Giscus, opt-in via params.comments.giscus.enable;
  reads repo/repoId/category/categoryId/mapping/theme/lang from params
- giscus-theme.js: MutationObserver on data-theme, postMessage iframe
  on toggle so Giscus theme stays in sync with site
- search.css: header-actions row, search button, Pagefind UI tokens
  mapped to tsuki design tokens
- comments.css: min-block-size on iframe to prevent layout shift
- exampleSite/hugo.yaml: commented giscus params block as docs
- i18n/vi.yml: Pagefind UI strings (clear, loadMore, zeroResults...)

Both features no-op when disabled. CSS bundle 3.5 KB gz (budget 15).
2026-05-07 22:03:32 +07:00

25 lines
1020 B
HTML

{{- $g := site.Params.comments.giscus -}}
{{- if and $g $g.enable -}}
{{- if ne .Params.comments false -}}
<section class="comments" aria-labelledby="comments-heading">
<h2 id="comments-heading" class="comments-heading">{{ i18n "comments" | default "Bình luận" }}</h2>
<div class="giscus" data-giscus></div>
<script src="https://giscus.app/client.js"
data-repo="{{ $g.repo }}"
data-repo-id="{{ $g.repoId }}"
data-category="{{ $g.category | default "Announcements" }}"
data-category-id="{{ $g.categoryId }}"
data-mapping="{{ $g.mapping | default "pathname" }}"
data-strict="{{ $g.strict | default "0" }}"
data-reactions-enabled="{{ $g.reactionsEnabled | default "1" }}"
data-emit-metadata="0"
data-input-position="{{ $g.inputPosition | default "bottom" }}"
data-theme="{{ $g.theme | default "preferred_color_scheme" }}"
data-lang="{{ $g.lang | default "vi" }}"
data-loading="lazy"
crossorigin="anonymous"
async></script>
</section>
{{- end -}}
{{- end -}}