Эх сурвалжийг харах

implemented created index page, after https://github.com/lettier/lettier.github.io/blob/hakyll/lettier_blog.hs

john melesky 8 жил өмнө
parent
commit
05a76556fc
1 өөрчлөгдсөн 1 нэмэгдсэн , 17 устгасан
  1. 1 17
      site.hs

+ 1 - 17
site.hs

@@ -74,29 +74,14 @@ main = hakyll $ do
         >>= loadAndApplyTemplate "templates/default.html" archiveCtx
         >>= relativizeUrls
 
-  create ["new_index.html"] $ do
+  create ["index.html"] $ do
     route idRoute
     compile $ do
       post <- fmap head . recentFirst =<< loadAllSnapshots "posts/*.md" "post_content"
-      -- loadAndApplyTemplate "templates/post.html"        (postCtxWithTags tags) post
       loadAndApplyTemplate "templates/default.html" (postCtxWithTags tags) post
       >>= relativizeUrls
       >>= changeIdentifier "new_index.html"
 
-  match "index.html" $ do
-    route idRoute
-    compile $ do
-      posts <- recentFirst =<< loadAll "posts/*"
-      let indexCtx =
-            listField "posts" postCtx (return posts) `mappend`
-            constField "title" "Home"                `mappend`
-            defaultContext
-
-      getResourceBody
-        >>= applyAsTemplate indexCtx
-        >>= loadAndApplyTemplate "templates/default.html" indexCtx
-        >>= relativizeUrls
-
   match "templates/*" $ compile templateBodyCompiler
 
 
@@ -115,7 +100,6 @@ changeIdentifier idt item = return (itemSetIdentifier idt item)
 itemSetIdentifier :: Identifier -> Item a -> Item a
 itemSetIdentifier x (Item _ i) = Item x i
 
-
 siteCompiler :: Compiler (Item String)
 siteCompiler =
   let addExtensions = [Ext_tex_math_dollars, Ext_tex_math_double_backslash,