Implement cache busting

This commit is contained in:
Francis Lavoie 2023-08-10 17:15:01 -04:00
parent 254e415a61
commit 2aa6cd48e1
No known key found for this signature in database
GPG key ID: 0F66EE1687682239
17 changed files with 85 additions and 56 deletions

View file

@ -1,12 +1,20 @@
{{define "cacheBust" -}}
{{- if fileExists "/.commit-hash" -}}
{{- $commitHash := (include "/.commit-hash") -}}
{{- trim (printf "?v=%v" $commitHash) -}}
{{- end -}}
{{- end}}
{{define "head"}}
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="preconnect" href="https://BH4D9OD16A-dsn.algolia.net" crossorigin />
<link rel="icon" href="/resources/images/favicon.png">
<link rel="icon" href="/resources/images/favicon.png{{template "cacheBust"}}">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inter:400,700|Maven+Pro:400,700,900|Montserrat:400,700|PT+Mono&display=swap">
<link rel="stylesheet" href="/resources/css/common.css">
<script src="/resources/js/common.js"></script>
<link rel="stylesheet" href="/resources/css/common.css{{template "cacheBust"}}">
<script src="/resources/js/common.js{{template "cacheBust"}}"></script>
<!-- General metatags -->
<meta name="author" content="Caddy Web Server">
@ -41,3 +49,4 @@
<!-- Alpine.js to augment markdown docs -->
<script src="https://cdn.jsdelivr.net/npm/@alpinejs/persist@3.x.x/dist/cdn.min.js" defer></script>
<script src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js" defer></script>
{{end}}