Hello,
There are two approaches to do this.
1. Compile the items twice, using different versions [1]. One version is
actually shown on your site, and the other version is just for
extracting the info you need in the actual version.
In this case, however, since you don't need the page body, there is a
much simpler approach:
2. Just get the metadata for all items using `getMatches`/`getMetadata`.
I took the following snippet from the example site generated by
`hakyll-init`:
match "posts/*" $ do
route $ setExtension "html"
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/post.html" postCtx
>>= loadAndApplyTemplate "templates/default.html" postCtx
>>= relativizeUrls
Let's show how you can grab the metadata here:
match "posts/*" $ do
route $ setExtension "html"
compile $ do
posts <- getMatches "posts/*"
metadatas <- mapM getMetadata posts
-- Do something with metadatas here to put it in `postCtx`.
pandocCompiler
>>= loadAndApplyTemplate "templates/post.html" postCtx
>>= loadAndApplyTemplate "templates/default.html" postCtx
>>= relativizeUrls
This should be easily adapted to your site?
[1]:
http://jaspervdj.be/hakyll/tutorials/06-versions.html
Hope this helps,
Peace,
Jasper
> --
> 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+un...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.