XF 2.3 Page Node with HTML / Java Script - Absolute vs Relative Links

philmckrackon

Well-known member
I have a page node with HTML and JS. There are many links but I can only get absolute links to work. I would much rather use relative. Here is a code snippet. Will relative links work? Thanks.

JavaScript:
document.getElementById("lblYear7174").innerHTML= "<a href=\"https://jeep-cj.com/community/wiki/civilian/#-cj5-1972-1975\" target=\"_blank\">" + value + "</a>";
document.getElementById("imgYear7174").innerHTML= "<a href=\"https://jeep-cj.com/community/wiki/civilian/#-cj5-1972-1975\" target=\"_blank\"><img alt=\"CJ-5\" src=\"https://jeep-cj.com/community/attachments/1972cj5-jpg.101721\" height=\"150\" width=\"150\">";

I have tried ./wiki/civilian/#-cj5-1972-1975\ and .wiki/civilian/#-cj5-1972-1975\ but they do not work.
 
Solution
The default routes use {{ link('route/id') }} , e.g. {{ link('posts/123') }} .

I assume you're using a wiki add-on so try {{ link('wiki/civilian/#-cj5-1972-1975') }} .
The default routes use {{ link('route/id') }} , e.g. {{ link('posts/123') }} .

I assume you're using a wiki add-on so try {{ link('wiki/civilian/#-cj5-1972-1975') }} .
Can you actually edit and post one of the lines I posted as a syntax example? I keep receiving a template error.
After many tries I am starting to believe that java script will not work with {{ link('wiki/civilian/#-cj5-1972-1975') }}
 
Last edited:
Back
Top Bottom