projects
/
eg-antora.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
498aed4
)
prepend site path when resolving relative URL if from is undefined or empty
author
Dan Allen
<dan@opendevise.com>
Sat, 24 Aug 2019 23:20:44 +0000
(17:20 -0600)
committer
Dan Allen
<dan@opendevise.com>
Wed, 28 Aug 2019 07:39:46 +0000
(
01:39
-0600)
src/helpers/relativize.js
patch
|
blob
|
history
diff --git
a/src/helpers/relativize.js
b/src/helpers/relativize.js
index
950703a
..
76adfa4
100644
(file)
--- 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)