site.hs: Fix do block indentation

Strangely this did not fail locally but failed in build.

Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
This commit is contained in:
Sanchayan Maity 2020-04-05 12:39:12 +05:30
parent eb156a9531
commit 046d146e51
1 changed files with 73 additions and 73 deletions

146
site.hs
View File

@ -8,90 +8,90 @@ main :: IO ()
main = do
E.setLocaleEncoding E.utf8
hakyllWith config $ do
match "images/*" $ do
route idRoute
compile copyFileCompiler
match "images/*" $ do
route idRoute
compile copyFileCompiler
match "css/*" $ compile compressCssCompiler
create ["style.css"] $ do
route idRoute
compile $ do
csses <- loadAll "css/*.css"
makeItem $ unlines $ map itemBody csses
match "css/*" $ compile compressCssCompiler
create ["style.css"] $ do
route idRoute
compile $ do
csses <- loadAll "css/*.css"
makeItem $ unlines $ map itemBody csses
match (fromList ["about.markdown"]) $ do
route $ setExtension "html"
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls
tags <- buildTags "posts/*" (fromCapture "tags/*.html")
match "posts/*" $ do
route $ setExtension "html"
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/post.html" (postCtxWithTags tags)
>>= loadAndApplyTemplate "templates/default.html" (postCtxWithTags tags)
>>= relativizeUrls
create ["archive.html"] $ do
route idRoute
compile $ do
posts <- recentFirst =<< loadAll "posts/*"
let archiveCtx =
listField "posts" (postCtxWithTags tags) (return posts) `mappend`
constField "title" "Archives" `mappend`
defaultContext
makeItem ""
>>= loadAndApplyTemplate "templates/archive.html" archiveCtx
>>= loadAndApplyTemplate "templates/default.html" archiveCtx
match (fromList ["about.markdown"]) $ do
route $ setExtension "html"
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls
match "index.html" $ do
route idRoute
compile $ do
posts <- fmap (take 3) . recentFirst =<< loadAll "posts/*"
let indexCtx =
listField "posts" (postCtxWithTags tags) (return posts) `mappend`
field "tags" (\_ -> renderTagList tags) `mappend`
constField "title" "Welcome" `mappend`
defaultContext
tags <- buildTags "posts/*" (fromCapture "tags/*.html")
getResourceBody
>>= applyAsTemplate indexCtx
>>= loadAndApplyTemplate "templates/default.html" indexCtx
match "posts/*" $ do
route $ setExtension "html"
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/post.html" (postCtxWithTags tags)
>>= loadAndApplyTemplate "templates/default.html" (postCtxWithTags tags)
>>= relativizeUrls
create ["sitemap.xml"] $ do
route idRoute
compile $ do
posts <- recentFirst =<< loadAll "posts/*"
let sitemapCtx =
constField "baseUrl" "sanchayanmaity.gitlab.io" `mappend`
constField "title" "Sitemap" `mappend`
listField "posts" (postCtxWithTags tags) (return posts) `mappend`
(postCtxWithTags tags)
create ["archive.html"] $ do
route idRoute
compile $ do
posts <- recentFirst =<< loadAll "posts/*"
let archiveCtx =
listField "posts" (postCtxWithTags tags) (return posts) `mappend`
constField "title" "Archives" `mappend`
defaultContext
makeItem ""
>>= loadAndApplyTemplate "templates/sitemap.xml" sitemapCtx
>>= cleanIndexHtmls
makeItem ""
>>= loadAndApplyTemplate "templates/archive.html" archiveCtx
>>= loadAndApplyTemplate "templates/default.html" archiveCtx
>>= relativizeUrls
match "templates/*" $ compile templateBodyCompiler
match "index.html" $ do
route idRoute
compile $ do
posts <- fmap (take 3) . recentFirst =<< loadAll "posts/*"
let indexCtx =
listField "posts" (postCtxWithTags tags) (return posts) `mappend`
field "tags" (\_ -> renderTagList tags) `mappend`
constField "title" "Welcome" `mappend`
defaultContext
tagsRules tags $ \tag pattern -> do
let title = "Posts tagged \"" ++ tag ++ "\""
route idRoute
compile $ do
posts <- recentFirst =<< loadAll pattern
let ctx = constField "title" title
`mappend` listField "posts" (postCtxWithTags tags) (return posts)
`mappend` defaultContext
getResourceBody
>>= applyAsTemplate indexCtx
>>= loadAndApplyTemplate "templates/default.html" indexCtx
>>= relativizeUrls
makeItem ""
>>= loadAndApplyTemplate "templates/tag.html" ctx
>>= loadAndApplyTemplate "templates/default.html" ctx
>>= relativizeUrls
create ["sitemap.xml"] $ do
route idRoute
compile $ do
posts <- recentFirst =<< loadAll "posts/*"
let sitemapCtx =
constField "baseUrl" "sanchayanmaity.gitlab.io" `mappend`
constField "title" "Sitemap" `mappend`
listField "posts" (postCtxWithTags tags) (return posts) `mappend`
(postCtxWithTags tags)
makeItem ""
>>= loadAndApplyTemplate "templates/sitemap.xml" sitemapCtx
>>= cleanIndexHtmls
match "templates/*" $ compile templateBodyCompiler
tagsRules tags $ \tag pattern -> do
let title = "Posts tagged \"" ++ tag ++ "\""
route idRoute
compile $ do
posts <- recentFirst =<< loadAll pattern
let ctx = constField "title" title
`mappend` listField "posts" (postCtxWithTags tags) (return posts)
`mappend` defaultContext
makeItem ""
>>= loadAndApplyTemplate "templates/tag.html" ctx
>>= loadAndApplyTemplate "templates/default.html" ctx
>>= relativizeUrls
--------------------------------------------------------------------------------
config :: Configuration