-- | Turns body of the page into the teaser
addTeaser :: Compiler (Page String) (Page String)
addTeaser = arr $
copyBodyToField "teaser" >>> changeField "teaser" extractTeaser
where
extractTeaser :: String -> String
extractTeaser [] = []
extractTeaser xs@(x : xr)
| "<!-- more -->" `isPrefixOf` xs = []
| otherwise = x : extractTeaser xr
(excuse me for the horribly inefficient `extractTeaser` function)
This can be added to your compiler pipeline for a post, *before* you
apply any templates. Then, you should be able to use `$teaser$` in
templates.
Hope this helps,
Cheers,
Jasper