Browse Source

cleaned up some templating, still sucks tho

Shaun Kerr 7 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 @@
1
----
2
-title: Home
3
----
4
-
5
-<p>please don't laugh at me i really like swatch internet time</p>
6
-
7
-<p>here are some recent (for a very liberal definition of the word) posts:</p>
8
-<p> - now only shows a few posts because im not dumb anymore - </p>
9
-
10
-<h2>"Recent" Posts</h2>
11
-$partial("templates/post-list.html")$
12
-
13
-<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 @@
1
+---
2
+title: Home
3
+---
4
+
5
+please don't laugh at me i really like swatch internet time
6
+
7
+here are some recent (for a very liberal definition of the word) posts:
8
+
9
+> now actually only shows a few recent posts because im not as bad at haskell as i thought!
10
+
11
+## "Recent" Posts

+ 17
- 12
site.hs View File

@@ -67,32 +67,37 @@ main = do
67 67
                >>= relativizeUrls
68 68
                >>= cleanIndexUrls
69 69
 
70
-      -- Compile posts + save snapshots for the web feeds
71
-      match "posts/*" $ do
72
-         route $ cleanRoute
70
+      -- Compile and load posts
71
+      match "index.md" $ do
72
+         route $ setExtension "html"
73 73
          compile $ pandocCompiler
74
-            >>= loadAndApplyTemplate "templates/post.html"    postCtx
75
-            >>= saveSnapshot "content"
76
-            >>= loadAndApplyTemplate "templates/default.html" postCtx
74
+            >>= loadAndApplyTemplate "templates/index.html" ctx
77 75
             >>= relativizeUrls
78 76
             >>= cleanIndexUrls
79
-            >>= cleanIndexHtmls
80 77
 
81
-      -- Compile and load posts
82
-      match "index.html" $ do
83
-         route idRoute
84 78
          compile $ do
85 79
             posts <- (return . (take 5))
86 80
                      =<< recentFirst
87 81
                      =<< loadAll "posts/*"
88 82
             let indexCtx =
89 83
                   listField "posts" postCtx (return posts) <> ctx
90
-            getResourceBody
84
+            pandocCompiler
91 85
                >>= applyAsTemplate indexCtx
86
+               >>= loadAndApplyTemplate "templates/index.html" indexCtx
92 87
                >>= loadAndApplyTemplate "templates/default.html" indexCtx
93 88
                >>= relativizeUrls
94 89
                >>= cleanIndexUrls
95
-               >>= cleanIndexHtmls
90
+
91
+      -- Compile posts + save snapshots for the web feeds
92
+      match "posts/*" $ do
93
+         route $ cleanRoute
94
+         compile $ pandocCompiler
95
+            >>= loadAndApplyTemplate "templates/post.html"    postCtx
96
+            >>= saveSnapshot "content"
97
+            >>= loadAndApplyTemplate "templates/default.html" postCtx
98
+            >>= relativizeUrls
99
+            >>= cleanIndexUrls
100
+            >>= cleanIndexHtmls
96 101
 
97 102
 -- Agnememnon the Fuck-Upperer - Conquerer of Small Type Declarations
98 103
 compileFeed ::

+ 4
- 0
templates/index.html View File

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

Loading…
Cancel
Save