diff options
| author | Carlos Sosa <gnusosa@gnusosa.net> | 2019-08-24 20:47:26 -0700 |
|---|---|---|
| committer | Carlos Sosa <gnusosa@gnusosa.net> | 2019-08-24 20:47:26 -0700 |
| commit | ec3a4a4715700294206d6e78d8b38a57a7de7592 (patch) | |
| tree | 82f7bf9cd081332216efb7f4e2eed77240f2c845 /site.hs | |
| parent | 03a8fc8f75a1bf0f5afb7d0dd11cd7e881a7d763 (diff) | |
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]]
Diffstat (limited to 'site.hs')
| -rw-r--r-- | site.hs | 111 |
1 files changed, 0 insertions, 111 deletions
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 - |
