Greetings!
I am trying to expand upon the default template which lists recent posts in
the default template by adding post summaries below them, which I guess I will
clip by using the CSS overflow property or something in that direction. When
compiling posts, I currently save a snapshot called "content" before applying
any template to it whatsoever, so this gets me the body. postCtx now looks
like this(this is temporary, I know all posts now have an extraneous field and
so on which is unnecessary)
postCtx :: Context String
postCtx =
field "teaser" foo `mappend`
dateField "date" "%B %e, %Y" `mappend`
defaultContext
where
foo :: Item String -> Compiler String
foo item = loadSnapshotBody (itemIdentifier item) "content"
So this lets me load the body of each item's content snapshot. I like it, it's
pretty smart.
However, while I could simply do some CSS magic here by limiting the size of
the container and use the overflow property, that could result in some strange
looking summaries if I have Latex in there, or code. I would ideally like to
grab just the first paragraph of the body. I could probably whip something up
in Haskell that does that, but I am not very familiar with neither Hakyll nor
Pandoc, so I figured that some of you might have wanted to do something
similar and maybe solved this problem already.
I would really appreciate any advice and/or input regarding this, even if it's
"don't do this!", as I'm also really new to web design in general.