diff options
Diffstat (limited to 'reploy.hs')
| -rw-r--r-- | reploy.hs | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -197,10 +197,11 @@ checkedSubstitute t v = do -- | Add global information to page metadata for rendering (at this point just the url base) addGlobalMeta :: Y.Value -> Site MT.Value -addGlobalMeta (Y.Object m) = do +addGlobalMeta meta = do r <- use urlBase rt <- rootedLink' rtp <- rootedPageLink' + Y.Object m <- (`objMerge` meta) <$> use extraMeta let l = map (\(k, v) -> (K.toText k, Mu.toMustache v)) $ KM.toList m pure . Mu.object $ l ++ [ ("root", Mu.toMustache $ T.pack r) @@ -219,17 +220,16 @@ addExtraMeta :: PageInfo -> Y.Value -> Site Y.Value addExtraMeta pi m = do metaPath <- metadataFile $ pi ^. pagePath metaExists <- io $ doesFileExist metaPath - gem <- use extraMeta - objMerge gem <$> - if metaExists - then do - em' <- io $ Y.decodeFileEither metaPath - case em' of - Left pe -> - error $ "decoding " ++ metaPath ++ " failed: " ++ - Y.prettyPrintParseException pe - Right em -> pure $ objMerge em m - else pure m + if metaExists + then do + io $ putStrLn ("M <- " ++ metaPath) + em' <- io $ Y.decodeFileEither metaPath + case em' of + Left pe -> + error $ "decoding " ++ metaPath ++ " failed: " ++ + Y.prettyPrintParseException pe + Right em -> pure $ objMerge em m + else pure m -- | Add page-specific information to the metadata. In this instance, this just -- expands the tags for rendering and continues by adding extra metadata via |
