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

@ -2,8 +2,9 @@
<html>
<head>
<title>Create Account - Caddy</title>
{{include "/includes/account/head.html"}}
<script src="/resources/js/account/create.js"></script>
{{import "/includes/account/head.html"}}
{{template "account-head"}}
<script src="/resources/js/account/create.js{{template "cacheBust"}}"></script>
</head>
<body>
<form action="/api/create-account" class="card">

View file

@ -2,9 +2,10 @@
<html>
<head>
<title>Dashboard - Caddy</title>
{{include "/includes/account/head.html"}}
<link rel="stylesheet" href="/resources/css/account/dashboard.css">
<script src="/resources/js/account/dashboard.js"></script>
{{import "/includes/account/head.html"}}
{{template "account-head"}}
<link rel="stylesheet" href="/resources/css/account/dashboard.css{{template "cacheBust"}}">
<script src="/resources/js/account/dashboard.js{{template "cacheBust"}}"></script>
</head>
<body>
<div class="container">

View file

@ -2,8 +2,9 @@
<html>
<head>
<title>Log In - Caddy</title>
{{include "/includes/account/head.html"}}
<script src="/resources/js/account/login.js"></script>
{{import "/includes/account/head.html"}}
{{template "account-head"}}
<script src="/resources/js/account/login.js{{template "cacheBust"}}"></script>
</head>
<body>
<form action="/api/login" class="card">

View file

@ -2,8 +2,9 @@
<html>
<head>
<title>Logout - Caddy</title>
{{include "/includes/account/head.html"}}
<script src="/resources/js/account/logout.js"></script>
{{import "/includes/account/head.html"}}
{{template "account-head"}}
<script src="/resources/js/account/logout.js{{template "cacheBust"}}"></script>
</head>
<body>
Logging out...

View file

@ -2,8 +2,9 @@
<html>
<head>
<title>Register Package - Caddy</title>
{{include "/includes/account/head.html"}}
<script src="/resources/js/account/register-package.js"></script>
{{import "/includes/account/head.html"}}
{{template "account-head"}}
<script src="/resources/js/account/register-package.js{{template "cacheBust"}}"></script>
</head>
<body>
<div class="container">

View file

@ -2,8 +2,9 @@
<html>
<head>
<title>Reset Password - Caddy</title>
{{include "/includes/account/head.html"}}
<script src="/resources/js/account/reset-password.js"></script>
{{import "/includes/account/head.html"}}
{{template "account-head"}}
<script src="/resources/js/account/reset-password.js{{template "cacheBust"}}"></script>
</head>
<body>
<form action="/api/reset-password" class="card" id="reset-password-step1">

View file

@ -2,8 +2,9 @@
<html>
<head>
<title>Confirm Account - Caddy</title>
{{include "/includes/account/head.html"}}
<script src="/resources/js/account/verify.js"></script>
{{import "/includes/account/head.html"}}
{{template "account-head"}}
<script src="/resources/js/account/verify.js{{template "cacheBust"}}"></script>
</head>
<body>
<form action="/api/verify-account" class="card">

View file

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

View file

@ -8,7 +8,8 @@
<html>
<head>
<title>{{$title}} &mdash; Caddy Documentation</title>
{{include "/includes/docs/head.html"}}
{{import "/includes/docs/head.html"}}
{{template "docs-head"}}
<meta property="og:title" content="{{$title}} - Caddy Documentation">
<meta name="twitter:title" value="{{$title}} - Caddy Documentation">
</head>

View file

@ -2,11 +2,12 @@
<html>
<head>
<title>JSON Config Structure - Caddy Documentation</title>
{{include "/includes/docs/head.html"}}
<link rel="stylesheet" href="/resources/css/docs-json.css">
{{import "/includes/docs/head.html"}}
{{template "docs-head"}}
<link rel="stylesheet" href="/resources/css/docs-json.css{{template "cacheBust"}}">
<script src="/resources/js/marked-0.8.0.min.js"></script>
<script src="/resources/js/docs-api.js"></script>
<script src="/resources/js/json-docs.js"></script>
<script src="/resources/js/docs-api.js{{template "cacheBust"}}"></script>
<script src="/resources/js/json-docs.js{{template "cacheBust"}}"></script>
</head>
<body>
{{include "/includes/docs/header.html"}}

View file

@ -2,11 +2,12 @@
<html>
<head>
<title>Modules - Caddy Documentation</title>
{{include "/includes/docs/head.html"}}
<link rel="stylesheet" href="/resources/css/docs-json.css">
{{import "/includes/docs/head.html"}}
{{template "docs-head"}}
<link rel="stylesheet" href="/resources/css/docs-json.css{{template "cacheBust"}}">
<script src="/resources/js/marked-0.8.0.min.js"></script>
<script src="/resources/js/docs-api.js"></script>
<script src="/resources/js/module-docs.js"></script>
<script src="/resources/js/docs-api.js{{template "cacheBust"}}"></script>
<script src="/resources/js/module-docs.js{{template "cacheBust"}}"></script>
</head>
<body>
{{include "/includes/docs/header.html"}}

View file

@ -2,11 +2,12 @@
<html>
<head>
<title>Download Caddy</title>
{{include "/includes/head.html"}}
<link rel="stylesheet" href="/resources/css/download.css">
{{import "/includes/head.html"}}
{{template "head"}}
<link rel="stylesheet" href="/resources/css/download.css{{template "cacheBust"}}">
<script src="/resources/js/jquery-3.4.1.min.js"></script>
<script src="/resources/js/sweetalert.min.js"></script>
<script src="/resources/js/download.js"></script>
<script src="/resources/js/download.js{{template "cacheBust"}}"></script>
</head>
<body>
<div class="wrapper">

View file

@ -1,5 +1,8 @@
{{include "/includes/head.html"}}
<link rel="stylesheet" href="/resources/css/account/common.css">
{{define "account-head"}}
{{import "/includes/head.html"}}
{{template "head"}}
<link rel="stylesheet" href="/resources/css/account/common.css{{template "cacheBust"}}">
<script src="/resources/js/jquery-3.4.1.min.js"></script>
<script src="/resources/js/sweetalert.min.js"></script>
<script src="/resources/js/account/common.js"></script>
<script src="/resources/js/account/common.js{{template "cacheBust"}}"></script>
{{end}}

View file

@ -1,10 +1,13 @@
{{include "/includes/head.html"}}
<link rel="stylesheet" href="/resources/css/docs.css">
<link rel="stylesheet" href="/resources/css/chroma.css">
{{define "docs-head"}}
{{import "/includes/head.html"}}
{{template "head"}}
<link rel="stylesheet" href="/resources/css/docs.css{{template "cacheBust"}}">
<link rel="stylesheet" href="/resources/css/chroma.css{{template "cacheBust"}}">
{{$directives := list }}
{{range $i, $file := (listFiles "/docs/markdown/caddyfile/directives")}}
{{$directives = append $directives ($file | trimSuffix ".md")}}
{{end}}
<script type="text/javascript">window.CaddyfileDirectives = {{$directives | toJson}};</script>
<script src="/resources/js/jquery-3.4.1.min.js"></script>
<script src="/resources/js/docs.js"></script>
<script src="/resources/js/docs.js{{template "cacheBust"}}"></script>
{{end}}

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}}

View file

@ -2,8 +2,9 @@
<html>
<head>
<title>Caddy - The Ultimate Server with Automatic HTTPS</title>
{{include "/includes/head.html"}}
<link rel="stylesheet" href="/resources/css/home.css">
{{import "/includes/head.html"}}
{{template "head"}}
<link rel="stylesheet" href="/resources/css/home.css{{template "cacheBust"}}">
<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">
</head>

View file

@ -2,10 +2,11 @@
<html>
<head>
<title>Caddy 2</title>
{{include "/includes/head.html"}}
{{import "/includes/head.html"}}
{{template "head"}}
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Dancing+Script:wght@700&display=swap">
<link rel="stylesheet" href="/resources/css/asciinema-player-2.6.1.css">
<link rel="stylesheet" href="/resources/css/v2-landing.css">
<link rel="stylesheet" href="/resources/css/v2-landing.css{{template "cacheBust"}}">
<meta property="og:title" content="Introducing Caddy 2 - The Ultimate Server with Automatic HTTPS">
<meta name="twitter:title" value="Introducing Caddy 2 - The Ultimate Server with Automatic HTTPS">
</head>