Re-add cache busting

Fix docs
This commit is contained in:
Francis Lavoie 2023-11-19 06:28:06 -05:00
parent 09b9c74bfc
commit 5e93103dce
No known key found for this signature in database
GPG key ID: 0F66EE1687682239
8 changed files with 46 additions and 31 deletions

View file

@ -2,15 +2,16 @@
<html> <html>
<head> <head>
<title>Caddy Documentation</title> <title>Caddy Documentation</title>
{{include "/includes/head.html"}} {{import "/includes/head.html"}}
<link rel="stylesheet" href="/resources/css/docs.css"> {{template "head"}}
<link rel="stylesheet" href="/resources/css/docs-home.css"> <link rel="stylesheet" href="/resources/css/docs.css{{template "cacheBust"}}">
<link rel="stylesheet" href="/resources/css/docs-home.css{{template "cacheBust"}}">
<!-- <meta property="og:title" content="Caddy 2 - The Ultimate Server with Automatic HTTPS"> <!-- <meta property="og:title" content="Caddy 2 - The Ultimate Server with Automatic HTTPS">
<meta name="twitter:title" value="Caddy 2 - The Ultimate Server with Automatic HTTPS"> --> <meta name="twitter:title" value="Caddy 2 - The Ultimate Server with Automatic HTTPS"> -->
<script src="/resources/js/vendor/marked.min.js"></script> <script src="/resources/js/vendor/marked.min.js{{template "cacheBust"}}"></script>
<script src="/resources/js/docs.js"></script> <script src="/resources/js/docs.js{{template "cacheBust"}}"></script>
<script src="/resources/js/docs-home.js"></script> <script src="/resources/js/docs-home.js{{template "cacheBust"}}"></script>
</head> </head>
<body> <body>
{{include "/includes/header.html" ""}} {{include "/includes/header.html" ""}}
@ -181,4 +182,4 @@
</div> </div>
</main> </main>
</body> </body>
</html> </html>

View file

@ -2,8 +2,9 @@
<html> <html>
<head> <head>
<title>Download Caddy</title> <title>Download Caddy</title>
{{include "/includes/head.html"}} {{import "/includes/head.html"}}
<link rel="stylesheet" href="/resources/css/download.css"> {{template "head"}}
<link rel="stylesheet" href="/resources/css/download.css{{template "cacheBust"}}">
</head> </head>
<body> <body>
<div class="hero"> <div class="hero">
@ -21,4 +22,4 @@
{{include "/includes/footer.html"}} {{include "/includes/footer.html"}}
</body> </body>
</html> </html>

View file

@ -2,9 +2,10 @@
<html> <html>
<head> <head>
<title>All features of the Caddy Web Server</title> <title>All features of the Caddy Web Server</title>
{{include "/includes/head.html"}} {{import "/includes/head.html"}}
<link rel="stylesheet" href="/resources/css/marketing.css"> {{template "head"}}
<link rel="stylesheet" href="/resources/css/features.css"> <link rel="stylesheet" href="/resources/css/marketing.css{{template "cacheBust"}}">
<link rel="stylesheet" href="/resources/css/features.css{{template "cacheBust"}}">
</head> </head>
<body> <body>
<div class="hero"> <div class="hero">
@ -1722,4 +1723,4 @@
{{include "/includes/footer.html"}} {{include "/includes/footer.html"}}
</body> </body>
</html> </html>

View file

@ -1,3 +1,11 @@
{{define "cacheBust" -}}
{{- if fileExists "/.commit-hash" -}}
{{- $commitHash := (include "/.commit-hash") -}}
{{- trim (printf "?v=%v" $commitHash) -}}
{{- end -}}
{{- end}}
{{define "head"}}
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
@ -46,5 +54,7 @@
</script> --> </script> -->
<!-- Alpine.js to augment markdown docs --> <!-- 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/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> --> <script src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js" defer></script>
{{end}}

View file

@ -2,14 +2,14 @@
<html> <html>
<head> <head>
<title>Caddy - The Ultimate Server with Automatic HTTPS</title> <title>Caddy - The Ultimate Server with Automatic HTTPS</title>
{{include "/includes/head.html"}} {{import "/includes/head.html"}}
{{template "head"}}
<link rel="stylesheet" href="/resources/css/vendor/asciinema-player-3.6.1.css{{template "cacheBust"}}">
<script src="/resources/js/vendor/asciinema-player-3.6.1.min.js{{template "cacheBust"}}"></script>
<script src="/resources/js/home.js{{template "cacheBust"}}"></script>
<link rel="stylesheet" href="/resources/css/vendor/asciinema-player-3.6.1.css"> <link rel="stylesheet" href="/resources/css/marketing.css{{template "cacheBust"}}">
<script src="/resources/js/vendor/asciinema-player-3.6.1.min.js"></script> <link rel="stylesheet" href="/resources/css/home.css{{template "cacheBust"}}">
<script src="/resources/js/home.js"></script>
<link rel="stylesheet" href="/resources/css/marketing.css">
<link rel="stylesheet" href="/resources/css/home.css">
<!-- <meta property="og:title" content="Caddy 2 - The Ultimate Server with Automatic HTTPS"> <!-- <meta property="og:title" content="Caddy 2 - The Ultimate Server with Automatic HTTPS">
<meta name="twitter:title" value="Caddy 2 - The Ultimate Server with Automatic HTTPS"> --> <meta name="twitter:title" value="Caddy 2 - The Ultimate Server with Automatic HTTPS"> -->
@ -821,4 +821,4 @@ reverse_proxy /api/* localhost:9002</code>
}); });
</script> </script>
</body> </body>
</html> </html>

View file

@ -2,9 +2,10 @@
<html> <html>
<head> <head>
<title>Sponsor the Caddy Project</title> <title>Sponsor the Caddy Project</title>
{{include "/includes/head.html"}} {{import "/includes/head.html"}}
<link rel="stylesheet" href="/resources/css/marketing.css"> {{template "head"}}
<link rel="stylesheet" href="/resources/css/sponsor.css"> <link rel="stylesheet" href="/resources/css/marketing.css{{template "cacheBust"}}">
<link rel="stylesheet" href="/resources/css/sponsor.css{{template "cacheBust"}}">
</head> </head>
<body> <body>
<div class="hero"> <div class="hero">
@ -676,4 +677,4 @@ cardsContainer.addEventListener("pointermove", applyOverlayMask);
</body> </body>
</html> </html>

View file

@ -4,7 +4,7 @@
<title>Caddy for Business</title> <title>Caddy for Business</title>
{{import "/includes/head.html"}} {{import "/includes/head.html"}}
{{template "head"}} {{template "head"}}
<link rel="stylesheet" href="/resources/css/business.css"> <link rel="stylesheet" href="/resources/css/business.css{{template "cacheBust"}}">
<meta property="og:title" content="Caddy 2 for Business"> <meta property="og:title" content="Caddy 2 for Business">
<meta name="twitter:title" value="Caddy 2 for Business"> <meta name="twitter:title" value="Caddy 2 for Business">
</head> </head>

View file

@ -49,9 +49,10 @@
<!-- Alpine.js to augment markdown docs --> <!-- 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/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> <script src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js" defer></script>
{{end}}
<!-- TODO: These don't work -- color values need to be tweaked if they do work -- I think because background-color is set on the body. --> <!-- TODO: These don't work -- color values need to be tweaked if they do work -- I think because background-color is set on the body. -->
<meta name="theme-color" content="#123245" media="(prefers-color-scheme: light)"> <meta name="theme-color" content="#123245" media="(prefers-color-scheme: light)">
<meta name="theme-color" content="#123245" media="(prefers-color-scheme: dark)"> <meta name="theme-color" content="#123245" media="(prefers-color-scheme: dark)">
{{end}}