Add alias to create <a/> with a "navigation" class and help the JS code distinguish between hablo generated links which navigation should be hijacked and regular ones
This commit is contained in:
parent
dcf8d3d010
commit
bbef924104
1 changed files with 7 additions and 4 deletions
11
src/Dom.hs
11
src/Dom.hs
|
@ -40,7 +40,7 @@ instance Page ArticlesList where
|
||||||
|
|
||||||
content al@(ArticlesList {featured}) = do
|
content al@(ArticlesList {featured}) = do
|
||||||
h2_ . toHtml . pack $ pageTitle al
|
h2_ . toHtml . pack $ pageTitle al
|
||||||
p_ . a_ [href_ . pack $ otherUrl al] . toHtml . pack $ otherLink al
|
p_ . navigationA [href_ . pack $ otherUrl al] . toHtml . pack $ otherLink al
|
||||||
div_ [class_ "articles"] (mapM_ previewArticle featured)
|
div_ [class_ "articles"] (mapM_ previewArticle featured)
|
||||||
|
|
||||||
makeCard :: String -> String -> HtmlGenerator ()
|
makeCard :: String -> String -> HtmlGenerator ()
|
||||||
|
@ -53,15 +53,18 @@ makeCard title description = do
|
||||||
where
|
where
|
||||||
og attribute value = meta_ [makeAttribute "property" $ "og:" <> attribute , content_ $ pack value]
|
og attribute value = meta_ [makeAttribute "property" $ "og:" <> attribute , content_ $ pack value]
|
||||||
|
|
||||||
|
navigationA :: Term arg result => arg -> result
|
||||||
|
navigationA = "a" `termWith` [class_ "navigation"]
|
||||||
|
|
||||||
previewArticle :: Article -> HtmlGenerator ()
|
previewArticle :: Article -> HtmlGenerator ()
|
||||||
previewArticle (Article {urlPath, title, preview}) =
|
previewArticle (Article {urlPath, title, preview}) =
|
||||||
article_ (do
|
article_ (do
|
||||||
a_ [href_ . pack $ "/" </> urlPath <.> "html"] . h3_ $ toHtml title
|
navigationA [href_ . pack $ "/" </> urlPath <.> "html"] . h3_ $ toHtml title
|
||||||
pre_ $ toHtml preview
|
pre_ $ toHtml preview
|
||||||
)
|
)
|
||||||
|
|
||||||
tag :: String -> HtmlGenerator ()
|
tag :: String -> HtmlGenerator ()
|
||||||
tag tagName = li_ (a_ [href_ $ pack ("/" </> tagName)] $ toHtml tagName)
|
tag tagName = li_ (navigationA [href_ $ pack ("/" </> tagName)] $ toHtml tagName)
|
||||||
|
|
||||||
banner :: HtmlGenerator ()
|
banner :: HtmlGenerator ()
|
||||||
banner = do
|
banner = do
|
||||||
|
@ -70,7 +73,7 @@ banner = do
|
||||||
defaultBanner :: HtmlGenerator ()
|
defaultBanner :: HtmlGenerator ()
|
||||||
defaultBanner = do
|
defaultBanner = do
|
||||||
div_ [id_ "header"] (
|
div_ [id_ "header"] (
|
||||||
a_ [href_ "/"] (
|
navigationA [href_ "/"] (
|
||||||
h1_ . toHtml =<< Blog.get name
|
h1_ . toHtml =<< Blog.get name
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue