File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,6 +14,11 @@ import { SITE } from "./src/config";
1414// https://astro.build/config
1515export default defineConfig ( {
1616 site : SITE . website ,
17+ build : {
18+ // Add cache busting with content hashes
19+ inlineStylesheets : 'auto' ,
20+ assets : '_astro' ,
21+ } ,
1722 integrations : [
1823 sitemap ( {
1924 filter : page => SITE . showArchives || ! page . endsWith ( "/archives" ) ,
@@ -43,6 +48,21 @@ export default defineConfig({
4348 optimizeDeps : {
4449 exclude : [ "@resvg/resvg-js" ] ,
4550 } ,
51+ build : {
52+ // Enable CSS code splitting for better cache busting
53+ cssCodeSplit : true ,
54+ // Generate manifest for cache busting
55+ manifest : true ,
56+ // Add content hash to filenames
57+ rollupOptions : {
58+ output : {
59+ // Ensure unique filenames for cache busting
60+ entryFileNames : '_astro/[name].[hash].js' ,
61+ chunkFileNames : '_astro/[name].[hash].js' ,
62+ assetFileNames : '_astro/[name].[hash][extname]' ,
63+ } ,
64+ } ,
65+ } ,
4666 } ,
4767 image : {
4868 responsiveStyles : true ,
Original file line number Diff line number Diff line change 1+ # Cache busting headers for GitHub Pages
2+ # Prevents browser caching issues
3+
4+ # HTML files - no cache, always revalidate
5+ /*.html
6+ Cache-Control: no-cache, no-store, must-revalidate
7+ Pragma: no-cache
8+ Expires: 0
9+
10+ /
11+ Cache-Control: no-cache, no-store, must-revalidate
12+ Pragma: no-cache
13+ Expires: 0
14+
15+ # Service Worker - never cache
16+ /sw.js
17+ Cache-Control: no-cache, no-store, must-revalidate
18+ Pragma: no-cache
19+ Expires: 0
20+
21+ # Static assets with hash - cache for 1 year
22+ /_astro/*
23+ Cache-Control: public, max-age=31536000, immutable
24+
25+ # Images - cache for 1 week
26+ /assets/*
27+ Cache-Control: public, max-age=604800
28+
29+ # Fonts - cache for 1 year
30+ /*.woff2
31+ Cache-Control: public, max-age=31536000, immutable
32+
33+ /*.woff
34+ Cache-Control: public, max-age=31536000, immutable
35+
36+ # JavaScript and CSS with hashes - cache for 1 year
37+ /*.js
38+ Cache-Control: public, max-age=31536000, immutable
39+
40+ /*.css
41+ Cache-Control: public, max-age=31536000, immutable
You can’t perform that action at this time.
0 commit comments