summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGabriel Aumala <gabrielfima@live.com>2018-09-30 14:38:57 -0500
committerJasper Van der Jeugt <jaspervdj@gmail.com>2018-10-02 11:05:52 -0400
commitc85198d8cb6ce055c788e287c7f2470eac0aad36 (patch)
tree082fdd0e820e33ee66f8936206467a9151eaa885 /lib
parentda52a2aabfdbc83693574b192ed75c252d12b972 (diff)
downloadhakyll-c85198d8cb6ce055c788e287c7f2470eac0aad36.tar.gz
Drop extension when parsing dates in filepaths
Drop the file extension when parsing the date from the filepath of a resource.
Diffstat (limited to 'lib')
-rw-r--r--lib/Hakyll/Web/Template/Context.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Hakyll/Web/Template/Context.hs b/lib/Hakyll/Web/Template/Context.hs
index dae241c..0d71386 100644
--- a/lib/Hakyll/Web/Template/Context.hs
+++ b/lib/Hakyll/Web/Template/Context.hs
@@ -50,7 +50,7 @@ import Hakyll.Core.Metadata
import Hakyll.Core.Provider
import Hakyll.Core.Util.String (needlePrefix, splitAll)
import Hakyll.Web.Html
-import System.FilePath (splitDirectories, takeBaseName)
+import System.FilePath (splitDirectories, takeBaseName, dropExtension)
--------------------------------------------------------------------------------
@@ -300,7 +300,7 @@ getItemUTC :: MonadMetadata m
getItemUTC locale id' = do
metadata <- getMetadata id'
let tryField k fmt = lookupString k metadata >>= parseTime' fmt
- paths = splitDirectories $ toFilePath id'
+ paths = splitDirectories $ (dropExtension . toFilePath) id'
maybe empty' return $ msum $
[tryField "published" fmt | fmt <- formats] ++