1
0
Fork 0

sorted articles by date

master
Rostyslav Hnatyshyn 2 months ago
parent be1835b212
commit ff552f44b1
  1. 19
      site.hs
  2. 2
      templates/post-list.html
  3. 2
      templates/pub-list.html

@ -31,18 +31,10 @@ main = hakyllWith config $ do
route idRoute route idRoute
compile compressCssCompiler compile compressCssCompiler
match ("posts/*" .||. "publications/*") $ do
route $ setExtension "html"
compile $
pandocCompiler
>>= loadAndApplyTemplate "templates/post.html" postCtx
>>= loadAndApplyTemplate "templates/default.html" postCtx
>>= relativizeUrls
match "index.html" $ do match "index.html" $ do
route idRoute route idRoute
compile $ do compile $ do
posts <- loadAll "posts/*" posts <- recentFirst =<< loadAll "posts/*"
pubs <- recentFirst =<< loadAll "publications/*" pubs <- recentFirst =<< loadAll "publications/*"
let indexCtx = listField "publications" postCtx (return pubs) <> listField "posts" postCtx (return posts) `mappend` defaultContext let indexCtx = listField "publications" postCtx (return pubs) <> listField "posts" postCtx (return posts) `mappend` defaultContext
@ -52,6 +44,13 @@ main = hakyllWith config $ do
>>= loadAndApplyTemplate "templates/default.html" indexCtx >>= loadAndApplyTemplate "templates/default.html" indexCtx
>>= relativizeUrls >>= relativizeUrls
match ("posts/*" .||. "publications/*") $ do
route $ setExtension "html"
compile $
pandocCompiler
>>= loadAndApplyTemplate "templates/post.html" postCtx
>>= relativizeUrls
match "gallery.html" $ do match "gallery.html" $ do
route idRoute route idRoute
compile $ do compile $ do
@ -73,4 +72,4 @@ main = hakyllWith config $ do
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
postCtx :: Context String postCtx :: Context String
postCtx = modificationTimeField "modded" "%B %e, %Y" `mappend` defaultContext postCtx = mconcat [modificationTimeField "modded" "%B %e, %Y", dateField "parsed-date" "%B %e, %Y", defaultContext]

@ -2,7 +2,7 @@
$if(posts)$ $if(posts)$
$for(posts)$ $for(posts)$
<li> <li>
<a href="$url$">$title$</a> - $modded$ <a href="$url$">$title$</a> - $parsed-date$
</li> </li>
$endfor$ $endfor$
$endif$ $endif$

@ -2,7 +2,7 @@
$if(publications)$ $if(publications)$
$for(publications)$ $for(publications)$
<li> <li>
<a href="$url$">$title$</a> - $published$ <a href="$url$">$title$</a> - $parsed-date$
</li> </li>
$endfor$ $endfor$
$endif$ $endif$

Loading…
Cancel
Save