Fix absolute links for static resources

This commit is contained in:
Tissevert 2021-05-07 11:04:46 +02:00
parent f229a17bbb
commit dc9e7bc99d
1 changed files with 7 additions and 7 deletions

View File

@ -50,7 +50,7 @@ instance PageType ArticlesList where
h2_ . toHtml =<< description al
ul_ $ do
asks hasRSS >>= rssLink
li_ . a_ [href "" $ otherURL al, class_ "other"] =<< otherLink
li_ . a_ [href_ . pack $ otherURL al, class_ "other"] =<< otherLink
div_ [class_ "articles"] (
mapM_ (mDContent False (pathToRoot al) . preview) =<< getArticles al
)
@ -75,14 +75,14 @@ mDContent raw base markdown@(Markdown {key, body}) =
mDLink :: Bool -> FilePath -> Markdown -> HtmlGenerator ()
mDLink raw base (Markdown {Markdown.path, title}) = link $ toHtml title
where
link = a_ [href base $ path <.> (if raw then "md" else "html")]
link = a_ [href_ . prefix base $ path <.> (if raw then "md" else "html")]
href :: FilePath -> FilePath -> Attribute
href base = href_ . pack . (base </>)
prefix :: FilePath -> FilePath -> Text
prefix base = pack . (base </>)
tag :: FilePath -> String -> HtmlGenerator ()
tag base name =
a_ [href base $ name ++ "/", class_ "tag"] $ toHtml name
a_ [href_ . prefix base $ name ++ "/", class_ "tag"] $ toHtml name
defaultBanner :: FilePath -> HtmlGenerator ()
defaultBanner base =
@ -117,8 +117,8 @@ htmlDocument someContent =
head_ (do
meta_ [charset_ "utf-8"]
title_ . toHtml =<< asks name
script_ [src_ "/js/remarkable.min.js"] empty
script_ [src_ "/js/hablo.js"] empty
script_ [src_ $ prefix base "js/remarkable.min.js"] empty
script_ [src_ $ prefix base "js/hablo.js"] empty
optional (faviconLink base) =<< (asks $skin.$favicon)
optional (Card.make someContent) =<< (asks $urls.$cards)
optional toHtmlRaw =<< (asks $skin.$head)