Refactor
This commit is contained in:
parent
7557f5041c
commit
9d18db19a2
34
site.hs
34
site.hs
@ -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
|
||||
|
@ -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>
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
A list of small and big guides.
|
||||
Me writing out interesting ideas and experiments.
|
||||
|
||||
$partial("templates/post-list.html")$
|
||||
|
Loading…
Reference in New Issue
Block a user