Skip to content

Commit 73e4e0b

Browse files
committed
Cache-bust site stylesheet by release version
1 parent 7b1d65b commit 73e4e0b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

github-pages/_layouts/default.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,10 @@
6666
</style>
6767

6868
<!-- Stylesheet - non-blocking -->
69-
<link rel="preload" href="{{ '/assets/css/style.css' | relative_url }}" as="style" onload="this.onload=null;this.rel='stylesheet'">
70-
<noscript><link rel="stylesheet" href="{{ '/assets/css/style.css' | relative_url }}"></noscript>
69+
{% assign css_url = '/assets/css/style.css' | relative_url %}
70+
{% assign css_version = site.version | default: site.build_date | default: 'dev' %}
71+
<link rel="preload" href="{{ css_url }}?v={{ css_version }}" as="style" onload="this.onload=null;this.rel='stylesheet'">
72+
<noscript><link rel="stylesheet" href="{{ css_url }}?v={{ css_version }}"></noscript>
7173

7274
<!-- Fonts - non-blocking -->
7375
<link rel="preload" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" as="style" onload="this.onload=null;this.rel='stylesheet'">

0 commit comments

Comments
 (0)