From 8136bdba81a287706afe63fd5fc25de6a8d12460 Mon Sep 17 00:00:00 2001 From: Shaun Kerr Date: Tue, 4 Sep 2018 11:46:35 +1200 Subject: [PATCH] cleaned up some templating, still sucks tho --- index.html | 13 ------------- index.md | 11 +++++++++++ site.hs | 29 +++++++++++++++++------------ templates/index.html | 4 ++++ 4 files changed, 32 insertions(+), 25 deletions(-) delete mode 100644 index.html create mode 100644 index.md create mode 100644 templates/index.html diff --git a/index.html b/index.html deleted file mode 100644 index 0878d8f..0000000 --- a/index.html +++ /dev/null @@ -1,13 +0,0 @@ ---- -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 only shows a few posts because im not dumb anymore -

- -

"Recent" Posts

-$partial("templates/post-list.html")$ - -

…or for a chance to nab seven agenda points, check the archives.

diff --git a/index.md b/index.md new file mode 100644 index 0000000..0657cd4 --- /dev/null +++ b/index.md @@ -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 diff --git a/site.hs b/site.hs index 96adbc7..2ed25a8 100644 --- a/site.hs +++ b/site.hs @@ -67,32 +67,37 @@ main = do >>= relativizeUrls >>= cleanIndexUrls - -- Compile posts + save snapshots for the web feeds - match "posts/*" $ do - route $ cleanRoute + -- Compile and load posts + match "index.md" $ do + route $ setExtension "html" compile $ pandocCompiler - >>= loadAndApplyTemplate "templates/post.html" postCtx - >>= saveSnapshot "content" - >>= loadAndApplyTemplate "templates/default.html" postCtx + >>= loadAndApplyTemplate "templates/index.html" ctx >>= relativizeUrls >>= 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 + pandocCompiler >>= applyAsTemplate indexCtx + >>= loadAndApplyTemplate "templates/index.html" indexCtx >>= loadAndApplyTemplate "templates/default.html" indexCtx >>= relativizeUrls >>= cleanIndexUrls - >>= cleanIndexHtmls + + -- Compile posts + save snapshots for the web feeds + match "posts/*" $ do + route $ cleanRoute + compile $ pandocCompiler + >>= loadAndApplyTemplate "templates/post.html" postCtx + >>= saveSnapshot "content" + >>= loadAndApplyTemplate "templates/default.html" postCtx + >>= relativizeUrls + >>= cleanIndexUrls + >>= cleanIndexHtmls -- Agnememnon the Fuck-Upperer - Conquerer of Small Type Declarations compileFeed :: diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..f063be0 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,4 @@ +$body$ +$partial("templates/post-list.html")$ + +

...or for a chance to nab seven agenda points, check the archives.