feat(search): add pagefind search engine support (#738)

* feat(search): add native pagefind support

* chore: code review and change

---------

Co-authored-by: Cell <1024@lruihao.cn>
This commit is contained in:
0x5c0f
2026-05-19 16:19:39 +08:00
committed by GitHub
parent 78778dad08
commit 4ffd531d63
12 changed files with 218 additions and 7 deletions
@@ -0,0 +1,11 @@
{{- if and .Site.Params.search.enable (eq .Site.Params.search.type "pagefind") .IsPage -}}
{{- $params := partial "function/params.html" -}}
{{- $hidden := cond (eq $params.hiddenFromSearch true) "true" "false" -}}
{{- $encrypted := cond (and (isset $params "password") (ne (printf "%v" $params.password) "")) "true" "false" -}}
{{- $pageDate := (.PublishDate | default .Date) -}}
{{- $dateLabel := $pageDate | dateFormat (.Site.Params.dateFormat | default "2006-01-02") -}}
<meta data-pagefind-filter="hidden:{{ $hidden }}">
<meta data-pagefind-filter="encrypted:{{ $encrypted }}">
<meta data-pagefind-meta="date:{{ $dateLabel }}">
<meta data-pagefind-sort="date:{{ $pageDate.Unix }}">
{{- end -}}