From e252e761f54f1f871630cdcc5416e90de1ec89d6 Mon Sep 17 00:00:00 2001 From: Aditya Telange <21258296+adityatelange@users.noreply.github.com> Date: Tue, 29 Dec 2020 16:03:49 +0530 Subject: [PATCH] footer: allow disabling HLJS #143 usage => in site config => params: assets: disableHLJS: true per-page in front-matter => disableHLJS: true --- layouts/_default/baseof.html | 2 +- layouts/partials/footer.html | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 11fb678..8f17b93 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -18,7 +18,7 @@ {{- block "main" . }} {{- end }} - {{- partialCached "footer.html" . .Type .Layout }} + {{- partialCached "footer.html" . .Type .Layout .Params }} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index c384c4e..b34d278 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -18,7 +18,8 @@ {{- partial "extend_footer.html" . -}} -{{ if (and (in site.Params.mainSections .Type) (ne .Layout `archives`) (ne .Layout `search`)) }} +{{- $isHLJSdisabled := (.Site.Params.assets.disableHLJS | default .Params.disableHLJS ) }} +{{- if (and (in site.Params.mainSections .Type) (ne .Layout `archives`) (ne .Layout `search`) (not $isHLJSdisabled)) }} {{- if not .Site.Params.assets.disableFingerprinting }} {{- $highlight := slice (resources.Get "js/highlight.min.js") | resources.Concat "assets/js/highlight.js" | minify | fingerprint }}