Skip to content

Commit efb6db4

Browse files
committed
added a static asset ver to solve caching issue
1 parent b2ecde2 commit efb6db4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Lib/Server/Template.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ instance ToHtml a => ToHtml (Template a) where
3232
let description = case descriptionM of
3333
Nothing -> "unsafePerformIO is the blog and personal website of Wilfred Denton."
3434
Just description' -> description'
35+
assetVer = "1"
3536
title_ $ toHtml title
3637
meta_ [charset_ "utf-8"]
3738
meta_ [name_ "description", content_ description]
@@ -51,12 +52,12 @@ instance ToHtml a => ToHtml (Template a) where
5152
meta_ [name_ "twitter:image", content_ "https://unsafe-perform.io/static/img/favicon.png"]
5253
meta_ [name_ "twitter:card", content_ "summary"]
5354
link_ [rel_ "icon", type_ "image/png", href_ "/static/img/favicon.png"]
54-
link_ [rel_ "stylesheet", type_ "text/css", href_ "/static/css/style.css"]
55+
link_ [rel_ "stylesheet", type_ "text/css", href_ $ "/static/css/style.css?=" <> assetVer]
5556
link_ [rel_ "stylesheet", type_ "text/css", href_ "/static/css/bootstrap-grid.min.css"]
5657
link_ [rel_ "stylesheet", type_ "text/css", href_ "/static/katex/katex.min.css"]
5758
script_ [src_ "/static/katex/katex.min.js"] ("" :: Text)
5859
script_ [src_ "/static/katex/auto-render.min.js"] ("" :: Text)
59-
script_ [src_ "/static/js/script.js", async_ "true"] ("" :: Text)
60+
script_ [src_ $ "/static/js/script.js?=" <> assetVer, async_ "true"] ("" :: Text)
6061
script_ [src_ "https://www.googletagmanager.com/gtag/js?id=UA-131857401-1", async_ "true"] ("" :: Text)
6162
script_ "window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-131857401-1');"
6263
body_ $ do

0 commit comments

Comments
 (0)