diff --git a/assets/json/offline-search-index.json b/assets/json/offline-search-index.json new file mode 100644 index 000000000..1ee051c64 --- /dev/null +++ b/assets/json/offline-search-index.json @@ -0,0 +1,18 @@ +{{- $.Scratch.Add "offline-search-index" slice -}} +{{- range where site.AllPages ".Params.exclude_search" "!=" true -}} +{{- /* We have to apply `htmlUnescape` again after `truncate` because `truncate` applies `html.EscapeString` if the argument is not HTML. */ -}} +{{- /* 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). */ -}} +{{- $.Scratch.Add + "offline-search-index" + (dict + "ref" .RelPermalink + "title" .Title + "categories" (.Params.categories | default "") + "tags" (.Params.tags | default "") + "description" (.Description | default "") + "body" (.Plain | htmlUnescape) + "excerpt" ((.Description | default .Plain) | htmlUnescape | truncate (.Site.Params.offlineSearchSummaryLength | default 70) | htmlUnescape) + ) +-}} +{{- end -}} +{{- $.Scratch.Get "offline-search-index" | jsonify -}} diff --git a/layouts/_default/sitemap.xml b/layouts/_default/sitemap.xml index 8dd70da7a..831681511 100644 --- a/layouts/_default/sitemap.xml +++ b/layouts/_default/sitemap.xml @@ -1,7 +1,7 @@ {{ printf "" | safeHTML }} - {{ range .Site.AllPages }} + {{ range site.AllPages }} {{- if and (not .Params.sitemap_exclude) (not .Draft) }} {{ .Permalink }} diff --git a/layouts/partials/feature-info.html b/layouts/partials/feature-info.html index 97be0ec00..c37848641 100644 --- a/layouts/partials/feature-info.html +++ b/layouts/partials/feature-info.html @@ -1,5 +1,5 @@ {{ $currentPage := .Page.Permalink }} -{{ $features := .Site.Data.feature_data }} +{{ $features :=hugo.Data.feature_data }} {{ if not $features }} {{ with readFile "data/feature_data.json" }} {{ $features = . | transform.Unmarshal }} diff --git a/layouts/partials/recent-discussions.html b/layouts/partials/recent-discussions.html index 3289f8f2a..479dfe087 100644 --- a/layouts/partials/recent-discussions.html +++ b/layouts/partials/recent-discussions.html @@ -1,7 +1,7 @@ {{ if eq .Section "kanvas" }}

Recent Discussions on Kanvas