Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wiki-js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
wiki-js
Commits
edd11cd7
Commit
edd11cd7
authored
Jan 02, 2020
by
NGPixel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: make relative links root absolute option
parent
661b6044
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
definition.yml
server/modules/rendering/html-core/definition.yml
+7
-1
renderer.js
server/modules/rendering/html-core/renderer.js
+10
-2
No files found.
server/modules/rendering/html-core/definition.yml
View file @
edd11cd7
...
...
@@ -5,4 +5,10 @@ author: requarks.io
input
:
html
output
:
html
icon
:
mdi-language-html5
props
:
{}
props
:
absoluteLinks
:
type
:
Boolean
default
:
false
title
:
Treat relative links as root absolute
hint
:
For example, a link to foo/bar on page xyz will render as /foo/bar instead of /xyz/foo/bar.
order
:
1
server/modules/rendering/html-core/renderer.js
View file @
edd11cd7
...
...
@@ -69,7 +69,11 @@ module.exports = {
if
(
WIKI
.
config
.
lang
.
namespacing
)
{
// -> Reformat paths
if
(
href
.
indexOf
(
'/'
)
!==
0
)
{
href
=
(
this
.
page
.
path
===
'home'
)
?
`/
${
this
.
page
.
localeCode
}
/
${
href
}
`
:
`/
${
this
.
page
.
localeCode
}
/
${
this
.
page
.
path
}
/
${
href
}
`
if
(
this
.
config
.
absoluteLinks
)
{
href
=
`/
${
this
.
page
.
localeCode
}
/
${
href
}
`
}
else
{
href
=
(
this
.
page
.
path
===
'home'
)
?
`/
${
this
.
page
.
localeCode
}
/
${
href
}
`
:
`/
${
this
.
page
.
localeCode
}
/
${
this
.
page
.
path
}
/
${
href
}
`
}
}
else
if
(
href
.
charAt
(
3
)
!==
'/'
)
{
href
=
`/
${
this
.
page
.
localeCode
}${
href
}
`
}
...
...
@@ -83,7 +87,11 @@ module.exports = {
}
else
{
// -> Reformat paths
if
(
href
.
indexOf
(
'/'
)
!==
0
)
{
href
=
(
this
.
page
.
path
===
'home'
)
?
`/
${
href
}
`
:
`/
${
this
.
page
.
path
}
/
${
href
}
`
if
(
this
.
config
.
absoluteLinks
)
{
href
=
`/
${
href
}
`
}
else
{
href
=
(
this
.
page
.
path
===
'home'
)
?
`/
${
href
}
`
:
`/
${
this
.
page
.
path
}
/
${
href
}
`
}
}
try
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment