aboutsummaryrefslogtreecommitdiff
path: root/reploy.hs
diff options
context:
space:
mode:
authorMiroslav Kratochvil <miroslav.kratochvil@uni.lu>2024-10-14 16:31:05 +0200
committerMiroslav Kratochvil <miroslav.kratochvil@uni.lu>2024-10-14 16:31:05 +0200
commitf12684b07e4b5c0f6b23a6977a61300373aa9ca5 (patch)
treec44be22f2c5f60e9e5cdd5519aede4ea08fc22ed /reploy.hs
parent3ac949329fd17cf21a63dfc0e1a39d9612e54cd6 (diff)
parent541217b03386c50725b8dc01c3de8cac718ab612 (diff)
downloadreploy-f12684b07e4b5c0f6b23a6977a61300373aa9ca5.tar.gz
reploy-f12684b07e4b5c0f6b23a6977a61300373aa9ca5.tar.bz2
Merge branch 'mk-fix-url-appending' into 'master'
fix index URL appending with query strings and hashes, expose the index filename to the template See merge request lcsb/sps/reploy!6
Diffstat (limited to 'reploy.hs')
-rw-r--r--reploy.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/reploy.hs b/reploy.hs
index aab4282..b94046d 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
+ 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
@@ -217,6 +220,9 @@ addGlobalMeta meta = do
, ("pageLink", Mu.overText $ T.pack . rtp . T.unpack)
, ("pageName", Mu.overText $ T.pack . pn . T.unpack)
]
+ ++ (if aui
+ then [("indexFile", Mu.toMustache $ T.pack ifi)]
+ else [])
-- | Get the expected timestamp file for a given filepath
metadataFile :: FilePath -> Site FilePath