From 9e8b54083a2e3b0d6809cb4c08522cf45bda42e0 Mon Sep 17 00:00:00 2001 From: Kumi Date: Sun, 4 Aug 2024 16:24:17 +0200 Subject: [PATCH] feat: add dynamic timestamp to CSS cache-busting 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. --- main.py | 5 ++++- templates/base.html | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index f00338f..5d9f5a3 100644 --- a/main.py +++ b/main.py @@ -64,7 +64,10 @@ def render_template_to_file(template_name, output_name, **kwargs): def generate_static_site(development_mode=False): # Common context - kwargs = {} + kwargs = { + "timestamp": int(datetime.datetime.now().timestamp()), + } + if development_mode: kwargs.update( { diff --git a/templates/base.html b/templates/base.html index 9afe2bb..f0201d8 100644 --- a/templates/base.html +++ b/templates/base.html @@ -47,7 +47,7 @@ {% block title %}{% endblock %} - Private.coffee - +