diff options
Diffstat (limited to 'src/Hakyll/Web/Template/Context.hs')
-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 -------------------------------------------------------------------------------- |