s***@gmail.com
2017-11-09 20:23:19 UTC
Amongst others, I have the following two routes:
postPages = version "posts" $ match "posts/*" $ do
route $ setExtension "html"
compile $
pandocCompiler >>=
loadAndApplyTemplate "templates/post.html" postCtx >>=
loadAndApplyTemplate "templates/main-template.html" postCtx >>=
relativizeUrls
index = version "paginated" $ do
pag <- buildPaginateWith grouper "posts/*" pageNumberToIdentifier
paginateRules pag $ \pageNum pattern -> do
route idRoute
compile $ do
posts <- recentFirstPosts
let paginateCtx = paginateContext pag pageNum <> postCtx
let ctx = constField "title" (pageTitle pageNum) <>
listField "posts" (paginateCtx) (return posts) <>
paginateCtx <>
metadataField <>
defaultContext
makeItem "" >>=
loadAndApplyTemplate "templates/index.html" ctx >>=
loadAndApplyTemplate "templates/main-template.html" ctx >>=
relativizeUrls
When I visit the paginated index page the main-template.html template was
applied round each post and around the whole page. If I remove that
template from postPages, then it stops being applied around each post in
the paginated index page. I added the version function thinking this would
fix it, but it hasn't and now I'm totally bemused as to how to fix it.
Any ideas would be greatly appreciated,
Sean.
postPages = version "posts" $ match "posts/*" $ do
route $ setExtension "html"
compile $
pandocCompiler >>=
loadAndApplyTemplate "templates/post.html" postCtx >>=
loadAndApplyTemplate "templates/main-template.html" postCtx >>=
relativizeUrls
index = version "paginated" $ do
pag <- buildPaginateWith grouper "posts/*" pageNumberToIdentifier
paginateRules pag $ \pageNum pattern -> do
route idRoute
compile $ do
posts <- recentFirstPosts
let paginateCtx = paginateContext pag pageNum <> postCtx
let ctx = constField "title" (pageTitle pageNum) <>
listField "posts" (paginateCtx) (return posts) <>
paginateCtx <>
metadataField <>
defaultContext
makeItem "" >>=
loadAndApplyTemplate "templates/index.html" ctx >>=
loadAndApplyTemplate "templates/main-template.html" ctx >>=
relativizeUrls
When I visit the paginated index page the main-template.html template was
applied round each post and around the whole page. If I remove that
template from postPages, then it stops being applied around each post in
the paginated index page. I added the version function thinking this would
fix it, but it hasn't and now I'm totally bemused as to how to fix it.
Any ideas would be greatly appreciated,
Sean.
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hakyll+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hakyll+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.