relative paths dont work when publishing

latorresescobedo's Avatar

latorresescobedo

13 May, 2016 03:00 PM

After publishing my site thru sftp:
My folder structure on cascade looks like this:
base:
_files/home/inlinescripts.js
_internalFiles/pages/home.html

on my template (page.html uses it) I have the following:

<script src="/_files/home/inLineScripts.js"></script>
after publishing my home.html becomes:
<script src="../../_files/home/inLineScripts.js"></script>

If I try to open the published file I get a not found error:

_internal/pages/_files/home/inLineScripts.js Failed to load resource: the server responded with a status of 404 (Not Found)

How can I make fix the paths when publishing?

  1. 1 Posted by Ryan Griffith on 13 May, 2016 04:13 PM

    Ryan Griffith's Avatar

    Hi,

    Be default, all internal links will be written as relative when publishing pages and files; unless those links are pointing to an asset within a different Site.

    If you need to publish using absolute links, edit the page or file, click the System pane, and check the Maintain Absolute Links option.

    Note: this is a per-asset option, so you would need to ensure this option is enabled for each page or file that needs absolute links.

    That being said, relative links for style and script resources should work; the absolute option is usually necessary for subdomains or server-side includes. Perhaps there is a permission or configuration issue on the web server itself that is preventing the file from being served to the browser.

    Please let me know if you have any questions.

    Thanks!

  2. 2 Posted by latorresescobed... on 13 May, 2016 04:15 PM

    latorresescobedo's Avatar

    thanks for the reply, although my error was a hidden base tag in the layout. Everything is working now.

  3. 3 Posted by Ryan Griffith on 13 May, 2016 05:02 PM

    Ryan Griffith's Avatar

    Not a problem at all, thank you for following up. I am glad to hear you were able to track down the issue.

    Have a great day!

  4. Ryan Griffith closed this discussion on 13 May, 2016 05:02 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac