aboutsummaryrefslogtreecommitdiff
path: root/reploy.hs
diff options
context:
space:
mode:
authorMirek Kratochvil <miroslav.kratochvil@uni.lu>2024-02-21 14:27:36 +0100
committerMirek Kratochvil <miroslav.kratochvil@uni.lu>2024-02-21 15:00:27 +0100
commit5d8872a5aa2573605c6ee2c1070c140e37c8083b (patch)
tree5e94c20f1f1172d1d56fb12975796cad46bf57ad /reploy.hs
parent3ac949329fd17cf21a63dfc0e1a39d9612e54cd6 (diff)
downloadreploy-5d8872a5aa2573605c6ee2c1070c140e37c8083b.tar.gz
reploy-5d8872a5aa2573605c6ee2c1070c140e37c8083b.tar.bz2
fix index URL appending with query strings and hashes, expose the index filename to the template
Diffstat (limited to 'reploy.hs')
-rw-r--r--reploy.hs6
1 files changed, 5 insertions, 1 deletions
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