feat: add dynamic timestamp to CSS cache-busting
All checks were successful
Build and Deploy Static Site / build (push) Successful in 1m2s

Included a timestamp in the static site generation to dynamically append to the CSS file version parameter. This ensures that users always get the latest CSS changes, reducing cache-related issues.
This commit is contained in:
Kumi 2024-08-04 16:24:17 +02:00
parent 009ab87552
commit 9e8b54083a
Signed by: kumi
GPG key ID: ECBCC9082395383F
2 changed files with 5 additions and 2 deletions

View file

@ -64,7 +64,10 @@ def render_template_to_file(template_name, output_name, **kwargs):
def generate_static_site(development_mode=False): def generate_static_site(development_mode=False):
# Common context # Common context
kwargs = {} kwargs = {
"timestamp": int(datetime.datetime.now().timestamp()),
}
if development_mode: if development_mode:
kwargs.update( kwargs.update(
{ {

View file

@ -47,7 +47,7 @@
<link rel="icon" type="image/png" href="assets/img/logo_inv_grad.png" /> <link rel="icon" type="image/png" href="assets/img/logo_inv_grad.png" />
<title>{% block title %}{% endblock %} - Private.coffee</title> <title>{% block title %}{% endblock %} - Private.coffee</title>
<link rel="stylesheet" href="assets/dist/css/bootstrap.min.css" /> <link rel="stylesheet" href="assets/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="assets/css/base.css?v=24080401" /> <link rel="stylesheet" href="assets/css/base.css?v={{ timestamp }}" />
</head> </head>
<body> <body>