This commit is contained in:
Mats Rauhala 2019-03-27 21:39:43 +02:00
parent 7557f5041c
commit 9d18db19a2
4 changed files with 12 additions and 27 deletions

34
site.hs
View File

@ -1,9 +1,7 @@
--------------------------------------------------------------------------------
{-# LANGUAGE OverloadedStrings #-}
import Data.Monoid (mappend)
import Data.List (sortOn)
import Data.Time (defaultTimeLocale, formatTime)
import Hakyll
import Data.List (sortBy, sortOn)
import Data.Time (formatTime, defaultTimeLocale)
--------------------------------------------------------------------------------
@ -31,34 +29,20 @@ main = hakyllWith defaultConfiguration{ deployCommand = "ipfs add -Q -r _site" }
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls
match "posts/incomplete/*" $ do
match "posts/*" $ do
route $ setExtension "html"
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/post.html" postCtx
>>= loadAndApplyTemplate "templates/default.html" postCtx
>>= relativizeUrls
match "posts/guides/*" $ do
route $ setExtension "html"
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/post.html" postCtx
>>= loadAndApplyTemplate "templates/default.html" postCtx
>>= relativizeUrls
match "posts/brainstorming/*" $ do
route $ setExtension "html"
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/post.html" postCtx
>>= loadAndApplyTemplate "templates/default.html" postCtx
>>= relativizeUrls
create ["guides.html"] $ do
create ["posts.html"] $ do
route idRoute
compile $ do
posts <- modFirst =<< loadAll "posts/guides/*"
posts <- modFirst =<< loadAll "posts/*"
let archiveCtx =
listField "posts" postCtx (return posts) `mappend`
constField "title" "Guides" `mappend`
listField "posts" postCtx (return posts) <>
constField "title" "Posts" <>
defaultContext
makeItem ""
@ -78,8 +62,8 @@ modFirst = fmap reverse . modified
--------------------------------------------------------------------------------
postCtx :: Context String
postCtx =
dateField "date" "%B %e, %Y" `mappend`
modifiedField "modified" "%B %e, %Y" `mappend`
dateField "date" "%B %e, %Y" <>
modifiedField "modified" "%B %e, %Y" <>
defaultContext
where
modifiedField key format = field key $ \i -> do

View File

@ -18,6 +18,7 @@
<!-- Logo by Jason Long -->
<a href="https://git.rauhala.info"><img src="/images/git_16.png" alt="git" /></a>
<a href="/contact.html">Contact</a>
<a href="/posts.html">Posts</a>
</nav>
</header>
@ -29,7 +30,7 @@
<footer>
Site proudly generated by
<a href="http://jaspervdj.be/hakyll">Hakyll</a>
<span id="ipfs">and found on IPFS as <em></em></ipfs>
<span id="ipfs">and found on IPFS as <em></em></ipfs>
</footer>
</body>
<script type="application/javascript" src="/js/jquery-3.3.1.min.js"></script>

View File

@ -1,3 +1,3 @@
A list of small and big guides.
Me writing out interesting ideas and experiments.
$partial("templates/post-list.html")$