Fully Qualified URL's

jvienneau's Avatar

jvienneau

11 Feb, 2015 04:57 PM

I'm trying to publish a template for an external application. I would like to use absolute
url's in the navigation. The navigation is created from a data definition using page choosers. The set up is quite large and complex so I will just include a small part of code.

#set($internalLink = $element.getChild('internal-link').getChild('link').text)
<a href="${internalLink}">${_EscapeTool.html($text)}</a>

I would like to do something like this, but the url is deleted on publish.

#set($internalLink = $element.getChild('internal-link').getChild('link').text)
<a href="http://www.domainname.com${internalLink}">${_EscapeTool.html($text)}</a>
  1. 1 Posted by Ryan Griffith on 11 Feb, 2015 07:41 PM

    Ryan Griffith's Avatar

    Hi,

    I'm thinkink that because you are building our the URL dynamically using your Format, you will need to surround the value of the link/path with [system-asset] pseudo tags in order to force Cascade Server to properly track the link.

    When you have a moment, give the following a try:

    #set($internalLink = $element.getChild('internal-link').getChild('link').text)
    <a href="http://www.domainname.com[system-asset]${internalLink}[/system-asset]">${_EscapeTool.html($text)}</a>
    

    Please let me know if you have any questions.

    Thanks!

  2. 2 Posted by jvienneau on 11 Feb, 2015 07:58 PM

    jvienneau's Avatar

    I actually tried this with no success. For example, when I publish out the page as is, the link generated is <a href=“/libr/index.html” />. When using the system asset tag, the same link outputs <a href="/index[/system-asset]” />

  3. 3 Posted by Ryan Griffith on 11 Feb, 2015 08:50 PM

    Ryan Griffith's Avatar

    Thank you for trying out my suggestion, my apologies it did not work out.

    I suspect you may need to append both the domain and the extension in this case, since Cascade is not tracking the link and rewriting it for you. If the page was within a different Site that the calling page, cross-site linking would automatically append the Site URL for you, which would contain the domain information.

    A common workaround to avoid hardcoding the domain information, is to name the Site based on the domain and append the value of the asset's <site> element, along with the http(s):// or // protocol and file extension. For example, you would name your Site www.domainname.com and append that value onto the front of the asset's <path> value:

    #set($path = $element.getChild('internal-link').getChild('path').text)
    #set($site = $element.getChild('internal-link').getChild('site').text)
    <a href="http://${site}${path}.html">${_EscapeTool.html($text)}</a>
    

    On a related note, we have this suggestion on our Idea Exchange that I would recommend voting up if you would like to see this functionality implemented in a future release.

    Please let me know if you have any questions.

    Thanks!

  4. 4 Posted by jvienneau on 11 Feb, 2015 09:33 PM

    jvienneau's Avatar

    Unfortunately this work around will not work for me since I will have a few different sites that will export to different applications. This would result in having the same site name for several sites as well as make it difficult for users to find where to go to edit data. It would be very useful to add the domain at the beginning of links. If you can think of another approach that would be great.

  5. 5 Posted by Penny on 11 Feb, 2015 10:00 PM

    Penny's Avatar

    Can you try doing the following?

    #set($internalLink = "http://www.domainname.com" + $element.getChild('internal-link').getChild('link').text + ".html")
    <a href="${internalLink}">${_EscapeTool.html($text)}</a>
    

    You can change the extension based on your page type.

  6. 6 Posted by jvienneau on 12 Feb, 2015 02:00 PM

    jvienneau's Avatar

    Unfortunately this does not work for me either. The href value for the link is published as “index.html”. Since I have control over the applications this template is exported to, I am fully qualifying the links within the application so I do have a solution. It would be nice to have the links fully qualify on publish for other applications in the future. Thanks for your help.

  7. 7 Posted by Penny on 12 Feb, 2015 02:48 PM

    Penny's Avatar

    I had one more idea for something that may work. Ryan had mentioned that this would not be an issue if they were managed in another site. Another idea would be to name the Output for this configration set something different from your standard output name. So if you use HTML as the Output name in your Configuration Set, you could name these External App.

    The idea behind this being that you can create fully qualified URLs if you do cross-configuration linking.

    You could then link to other assets with

    #set($internalLink = $element.getChild('internal-link').getChild('link').text)
    <a href="[system-asset:configuration=HTML${internalLink}[/system-asset]">${_EscapeTool.html($text)}</a>
    
    This should take the domain from the Destination mapped for the Output on the Content Type that is linked. Of course, you would have to make sure that you mapped the Destination on your Content Type.

    I hope this makes sense. I am happy to clarify.

  8. 8 Posted by jvienneau on 12 Feb, 2015 02:56 PM

    jvienneau's Avatar

    I’ll give this a try. The template is actually published from another site. Could it be I’m missing some piece of information? Somewhere in Cascade should I be entering the full URL? Checking the box “Maintain absolute links when publishing” doesn’t seem to make much of a difference.

  9. 9 Posted by Penny on 12 Feb, 2015 02:58 PM

    Penny's Avatar

    The URL needs to be entered fully qualified in the Site Management panel on that site. So Cascade Server icon > SIte Management

    Click on your sites. The Edit. Fill in the full domains there.

  10. 10 Posted by jvienneau on 12 Feb, 2015 03:35 PM

    jvienneau's Avatar

    We have relative paths set up here since we have multiple destinations(staging server + production). The site is also divided up into separate sites since it’s easier to manage permissions and content since we have quite a large website. Fully qualifying the url here would cause an issue for us. Clicking on a link in the menu on the staging server would send us to the production server so sending a section for review would be problematic.

  11. 11 Posted by Penny on 12 Feb, 2015 03:44 PM

    Penny's Avatar

    I get what you are saying. Yes. That is an unfortunate tradeoff. Using the method that I recommended with system-asset:configuration could still potentially work but may require some effort if you don't have your destinations mapped on your Content Type.

  12. 12 Posted by jvienneau on 12 Feb, 2015 03:47 PM

    jvienneau's Avatar

    Sounds good. I’ll give it a try but for now I think I have a working solution. Thanks again for your help.

  13. Tim closed this discussion on 24 Feb, 2015 03:47 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