Refactor
This commit is contained in:
parent
7557f5041c
commit
9d18db19a2
34
site.hs
34
site.hs
@ -1,9 +1,7 @@
|
|||||||
--------------------------------------------------------------------------------
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
import Data.Monoid (mappend)
|
import Data.List (sortOn)
|
||||||
|
import Data.Time (defaultTimeLocale, formatTime)
|
||||||
import Hakyll
|
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
|
>>= loadAndApplyTemplate "templates/default.html" defaultContext
|
||||||
>>= relativizeUrls
|
>>= relativizeUrls
|
||||||
|
|
||||||
match "posts/incomplete/*" $ do
|
match "posts/*" $ do
|
||||||
route $ setExtension "html"
|
route $ setExtension "html"
|
||||||
compile $ pandocCompiler
|
compile $ pandocCompiler
|
||||||
>>= loadAndApplyTemplate "templates/post.html" postCtx
|
>>= loadAndApplyTemplate "templates/post.html" postCtx
|
||||||
>>= loadAndApplyTemplate "templates/default.html" postCtx
|
>>= loadAndApplyTemplate "templates/default.html" postCtx
|
||||||
>>= relativizeUrls
|
>>= relativizeUrls
|
||||||
|
|
||||||
match "posts/guides/*" $ do
|
create ["posts.html"] $ 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
|
|
||||||
route idRoute
|
route idRoute
|
||||||
compile $ do
|
compile $ do
|
||||||
posts <- modFirst =<< loadAll "posts/guides/*"
|
posts <- modFirst =<< loadAll "posts/*"
|
||||||
let archiveCtx =
|
let archiveCtx =
|
||||||
listField "posts" postCtx (return posts) `mappend`
|
listField "posts" postCtx (return posts) <>
|
||||||
constField "title" "Guides" `mappend`
|
constField "title" "Posts" <>
|
||||||
defaultContext
|
defaultContext
|
||||||
|
|
||||||
makeItem ""
|
makeItem ""
|
||||||
@ -78,8 +62,8 @@ modFirst = fmap reverse . modified
|
|||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
postCtx :: Context String
|
postCtx :: Context String
|
||||||
postCtx =
|
postCtx =
|
||||||
dateField "date" "%B %e, %Y" `mappend`
|
dateField "date" "%B %e, %Y" <>
|
||||||
modifiedField "modified" "%B %e, %Y" `mappend`
|
modifiedField "modified" "%B %e, %Y" <>
|
||||||
defaultContext
|
defaultContext
|
||||||
where
|
where
|
||||||
modifiedField key format = field key $ \i -> do
|
modifiedField key format = field key $ \i -> do
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
<!-- Logo by Jason Long -->
|
<!-- Logo by Jason Long -->
|
||||||
<a href="https://git.rauhala.info"><img src="/images/git_16.png" alt="git" /></a>
|
<a href="https://git.rauhala.info"><img src="/images/git_16.png" alt="git" /></a>
|
||||||
<a href="/contact.html">Contact</a>
|
<a href="/contact.html">Contact</a>
|
||||||
|
<a href="/posts.html">Posts</a>
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
A list of small and big guides.
|
Me writing out interesting ideas and experiments.
|
||||||
|
|
||||||
$partial("templates/post-list.html")$
|
$partial("templates/post-list.html")$
|
||||||
|
Loading…
Reference in New Issue
Block a user