scheme relative uris

mdcarter's Avatar

mdcarter

01 Jul, 2010 06:59 PM

I am trying to make our template more flexible using scheme relative uris to allow content to load over http or https relative to the loading page's protocol.

Rather than hard coding our centralized common files as http or https such as:

<link href="http://centralized.server.edu/css/styles.css" media="screen" rel="stylesheet" type="text/css"/>
<img src="http://centralized.server.edu/images/important-image.jpg" alt="important image" />

I want to use scheme relative uris such as:

<link href="//centralized.server.edu/css/styles.css" media="screen" rel="stylesheet" type="text/css"/>
<img src="//centralized.server.edu/images/important-image.jpg alt="important image" />

I have no problems creating these relative uris manually outside of cascade and things work perfectly. However, in Cascade it seems to be stripping one of the leading slashes and generating uris like the following:

<link href="/centralized.server.edu/css/styles.css" media="screen" rel="stylesheet" type="text/css"/>
<img src="/centralized.server.edu/images/important-image.jpg alt="important image" />

Since these are uris relative to the site root they do not load the appropriate content from the centralized content server. The content blocks that contain the uris are xhtml, xml, or text blocks. The slashes stay intact in the content block itself. However, when they are rendered into either a preview or a published page the one of the leading slashes is removed.

Is this an expected behavior of Cascade? Is their a possible workaround?

thanks

-m@

  1. Support Staff 1 Posted by Tim on 06 Jul, 2010 02:01 PM

    Tim's Avatar

    Interesting. I don't think I've seen this done before. One thing you could try is to change the Site URL for your centralized site to be //centralized.server.edu. Then, when you link from other Sites to files on this Site, use the cross-site linking notation (ie, site://<sitename>/path/to/asset/in/site).

    Let me know if this does the trick.

  2. 2 Posted by mdcarter on 10 Jul, 2010 04:04 AM

    mdcarter's Avatar

    My initial tests to use cross site linking where problematic due to the way we deliver our CSS files and some scripts. The CSS items need to be referenced as absolute URLs with the blocks. Our CSS is compiled and compress and then delivered via php so using a Site URL is problematic in that it won't allow for proper rendering in Cascade. While ultimately the published files may behave correctly the impact it has in Cascade itself make the solution unusable.

    I am curious to the root cause of the slash being stripped and what might be the function within cascade that strips it. I have done some basic tests with tidy and have not found it to strip the slash.

  3. 3 Posted by Joel on 21 Jul, 2010 02:07 PM

    Joel's Avatar

    Hi,

    What version of Cascade is your organization running? We've tried reproducing the reported behavior but the content rendered inside Cascade still has // in the links. Could you also attach your Template?

    Try using system-view:internal and system-view:external tags to work around this problem and still have the CSS render inside Cascade by using regular /path/to/css/file hrefs in your CSS includes (this may not be possible however as we do not know the exact integration structure of your site, but this would require that the CSS file is valid inside Cascade) inside system-view:internal and then use system-view:external for the paths like //host.com/path/to/css.

    As for your question, I don't believe Cascade Server handles protocol relative links at all. The fact that the leading '/' is being removed is just a function of Cascade not expecting a link like "//host/path/to/file".

    Thanks!

  4. Tim closed this discussion on 06 Aug, 2010 02:52 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