diff --git a/app/config.py b/app/config.py
index f828f6d..9578d08 100644
--- a/app/config.py
+++ b/app/config.py
@@ -1,3 +1,4 @@
+import hashlib
import os
import secrets
from pathlib import Path
@@ -25,6 +26,14 @@ try:
except ImportError:
pass
+# Force reloading cache when the CSS is updated
+CSS_HASH = "none"
+try:
+ css_data = (ROOT_DIR / "app" / "static" / "css" / "main.css").read_bytes()
+ CSS_HASH = hashlib.md5(css_data, usedforsecurity=False).hexdigest()
+except FileNotFoundError:
+ pass
+
VERSION = f"2.0.0+{VERSION_COMMIT}"
USER_AGENT = f"microblogpub/{VERSION}"
diff --git a/app/templates.py b/app/templates.py
index c1f4ec1..30bd759 100644
--- a/app/templates.py
+++ b/app/templates.py
@@ -26,6 +26,7 @@ from app.actor import LOCAL_ACTOR
from app.ap_object import Attachment
from app.ap_object import Object
from app.config import BASE_URL
+from app.config import CSS_HASH
from app.config import DEBUG
from app.config import VERSION
from app.config import generate_csrf_token
@@ -102,6 +103,7 @@ async def render_template(
"request": request,
"debug": DEBUG,
"microblogpub_version": VERSION,
+ "css_hash": CSS_HASH,
"is_admin": is_admin,
"csrf_token": generate_csrf_token(),
"highlight_css": HIGHLIGHT_CSS,
diff --git a/app/templates/layout.html b/app/templates/layout.html
index 940378d..0124969 100644
--- a/app/templates/layout.html
+++ b/app/templates/layout.html
@@ -4,7 +4,7 @@
-
+