fix index URL appending with query strings and hashes, expose the index filename to the template
This commit is contained in:
parent
f95f2bf2f0
commit
0e710215b4
|
@ -181,7 +181,8 @@ processLink base l =
|
||||||
|| take 1 l == "#"
|
|| take 1 l == "#"
|
||||||
then pure l
|
then pure l
|
||||||
else if isAbsolute l
|
else if isAbsolute l
|
||||||
then rootedPageLink l
|
then let (path, rest) = break (`elem` ['?', '#']) l
|
||||||
|
in (<> rest) <$> rootedPageLink path
|
||||||
else installFile (base </> l) >>= rootedLink
|
else installFile (base </> l) >>= rootedLink
|
||||||
|
|
||||||
-- | Conjure a function that finds a displayable name for a page at a particular mount.
|
-- | Conjure a function that finds a displayable name for a page at a particular mount.
|
||||||
|
@ -208,6 +209,8 @@ addGlobalMeta meta = do
|
||||||
rt <- rootedLink'
|
rt <- rootedLink'
|
||||||
rtp <- rootedPageLink'
|
rtp <- rootedPageLink'
|
||||||
pn <- pageName'
|
pn <- pageName'
|
||||||
|
aui <- use appendUrlIndex
|
||||||
|
ifname <- use indexFilename
|
||||||
Y.Object m <- (`objMerge` meta) <$> use extraMeta
|
Y.Object m <- (`objMerge` meta) <$> use extraMeta
|
||||||
let l = map (\(k, v) -> (K.toText k, Mu.toMustache v)) $ KM.toList m
|
let l = map (\(k, v) -> (K.toText k, Mu.toMustache v)) $ KM.toList m
|
||||||
pure . Mu.object
|
pure . Mu.object
|
||||||
|
@ -217,6 +220,7 @@ addGlobalMeta meta = do
|
||||||
, ("pageLink", Mu.overText $ T.pack . rtp . T.unpack)
|
, ("pageLink", Mu.overText $ T.pack . rtp . T.unpack)
|
||||||
, ("pageName", Mu.overText $ T.pack . pn . 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
|
-- | Get the expected timestamp file for a given filepath
|
||||||
metadataFile :: FilePath -> Site FilePath
|
metadataFile :: FilePath -> Site FilePath
|
||||||
|
|
Loading…
Reference in a new issue