mirror of
https://github.com/balkian/balkian.github.com.git
synced 2025-04-15 17:29:05 +00:00
add tags to searchable content
This commit is contained in:
parent
999c2c1287
commit
3e3cb40067
26
layouts/page/search.json
Normal file
26
layouts/page/search.json
Normal file
@ -0,0 +1,26 @@
|
||||
{{- $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections -}}
|
||||
{{- $notHidden := where .Site.RegularPages "Params.hidden" "!=" true -}}
|
||||
{{- $filtered := ($pages | intersect $notHidden) -}}
|
||||
|
||||
{{- $result := slice -}}
|
||||
|
||||
{{- range $filtered -}}
|
||||
{{- $data := dict "title" .Title "date" .Date "permalink" .Permalink "content" (print .Plain "Tags: " (.Params.tags)) -}}
|
||||
|
||||
{{- $image := partialCached "helper/image" (dict "Context" . "Type" "articleList") .RelPermalink "articleList" -}}
|
||||
{{- if $image.exists -}}
|
||||
{{- $imagePermalink := "" -}}
|
||||
{{- if and $image.resource (default true .Page.Site.Params.imageProcessing.cover.enabled) -}}
|
||||
{{- $thumbnail := $image.resource.Fill "120x120" -}}
|
||||
{{- $imagePermalink = (absURL $thumbnail.Permalink) -}}
|
||||
{{- else -}}
|
||||
{{- $imagePermalink = $image.permalink -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $data = merge $data (dict "image" (absURL $imagePermalink)) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $result = $result | append $data -}}
|
||||
{{- end -}}
|
||||
|
||||
{{ jsonify $result }}
|
Loading…
x
Reference in New Issue
Block a user