mirror of
https://github.com/dillonzq/LoveIt.git
synced 2024-11-13 02:16:19 +01:00
90184ca3e7
* feat(search): add local search * docs: add docs for search
15 lines
847 B
JSON
15 lines
847 B
JSON
{{- $index := slice -}}
|
|
{{- range where .Site.RegularPages ".Params.hiddenfromsearch" "!=" true -}}
|
|
{{- $one := dict "uri" .RelPermalink "title" .Title "description" (.Description | default "") -}}
|
|
{{- $tags := .Params.tags | default slice -}}
|
|
{{- $one = delimit $tags "\n" | dict "tags" | merge $one -}}
|
|
{{- $publish_date := .PublishDate.Format (.Site.Params.dateFormatToUse | default "2006-01-02") -}}
|
|
{{- $one = dict "date" $publish_date | merge $one -}}
|
|
{{- $content := partial "function/content.html" .Content | plainify -}}
|
|
{{- if gt .Site.Params.search.contentLength 0 -}}
|
|
{{- $content = substr $content 0 .Site.Params.search.contentLength -}}
|
|
{{- end -}}
|
|
{{- $one = dict "content" $content | merge $one -}}
|
|
{{- $index = $index | append $one -}}
|
|
{{- end -}}
|
|
{{- $index | jsonify | safeJS -}}
|