summaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
Diffstat (limited to 'layouts')
-rw-r--r--layouts/partials/footer.html13
-rw-r--r--layouts/partials/head.html8
2 files changed, 12 insertions, 9 deletions
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index e00d242..4e348be 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -34,7 +34,9 @@
}
const disableSmoothScroll = '{{- if (.Param "DisableSmoothScroll") -}}1{{- end -}}' == '1';
- if (window.matchMedia('(prefers-reduced-motion: reduce)').matches || disableSmoothScroll) {
+ const enableInstantClick = '{{- if (.Param "EnableInstantClick") -}}1{{- end -}}' == '1';
+ // instant click and smooth scroll are mutually exclusive
+ if (window.matchMedia('(prefers-reduced-motion: reduce)').matches || disableSmoothScroll || enableInstantClick) {
return;
}
// only run this code if smooth scroll should be enabled
@@ -191,3 +193,12 @@ window.addEventListener('DOMContentLoaded', function (event) {
}, false);
</script>
{{- end }}
+
+{{- /* InstantClick.js */}}
+{{- if (.Param "EnableInstantClick") }}
+{{- $instantclick := slice (resources.Get "js/instantclick.js") | resources.Concat "assets/js/instantclick.js" | minify }}
+<script src="{{ $instantclick.RelPermalink }}" data-no-instant
+ {{- if site.Params.assets.disableFingerprinting }}integrity="{{ $instantclick.Data.Integrity }}"{{- end }}
+></script>
+<script data-no-instant>InstantClick.init();</script>
+{{- end }}
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index ecce55c..b921452 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -151,11 +151,3 @@
{{- template "partials/templates/twitter_cards.html" . }}
{{- template "partials/templates/schema_json.html" . }}
{{- end -}}
-
-{{- /* InstantPage.js */}}
-{{- if (.Param "EnableInstantPage") }}
-{{- $instantpage := slice (resources.Get "js/instantpage.js") | resources.Concat "assets/js/instantpage.js" | minify }}
-<script defer crossorigin="anonymous" src="{{ $instantpage.RelPermalink }}" type="module"
- {{- if site.Params.assets.disableFingerprinting }}integrity="{{ $instantpage.Data.Integrity }}"{{- end }}
-></script>
-{{- end }}