Use previous to generate links for articles and rename variable urlPath to filePath since it's actually the path of the file that's gonna be generated
This commit is contained in:
parent
375ea0f7b0
commit
62055a6a54
1 changed files with 7 additions and 7 deletions
14
src/Dom.hs
14
src/Dom.hs
|
@ -21,15 +21,15 @@ import System.Posix.Files (modificationTime)
|
|||
data Page = Page {
|
||||
category :: Maybe String
|
||||
, full :: Bool
|
||||
, urlPath :: FilePath
|
||||
, filePath :: FilePath
|
||||
, articlesFeatured :: [Article]
|
||||
}
|
||||
|
||||
previewArticle :: Article -> Html ()
|
||||
previewArticle article =
|
||||
previewArticle (Article {urlPath}) =
|
||||
article_ (do
|
||||
h1_ "Some Article"
|
||||
pre_ . toHtml $ filePath article
|
||||
h1_ $ a_ [href_ urlPath] "Some Article"
|
||||
pre_ $ toHtml urlPath
|
||||
)
|
||||
|
||||
showTag :: String -> Html ()
|
||||
|
@ -66,19 +66,19 @@ generateCollection (category, path, articlesFeatured) = do
|
|||
blog <- ask
|
||||
liftIO $ createDirectoryIfMissing False path
|
||||
forM_ (pages $ previewCount blog) $ \page ->
|
||||
liftIO $ renderToFile (urlPath page) (render page blog)
|
||||
liftIO $ renderToFile (filePath page) (render page blog)
|
||||
where
|
||||
pages articlesCount = [
|
||||
Page {
|
||||
category
|
||||
, full = True
|
||||
, urlPath = path </> "all.html"
|
||||
, filePath = path </> "all.html"
|
||||
, articlesFeatured
|
||||
}
|
||||
, Page {
|
||||
category
|
||||
, full = False
|
||||
, urlPath = path </> "index.html"
|
||||
, filePath = path </> "index.html"
|
||||
, articlesFeatured = take articlesCount articlesFeatured
|
||||
}
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue