Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions assets/json/offline-search-index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{- $.Scratch.Add "offline-search-index" slice -}}
{{- range hugo.Sites -}}
{{- range where .Pages ".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 adding '"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 -}}
{{- end -}}
{{- $.Scratch.Get "offline-search-index" | jsonify -}}
2 changes: 1 addition & 1 deletion hugo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ markup:
module:
hugoVersion:
extended: true
min: 0.146.0
min: 0.156.0
imports:

# used to source the base theme for academy.
Expand Down
22 changes: 22 additions & 0 deletions layouts/_default/sitemap.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
{{ range hugo.Sites }}
{{ range .Pages }}
{{- if and (not .Params.sitemap_exclude) (not .Draft) }}
<url>
<loc>{{ .Permalink }}</loc>
{{- if not .Lastmod.IsZero }}
<lastmod>{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</lastmod>
{{- end }}
{{- with .Sitemap.ChangeFreq }}
<changefreq>{{ . }}</changefreq>
{{- end }}
{{- if ge .Sitemap.Priority 0.0 }}
<priority>{{ .Sitemap.Priority }}</priority>
{{- end }}
</url>
{{- end }}
{{ end }}
{{ end }}
</urlset>
Loading