head, footer: add option to disable fingerprinting #89

in site config =>
    params:
      assets:
        disableFingerprinting: true
This commit is contained in:
Aditya Telange 2020-12-01 18:52:06 +05:30
parent 7a0e742def
commit a9ff9533a0
No known key found for this signature in database
GPG Key ID: 82E844EF3DA99E77
2 changed files with 10 additions and 0 deletions

View File

@ -17,9 +17,14 @@
</a> </a>
{{- partial "extend_footer.html" . -}} {{- partial "extend_footer.html" . -}}
{{ if in site.Params.mainSections .Type }} {{ if in site.Params.mainSections .Type }}
{{- if not .Site.Params.assets.disableFingerprinting }}
{{- $highlight := slice (resources.Get "js/highlight.min.js") | resources.Concat "assets/js/highlight.js" | minify | fingerprint }} {{- $highlight := slice (resources.Get "js/highlight.min.js") | resources.Concat "assets/js/highlight.js" | minify | fingerprint }}
<script defer src="{{ $highlight.Permalink }}" integrity="{{ $highlight.Data.Integrity }}" <script defer src="{{ $highlight.Permalink }}" integrity="{{ $highlight.Data.Integrity }}"
onload="hljs.initHighlightingOnLoad();"></script> onload="hljs.initHighlightingOnLoad();"></script>
{{- else}}
{{- $highlight := slice (resources.Get "js/highlight.min.js") | resources.Concat "assets/js/highlight.js" | minify }}
<script defer src="{{ $highlight.Permalink }}" onload="hljs.initHighlightingOnLoad();"></script>
{{- end}}
{{- end }} {{- end }}
<script> <script>
window.onload = function () { window.onload = function () {

View File

@ -21,9 +21,14 @@
<meta name="google-site-verification" content="{{ .Site.Params.analytics.google.SiteVerificationTag }}" /> <meta name="google-site-verification" content="{{ .Site.Params.analytics.google.SiteVerificationTag }}" />
{{- end}} {{- end}}
<!-- Styles --> <!-- Styles -->
{{- if not .Site.Params.assets.disableFingerprinting }}
{{- $stylesheet := (resources.Match "css/*.css") | resources.Concat "assets/css/stylesheet.css" | minify | fingerprint -}} {{- $stylesheet := (resources.Match "css/*.css") | resources.Concat "assets/css/stylesheet.css" | minify | fingerprint -}}
<link href="{{ $stylesheet.Permalink }}" integrity="{{ $stylesheet.Data.Integrity }}" rel="preload stylesheet" <link href="{{ $stylesheet.Permalink }}" integrity="{{ $stylesheet.Data.Integrity }}" rel="preload stylesheet"
as="style"> as="style">
{{- else}}
{{- $stylesheet := (resources.Match "css/*.css") | resources.Concat "assets/css/stylesheet.css" | minify -}}
<link href="{{ $stylesheet.Permalink }}" rel="preload stylesheet" as="style">
{{- end}}
<!-- Favicons --> <!-- Favicons -->
<link rel="icon" href="{{- .Site.Params.assets.favicon | default "favicon.ico" | absURL -}}"> <link rel="icon" href="{{- .Site.Params.assets.favicon | default "favicon.ico" | absURL -}}">
<link rel="icon" type="image/png" sizes="16x16" href=" <link rel="icon" type="image/png" sizes="16x16" href="