diff options
Diffstat (limited to 'src/Hakyll/Core/Metadata.hs')
-rw-r--r-- | src/Hakyll/Core/Metadata.hs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Hakyll/Core/Metadata.hs b/src/Hakyll/Core/Metadata.hs index 7902b94..a330636 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,11 @@ 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 = go . takeDirectory . toFilePath where + go "." = [fromFilePath "metadata"] + go dir = fromFilePath (dir </> "metadata") : go (takeDirectory dir) + |