From ec3a4a4715700294206d6e78d8b38a57a7de7592 Mon Sep 17 00:00:00 2001 From: Carlos Sosa Date: Sat, 24 Aug 2019 20:47:26 -0700 Subject: Move to use src/ directory with the addition of Site modules - Added Content record with Lenses. - Added Rules based content compilers * This is all based on [[https://github.com/blaenk/blaenk.github.io/blob/source/src/Site/Compilers.hs]] --- site.hs | 111 ---------------------------------------------------------------- 1 file changed, 111 deletions(-) delete mode 100644 site.hs (limited to 'site.hs') diff --git a/site.hs b/site.hs deleted file mode 100644 index 6f3ffa0..0000000 --- a/site.hs +++ /dev/null @@ -1,111 +0,0 @@ --------------------------------------------------------------------------------- -{-# LANGUAGE OverloadedStrings #-} -import Data.Monoid ((<>)) -import Hakyll - - --------------------------------------------------------------------------------- -main :: IO () -main = hakyll $ do - match "img/*" $ do - route idRoute - compile copyFileCompiler - - match "css/*" $ do - route idRoute - compile compressCssCompiler - - match "log/*.org" $ do - route $ setExtension "html" - compile $ pandocCompiler - >>= loadAndApplyTemplate "templates/post.html" postCtx - >>= relativizeUrls - - create ["log/index.html"] $ do - route idRoute - compile $ do - makeItem "" - >>= loadAndApplyTemplate "templates/post-list.html" postForArchiveCtx - >>= loadAndApplyTemplate "templates/post.html" archiveCtx - >>= relativizeUrls - - match "gsoc/*.org" $ do - route $ setExtension "html" - compile $ pandocCompiler - >>= loadAndApplyTemplate "templates/post.html" postCtx - >>= relativizeUrls - - create ["gsoc/index.html"] $ do - route idRoute - compile $ do - makeItem "" - >>= loadAndApplyTemplate "templates/post-list.html" gsocPostForArchiveCtx - >>= loadAndApplyTemplate "templates/post.html" gsocArchiveCtx - >>= relativizeUrls - - match "article/**" $ do - route idRoute - compile getResourceBody - - match "index.html" $ do - route idRoute - compile $ do - getResourceBody - >>= applyAsTemplate indexCtx - >>= relativizeUrls - - match "templates/*" $ compile templateBodyCompiler - - --------------------------------------------------------------------------------- -gsocPosts :: Compiler [Item String] -gsocPosts = recentFirst =<< loadAll "gsoc/*.org" - -posts :: Compiler [Item String] -posts = recentFirst =<< loadAll "log/*.org" - -articles :: Compiler [Item String] -articles = loadAll "article/**" - -recentPosts :: Compiler [Item String] -recentPosts = (take 4) <$> posts - -recentArticles :: Compiler [Item String] -recentArticles = (take 4) <$> articles - -indexCtx :: Context String -indexCtx = - listField "articles" defaultContext recentArticles - <> listField "rposts" defaultContext recentPosts - <> constField "essays" "Soon" - <> constField "title" "Home" - <> defaultContext - -archiveCtx :: Context String -archiveCtx = - constField "title" "archive of log posts" - <> defaultContext - -gsocArchiveCtx :: Context String -gsocArchiveCtx = - constField "title" "archive of my GSoC reports." - <> defaultContext - -postCtx :: Context String -postCtx = - dateField "date" "%B %e, %Y" <> defaultContext - -postForArchiveCtx :: Context String -postForArchiveCtx = - listField "posts" dateForArchiveCtx posts - <> defaultContext - -gsocPostForArchiveCtx :: Context String -gsocPostForArchiveCtx = - listField "posts" dateForArchiveCtx gsocPosts - <> defaultContext - -dateForArchiveCtx :: Context String -dateForArchiveCtx = - dateField "date" "%d %b %Y" <> defaultContext - -- cgit v1.3-2-g0d8e