cleaned up some templating, still sucks tho

This commit is contained in:
Shaun Kerr 2018-09-04 11:46:35 +12:00
parent b050980644
commit 8136bdba81
4 changed files with 36 additions and 29 deletions

View File

@ -1,13 +0,0 @@
---
title: Home
---
<p>please don't laugh at me i really like swatch internet time</p>
<p>here are some recent (for a very liberal definition of the word) posts:</p>
<p> - now only shows a few posts because im not dumb anymore - </p>
<h2>"Recent" Posts</h2>
$partial("templates/post-list.html")$
<p>…or for a chance to nab seven agenda points, check the <a href="/archive/index.html">archives</a>.</p>

11
index.md Normal file
View File

@ -0,0 +1,11 @@
---
title: Home
---
please don't laugh at me i really like swatch internet time
here are some recent (for a very liberal definition of the word) posts:
> now actually only shows a few recent posts because im not as bad at haskell as i thought!
## "Recent" Posts

37
site.hs
View File

@ -67,6 +67,27 @@ main = do
>>= relativizeUrls
>>= cleanIndexUrls
-- Compile and load posts
match "index.md" $ do
route $ setExtension "html"
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/index.html" ctx
>>= relativizeUrls
>>= cleanIndexUrls
compile $ do
posts <- (return . (take 5))
=<< recentFirst
=<< loadAll "posts/*"
let indexCtx =
listField "posts" postCtx (return posts) <> ctx
pandocCompiler
>>= applyAsTemplate indexCtx
>>= loadAndApplyTemplate "templates/index.html" indexCtx
>>= loadAndApplyTemplate "templates/default.html" indexCtx
>>= relativizeUrls
>>= cleanIndexUrls
-- Compile posts + save snapshots for the web feeds
match "posts/*" $ do
route $ cleanRoute
@ -78,22 +99,6 @@ main = do
>>= cleanIndexUrls
>>= cleanIndexHtmls
-- Compile and load posts
match "index.html" $ do
route idRoute
compile $ do
posts <- (return . (take 5))
=<< recentFirst
=<< loadAll "posts/*"
let indexCtx =
listField "posts" postCtx (return posts) <> ctx
getResourceBody
>>= applyAsTemplate indexCtx
>>= loadAndApplyTemplate "templates/default.html" indexCtx
>>= relativizeUrls
>>= cleanIndexUrls
>>= cleanIndexHtmls
-- Agnememnon the Fuck-Upperer - Conquerer of Small Type Declarations
compileFeed ::
(FeedConfiguration

4
templates/index.html Normal file
View File

@ -0,0 +1,4 @@
$body$
$partial("templates/post-list.html")$
<p>...or for a chance to nab seven agenda points, check the <a href="/archive/index.html">archives</a>.</p>