template
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
<!-- font family -->
|
||||
<script src="https://cdn.jsdelivr.net/gh/theprojectsomething/webfontloader@feature/google-fonts-v2/webfontloader.js"></script>
|
||||
{{$pf:= site.Params.variables.primary_font}}
|
||||
{{$sf:= site.Params.variables.secondary_font}}
|
||||
<script>
|
||||
WebFont.load({
|
||||
google: {
|
||||
api: 'https://fonts.googleapis.com/css2',
|
||||
families: ['{{$pf}}{{if not $sf}}&display=swap{{end}}'{{with $sf}},'{{.}}&display=swap'{{end}}],
|
||||
version: 2
|
||||
},
|
||||
active: () => {
|
||||
sessionStorage.fontsLoaded = true
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- JS Plugins + Main script -->
|
||||
{{ $scripts := slice }}
|
||||
{{ range site.Params.plugins.js}}
|
||||
{{ if findRE "^http" .link }}
|
||||
<script src="{{ .link | absURL }}" type="application/javascript" {{.attributes | safeHTMLAttr}}></script>
|
||||
{{ else }}
|
||||
{{ $scripts = $scripts | append (resources.Get .link) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ $scripts := $scripts | append (resources.Get "js/script.js" | minify) }}
|
||||
{{ $scripts := $scripts | resources.Concat "/js/script.js" | minify | fingerprint "sha512" }}
|
||||
<script crossorigin="anonymous" defer="defer" data-turbolinks-suppress-warning integrity="{{ $scripts.Data.Integrity }}" type="application/javascript">{{$scripts.Content | safeJS}}</script>
|
||||
|
||||
<!-- cookie -->
|
||||
{{ if site.Params.cookies.enable }}
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-cookie/2.2.1/js.cookie.min.js"></script>
|
||||
<div id="js-cookie-box" class="cookie-box cookie-box-hide">
|
||||
This site uses cookies. By continuing to use this website, you agree to their use. <span id="js-cookie-button" class="btn btn-sm btn-outline-primary ml-2">I Accept</span>
|
||||
</div>
|
||||
<script>
|
||||
(function ($) {
|
||||
const cookieBox = document.getElementById('js-cookie-box');
|
||||
const cookieButton = document.getElementById('js-cookie-button');
|
||||
if (!Cookies.get('cookie-box')) {
|
||||
cookieBox.classList.remove('cookie-box-hide');
|
||||
cookieButton.onclick = function () {
|
||||
Cookies.set('cookie-box', true, {
|
||||
expires: {{ site.Params.cookies.expire_days }}
|
||||
});
|
||||
cookieBox.classList.add('cookie-box-hide');
|
||||
};
|
||||
}
|
||||
})(jQuery);
|
||||
</script>
|
||||
|
||||
<!-- cookie style -->
|
||||
<style>
|
||||
.cookie-box {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
text-align: center;
|
||||
z-index: 9999;
|
||||
padding: 1rem 2rem;
|
||||
background: rgb(71, 71, 71);
|
||||
transition: all .75s cubic-bezier(.19, 1, .22, 1);
|
||||
color: #fdfdfd;
|
||||
}
|
||||
|
||||
.cookie-box-hide {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
{{ end }}
|
||||
Reference in New Issue
Block a user