site: move tags to archive
authorLucian Mogosanu <lucian.mogosanu@gmail.com>
Thu, 2 Jan 2014 09:38:15 +0000 (11:38 +0200)
committerLucian Mogosanu <lucian.mogosanu@gmail.com>
Thu, 2 Jan 2014 09:58:20 +0000 (11:58 +0200)
index.html
site.hs
templates/archive.html

index 48204db..49257fd 100644 (file)
@@ -12,4 +12,3 @@ $partial("templates/post-list.html")$
 
 <h2>Labels</h2>
 
-$taglist$
diff --git a/site.hs b/site.hs
index e3e2d82..549cfff 100644 (file)
--- a/site.hs
+++ b/site.hs
@@ -19,7 +19,7 @@ main = hakyllWith tarpitConfiguration $ do
   match "images/**" $ compileImages
   match "css/fonts/*" $ compileFonts
   match (fromList pages) compilePages
-  create ["archive.html"] compileArchive
+  create ["archive.html"] $ compileArchive tags
 
   -- tags rules
   tagsRules tags $ compileTags tags
@@ -38,7 +38,6 @@ compileIndex tags = do
       posts <- loadAll "posts/**" >>= fmap (take 5) . recentFirst
       let indexCtx =
             listField "posts" postCtx (return posts)    `mappend`
-            field "taglist" (const $ renderTagList tags) `mappend`
             defaultContext
 
       getResourceBody
@@ -77,14 +76,15 @@ compilePages = do
     -- relative URLs break 404 pages, so don't do it here
     -- >>= relativizeUrls
 
-compileArchive :: Rules ()
-compileArchive = do
+compileArchive :: Tags -> Rules ()
+compileArchive tags = do
   route idRoute
   compile $ do
     posts <- loadAll "posts/**" >>= recentFirst
     let archiveCtx =
-          listField "posts" postCtx (return posts) `mappend`
-          constField "title" "Archive"             `mappend`
+          listField "posts" postCtx (return posts)      `mappend`
+          field "taglist" (const $ renderTagList tags)  `mappend`
+          constField "title" "Archive"                  `mappend`
           defaultContext
     makeItem ""
       >>= loadAndApplyTemplate "templates/archive.html" archiveCtx
index 4d91f5b..e7a1c1b 100644 (file)
@@ -1,2 +1,7 @@
-Posts from The Tar Pit:
+<h2>Labels</h2>
+
+<p>$taglist$</p>
+
+<h2>Posts from The Tar Pit</h2>
+
 $partial("templates/post-list.html")$