How can we publish our pages so that all links are relative to the publishing folder? So an index page in the root publishing folder would be referenced as index.html by pages in the root folder and …/index.html by pages one level down. These relative links would allow us to move our pages to other locations without having to change the links. We’d also like the URLs for Assets and others like web_resources to be relative as well.
Hi Tim,
This link might be able to help you achieve what you are looking for:
http://help.percussion.com/how-to/wri…
It outlines how to create a managed link in the HTML Widget for
`````` and ![]()
tags. If a link changes, Percussion will maintain an ID for this link and update its location after the link is renamed or moved.
In regards to your original question, if you use relative links in the HTML Widget, they will remain as relative links. This will apply for assets as well. How are you trying to implement this functionality? I should be able to help from there.
Regards,
Chris W
Hi Chris.
Thanks for the info about the HTML widget. We don’t use it very often but I’m glad to know how to make it more flexible.
My main issue is that published links for assets will be referenced by /Assets, which is fixed to the site root. There are times when we need to take our content and copy it to a site for which we only have access to a sub-folder and folders under it. We can’t write anything to the root folder of this destination site.
So imagine that we are publishing our pages to a site we have control over like this:
/
/Assets
…
/web_resources
…
index
page1
page2
/our_sub_folder
page 3
page 4
If we want to copy our content to an external site like this:
/
/ext_site_folder1
/ext_site_folder2
/our_folder
/Assets
…
/web_resources
…
index
page1
page2
/our_sub_folder
page 3
page 4
… then all of our URLs need to be relative (references to assets in page1 would need to be to Assets/someimage.jpg rather than /Assets/someimage.jpg. Similarly URLs to assets referenced in page3 would need to be …/Assets/someotherimage.jpg.
I suppose if we could publish locally like this then our links would work in the external site. Notice that Assets is a sub folder under our_folder.
/
/our_folder
/Assets
…
/web_resources
…
index
page1
page2
/our_sub_folder
page 3
page 4
Any ideas?
Thanks!
Tim
Any help appreciated.
Hi Tim,
Apologies for the delay in responding to you: unfortunately CM1 can’t publish relative URLs, or publish assets to the same location as the pages. However, I do have two potential solutions: the first would be to add a feature to the product that allows assets to be saved into the Sites folder, so everything is in the same location. The other solution that you could apply right now is to use something like mod_rewrite in Apache to rewrite the assets URLs to the correct location.
I raised the first solution as an Idea here: https://community.percussion.com/t/allow-assets-to-be-placed-into-the-same-location-as-pages/1565 We keep track of all the ideas posted on the community and use them to influence our product roadmap.