diff options
Diffstat (limited to 'src/Hakyll/Core/Metadata.hs')
-rw-r--r-- | src/Hakyll/Core/Metadata.hs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Hakyll/Core/Metadata.hs b/src/Hakyll/Core/Metadata.hs index 7902b94..a123c18 100644 --- a/src/Hakyll/Core/Metadata.hs +++ b/src/Hakyll/Core/Metadata.hs @@ -5,6 +5,7 @@ module Hakyll.Core.Metadata , getMetadataField , getMetadataField' , makePatternDependency + , metadataFiles ) where @@ -12,6 +13,7 @@ module Hakyll.Core.Metadata import Control.Monad (forM) import Data.Map (Map) import qualified Data.Map as M +import System.FilePath.Posix ((</>), takeDirectory) -------------------------------------------------------------------------------- @@ -61,3 +63,12 @@ makePatternDependency :: MonadMetadata m => Pattern -> m Dependency makePatternDependency pattern = do matches' <- getMatches pattern return $ PatternDependency pattern matches' + +-------------------------------------------------------------------------------- +-- | Returns a list of all directory-wise metadata files, subdir first, global last +metadataFiles :: Identifier -> [Identifier] +metadataFiles identifier = local : go (takeDirectory $ toFilePath identifier) where + go "." = [fromFilePath "metadata"] + go dir = fromFilePath (dir </> "metadata") : go (takeDirectory dir) + local = fromFilePath $ toFilePath identifier ++ ".metadata" + |