Browse Source

cleaned up some templating, still sucks tho

master
Shaun Kerr 11 months ago
parent
commit
8136bdba81
4 changed files with 32 additions and 25 deletions
  1. 0
    13
      index.html
  2. 11
    0
      index.md
  3. 17
    12
      site.hs
  4. 4
    0
      templates/index.html

+ 0
- 13
index.html 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
- 0
index.md 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

+ 17
- 12
site.hs View File

@@ -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 ::

+ 4
- 0
templates/index.html 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>

Loading…
Cancel
Save