From 5d8872a5aa2573605c6ee2c1070c140e37c8083b Mon Sep 17 00:00:00 2001 From: Mirek Kratochvil Date: Wed, 21 Feb 2024 14:27:36 +0100 Subject: [PATCH 1/2] fix index URL appending with query strings and hashes, expose the index filename to the template --- reploy.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/reploy.hs b/reploy.hs index aab4282..c540d5b 100644 --- a/reploy.hs +++ b/reploy.hs @@ -181,7 +181,8 @@ processLink base l = || take 1 l == "#" then pure l else if isAbsolute l - then rootedPageLink l + then let (path, rest) = break (`elem` ['?', '#']) l + in (<> rest) <$> rootedPageLink path else installFile (base l) >>= rootedLink -- | Conjure a function that finds a displayable name for a page at a particular mount. @@ -208,6 +209,8 @@ addGlobalMeta meta = do rt <- rootedLink' rtp <- rootedPageLink' pn <- pageName' + aui <- use appendUrlIndex + ifname <- use indexFilename Y.Object m <- (`objMerge` meta) <$> use extraMeta let l = map (\(k, v) -> (K.toText k, Mu.toMustache v)) $ KM.toList m pure . Mu.object @@ -217,6 +220,7 @@ addGlobalMeta meta = do , ("pageLink", Mu.overText $ T.pack . rtp . T.unpack) , ("pageName", Mu.overText $ T.pack . pn . T.unpack) ] + ++ (if aui then [("indexFilename", Mu.toMustache $ T.pack ifname )] else []) -- | Get the expected timestamp file for a given filepath metadataFile :: FilePath -> Site FilePath From 541217b03386c50725b8dc01c3de8cac718ab612 Mon Sep 17 00:00:00 2001 From: Mirek Kratochvil Date: Mon, 14 Oct 2024 14:10:16 +0200 Subject: [PATCH 2/2] some fixes --- pages/index.md | 2 ++ reploy.hs | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pages/index.md b/pages/index.md index 5fedf2c..b543ec2 100644 --- a/pages/index.md +++ b/pages/index.md @@ -10,3 +10,5 @@ timestamp: null # Well hello there This site is empty, you can start populating it! + +[link test](/?link-test) diff --git a/reploy.hs b/reploy.hs index c540d5b..b94046d 100644 --- a/reploy.hs +++ b/reploy.hs @@ -210,7 +210,7 @@ addGlobalMeta meta = do rtp <- rootedPageLink' pn <- pageName' aui <- use appendUrlIndex - ifname <- use indexFilename + ifi <- use indexFile Y.Object m <- (`objMerge` meta) <$> use extraMeta let l = map (\(k, v) -> (K.toText k, Mu.toMustache v)) $ KM.toList m pure . Mu.object @@ -220,7 +220,9 @@ addGlobalMeta meta = do , ("pageLink", Mu.overText $ T.pack . rtp . T.unpack) , ("pageName", Mu.overText $ T.pack . pn . T.unpack) ] - ++ (if aui then [("indexFilename", Mu.toMustache $ T.pack ifname )] else []) + ++ (if aui + then [("indexFile", Mu.toMustache $ T.pack ifi)] + else []) -- | Get the expected timestamp file for a given filepath metadataFile :: FilePath -> Site FilePath