From: Dan Allen Date: Sat, 24 Aug 2019 23:20:44 +0000 (-0600) Subject: prepend site path when resolving relative URL if from is undefined or empty X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=6ad0ba6a9ed2104908650429cfb5c0b4094cca70;p=working%2Feg-antora.git prepend site path when resolving relative URL if from is undefined or empty --- diff --git a/src/helpers/relativize.js b/src/helpers/relativize.js index 950703a..76adfa4 100644 --- a/src/helpers/relativize.js +++ b/src/helpers/relativize.js @@ -12,9 +12,10 @@ function relativize (to, ctx) { from = ctx.data.root.page.url } if (!to) return '#' - if (!from || to.charAt() === '#') return to - let hash = '' const hashIdx = to.indexOf('#') + if (!hashIdx) return to + if (!from) return (ctx.data.root.site.path || '') + to + let hash = '' if (~hashIdx) { hash = to.substr(hashIdx) to = to.substr(0, hashIdx)