feat(search): improve search index

This commit is contained in:
Dillon
2020-04-28 12:53:06 +08:00
parent ea655d9871
commit 26381b498d
4 changed files with 7 additions and 8 deletions

View File

@@ -6,13 +6,12 @@
{{- $pages = where $pages "Params.hiddenfromsearch" "!=" true -}}
{{- end -}}
{{- range $pages -}}
{{- $params := .Params | merge $.Site.Params.page -}}
{{- $one := dict "uri" .RelPermalink "title" .Title "description" (.Description | default "") -}}
{{- $tags := $params.tags | default slice -}}
{{- $one := dict "objectID" .RelPermalink "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.dateFormat | default "2006-01-02") -}}
{{- $one = dict "date" $publish_date | merge $one -}}
{{- $content := dict "content" .Content "ruby" $params.ruby "fraction" $params.fraction "fontawesome" $params.fontawesome | partial "function/content.html" | plainify -}}
{{- $content := .RawContent -}}
{{- if gt .Site.Params.search.contentLength 0 -}}
{{- $content = substr $content 0 .Site.Params.search.contentLength -}}
{{- end -}}