Skip to content

Commit 48f7ad3

Browse files
fix: depcrecated warning
Signed-off-by: saurabhraghuvanshii <saurabhsraghuvanshi@gmail.com>
1 parent f40ba44 commit 48f7ad3

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{{- $.Scratch.Add "offline-search-index" slice -}}
2+
{{- range hugo.Sites -}}
3+
{{- range where .Pages ".Params.exclude_search" "!=" true -}}
4+
{{- /* We have to apply `htmlUnescape` again after `truncate` because `truncate` applies `html.EscapeString` if the argument is not HTML. */ -}}
5+
{{- /* Individual taxonomies can be added in the next line by add '"taxonomy-name" (.Params.taxonomy-name | default "")' to the dict (as seen for categories and tags). */ -}}
6+
{{- $.Scratch.Add
7+
"offline-search-index"
8+
(dict
9+
"ref" .RelPermalink
10+
"title" .Title
11+
"categories" (.Params.categories | default "")
12+
"tags" (.Params.tags | default "")
13+
"description" (.Description | default "")
14+
"body" (.Plain | htmlUnescape)
15+
"excerpt" ((.Description | default .Plain) | htmlUnescape | truncate (.Site.Params.offlineSearchSummaryLength | default 70) | htmlUnescape)
16+
)
17+
-}}
18+
{{- end -}}
19+
{{- end -}}
20+
{{- $.Scratch.Get "offline-search-index" | jsonify -}}

0 commit comments

Comments
 (0)