@@ -21,6 +21,7 @@ module Hakyll.Web.Template.Context
2121 , dateField
2222 , dateFieldWith
2323 , getItemUTC
24+ , getItemModificationTime
2425 , modificationTimeField
2526 , modificationTimeFieldWith
2627 , teaserField
@@ -295,6 +296,17 @@ getItemUTC locale id' = do
295296 ]
296297
297298
299+--------------------------------------------------------------------------------
300+-- | Get the time on which the actual file was last modified. This only works if
301+-- there actually is an underlying file, of couse.
302+getItemModificationTime
303+ :: Identifier
304+ -> Compiler UTCTime
305+getItemModificationTime identifier = do
306+ provider <- compilerProvider <$> compilerAsk
307+ return $ resourceModificationTime provider identifier
308+
309+
298310--------------------------------------------------------------------------------
299311modificationTimeField :: String -- ^ Key
300312 -> String -- ^ Format
@@ -308,8 +320,7 @@ modificationTimeFieldWith :: TimeLocale -- ^ Time output locale
308320 -> String -- ^ Format
309321 -> Context a -- ^ Resulting context
310322modificationTimeFieldWith locale key fmt = field key $ \i -> do
311− provider <- compilerProvider <$> compilerAsk
312− let mtime = resourceModificationTime provider $ itemIdentifier i
323+ mtime <- getItemModificationTime $ itemIdentifier i
313324 return $ formatTime locale fmt mtime
314325
315326