diff options
author | Jasper Van der Jeugt <m@jaspervdj.be> | 2013-06-17 12:01:22 +0200 |
---|---|---|
committer | Jasper Van der Jeugt <m@jaspervdj.be> | 2013-06-17 12:01:22 +0200 |
commit | 6814ff2e9bbe8bc51834c948ae14a59a326b3789 (patch) | |
tree | ef8c0c867485cab905609b2080ee71f5b93c3808 /src/Hakyll/Web | |
parent | 25e15846a2476db365809b06333cc0fab2d85221 (diff) | |
download | hakyll-6814ff2e9bbe8bc51834c948ae14a59a326b3789.tar.gz |
Only add teaser when <!--more--> is there
Diffstat (limited to 'src/Hakyll/Web')
-rw-r--r-- | src/Hakyll/Web/Template/Context.hs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/Hakyll/Web/Template/Context.hs b/src/Hakyll/Web/Template/Context.hs index 3fde93b..ecf769d 100644 --- a/src/Hakyll/Web/Template/Context.hs +++ b/src/Hakyll/Web/Template/Context.hs @@ -242,9 +242,13 @@ modificationTimeFieldWith locale key fmt = field key $ \i -> do teaserField :: String -- ^ Key to use -> Snapshot -- ^ Snapshot to load -> Context String -- ^ Resulting context -teaserField key snapshot = field key $ \item -> - (needlePrefix teaserSeparator . itemBody) <$> - loadSnapshot (itemIdentifier item) snapshot +teaserField key snapshot = field key $ \item -> do + body <- itemBody <$> loadSnapshot (itemIdentifier item) snapshot + case needlePrefix teaserSeparator body of + Nothing -> fail $ + "Hakyll.Web.Template.Context: no teaser defined for " ++ + show (itemIdentifier item) + Just t -> return t -------------------------------------------------------------------------------- |