Skip to content

Commit

Permalink
defer loading of lunr search scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
jbowdre committed Jan 4, 2025
1 parent 8d6365f commit d5d6aaa
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions layouts/partials/search-index.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<script>
window.store = {
{{ range where .Site.Pages "Section" "posts" }}
"{{ .Permalink }}": {
"title": "{{ .Title }}",
"tags": [{{ range .Params.Tags }}"{{ . }}",{{ end }}],
"content": {{ .Content | plainify }},
"description": {{ .Description | plainify }},
"url": "{{ .Permalink }}"
{{range where.Site.Pages "Section" "posts"} }
"{{ .Permalink }}": {
"title": "{{ .Title }}",
"tags": [{{range .Params.Tags}} "{{ . }}", {{end}}],
"content": {{ .Content | plainify} },
"description": {{ .Description | plainify} },
"url": "{{ .Permalink }}"
},
{{ end }}
{{end} }
}
</script>
{{ $jsLunr := resources.Get "js/lunr.js" | minify }}
<script src="{{ $jsLunr.RelPermalink }}" async></script>
<script src="{{ $jsLunr.RelPermalink }}" defer></script>
{{ $jsSearch := resources.Get "js/search.js" | minify }}
<script src="{{ $jsSearch.RelPermalink }}" async></script>
<script src="{{ $jsSearch.RelPermalink }}" defer></script>

0 comments on commit d5d6aaa

Please sign in to comment.