~yoctocell/yoctocell.xyz

befa8779cc5f2f176fe1c97486e964289ed5417c — yoctocell 11 months ago 6d950dd
site.hs: Generate index.html from index.org
1 files changed, 25 insertions(+), 3 deletions(-)

M site.hs
M site.hs => site.hs +25 -3
@@ 50,19 50,41 @@ main = hakyllWith config $ do
                >>= relativizeUrls


    match "index.html" $ do
        route idRoute
    match "index.org" $ do
      route tempRoute
      compile $ getResourceString >>= orgCompiler

    match "_temp/index.org" $ do
        route $ cleanRouteFromTemp
        -- compile $ pandocCompiler
        --     >>= loadAndApplyTemplate "templates/default.html" defaultContext
        --     >>= relativizeUrls

        compile $ do
            posts <- recentFirst =<< loadAll "_temp/posts/*"
            let indexCtx =
                    listField "posts" postCtx (return posts) `mappend`
                    defaultContext

            getResourceBody
            pandocCompiler
                >>= applyAsTemplate indexCtx
                >>= loadAndApplyTemplate "templates/default.html" indexCtx
                >>= relativizeUrls

  
    -- match "index.html" $ do
    --     route idRoute
    --     compile $ do
    --         posts <- recentFirst =<< loadAll "_temp/posts/*"
    --         let indexCtx =
    --                 listField "posts" postCtx (return posts) `mappend`
    --                 defaultContext

    --         getResourceBody
    --             >>= applyAsTemplate indexCtx
    --             >>= loadAndApplyTemplate "templates/default.html" indexCtx
    --             >>= relativizeUrls

    match blogPattern $ do
        route cleanRouteFromTemp
        compile $ do