Skip to content

Commit 1c13657

Browse files
Merge pull request #932 from VIRAT-k82/fix-deprecated-data
[Docs] fix: replace deprecated Hugo site accessors
2 parents 2b2aaf3 + b9336c2 commit 1c13657

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{{- $.Scratch.Add "offline-search-index" slice -}}
2+
{{- range where site.AllPages ".Params.exclude_search" "!=" true -}}
3+
{{- /* We have to apply `htmlUnescape` again after `truncate` because `truncate` applies `html.EscapeString` if the argument is not HTML. */ -}}
4+
{{- /* 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). */ -}}
5+
{{- $.Scratch.Add
6+
"offline-search-index"
7+
(dict
8+
"ref" .RelPermalink
9+
"title" .Title
10+
"categories" (.Params.categories | default "")
11+
"tags" (.Params.tags | default "")
12+
"description" (.Description | default "")
13+
"body" (.Plain | htmlUnescape)
14+
"excerpt" ((.Description | default .Plain) | htmlUnescape | truncate (.Site.Params.offlineSearchSummaryLength | default 70) | htmlUnescape)
15+
)
16+
-}}
17+
{{- end -}}
18+
{{- $.Scratch.Get "offline-search-index" | jsonify -}}

layouts/_default/sitemap.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
22
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
33
xmlns:xhtml="http://www.w3.org/1999/xhtml">
4-
{{ range .Site.AllPages }}
4+
{{ range site.AllPages }}
55
{{- if and (not .Params.sitemap_exclude) (not .Draft) }}
66
<url>
77
<loc>{{ .Permalink }}</loc>

layouts/partials/feature-info.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{ $currentPage := .Page.Permalink }}
2-
{{ $features := .Site.Data.feature_data }}
2+
{{ $features :=hugo.Data.feature_data }}
33
{{ if not $features }}
44
{{ with readFile "data/feature_data.json" }}
55
{{ $features = . | transform.Unmarshal }}

layouts/partials/recent-discussions.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{{ if eq .Section "kanvas" }}
22
<h2>Recent Discussions on Kanvas</h2>
33
<ul>
4-
{{ with site.Data.kanvas_discuss }}
4+
{{ with hugo.Data.kanvas_discuss }}
55
{{ $users := .users }}
66
{{ $topics := sort .topic_list.topics "last_posted_at" "desc" }}
77

0 commit comments

Comments
 (0)