Skip to content

Commit

Permalink
Improved search index
Browse files Browse the repository at this point in the history
Signed-off-by: Travis Beckham <[email protected]>
  • Loading branch information
travisbeckham committed Jun 4, 2024
1 parent 79c210b commit ec561a3
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions linkerd.io/layouts/index.searchindex.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
{{- $pages := where site.Pages "Section" "eq" "2.15" -}}
[
{{- range $index, $page := $pages -}}
{{- if gt $index 0 -}} , {{- end -}}
{{- $ancestors := slice "linkerd.io" -}}
{{- range .Ancestors.Reverse -}}
{{- if .IsHome }}{{ continue }}{{ end -}}
{{- $ancestors = $ancestors | append .Title -}}
{{- end -}}
{{- $entry := dict "uri" $page.Permalink -}}
{{- $entry = merge $entry (dict "title" $page.Title) -}}
{{- $entry = merge $entry (dict "ancestors" $ancestors) -}}
{{- $entry = merge $entry (dict "content" ($page.Plain | htmlUnescape | truncate 3000)) -}}
{{- $entry = merge $entry (dict "description" $page.Description) -}}
{{- $entry = merge $entry (dict "keywords" $page.Keywords) -}}
{{- $entry | jsonify -}}
{{- $.Scratch.Add "search-index" slice -}}
{{- range $index, $page := $pages -}}
{{- $ancestors := slice "linkerd.io" -}}
{{- range .Ancestors.Reverse -}}
{{- if .IsHome }}{{ continue }}{{ end -}}
{{- $ancestors = $ancestors | append .Title -}}
{{- end -}}
]
{{- $.Scratch.Add
"search-index"
(dict
"uri" $page.Permalink
"title" $page.Title
"ancestors" $ancestors
"content" ($page.Plain | htmlUnescape | truncate 3000)
"description" $page.Description
"keywords" $page.Keywords
)
-}}
{{- end -}}
{{- $.Scratch.Get "search-index" | jsonify -}}

0 comments on commit ec561a3

Please sign in to comment.