highlightjs : include only on pages with mainSections

* this makes hljs not load on index, taxonomies, archive
pages where code highlighting isn't used
* improving page site load time
This commit is contained in:
Aditya Telange 2020-09-17 11:56:28 +05:30
parent 4ded4a5052
commit ebb9eb4043
No known key found for this signature in database
GPG Key ID: 82E844EF3DA99E77

View File

@ -12,9 +12,10 @@
<path d="M12 6H0l6-6z" /></svg>
</button>
</a>
{{if in site.Params.mainSections .Type }}
{{ $highlight := resources.Get "js/highlight.min.js" | minify | fingerprint}}
<script src="{{ $highlight.Permalink }}" integrity="{{ $highlight.Data.Integrity }}"></script>
{{end }}
<script>
window.onload = function () {
if (localStorage.getItem("menu-scroll-position")) {