system-asset tag issue

Adam's Avatar

Adam

12 Aug, 2016 07:10 PM

Hi,

I have a block that contains a bunch of html link elements (for css files), and it's added to the head of all pages in a site through a template region. I have all the links using the site path, however I also need it to have the site's destination as well. For example, I have a link like so:

<system-xml>  
    <link href="/path/to/asset.css" rel="stylesheet" />
</system-xml>

I need to append the site destination to the beginning of every link in the block, like so:

<system-xml>  
    <link href="/parent/folder/path/then/path/to/asset.css" rel="stylesheet" />
</system-xml>

I know the [system-asset] tag does this, however it doesn't seem to work when I have the block inside the site I have the links pointing to. Is there any way around this issue, or will I need to hard code all the links?

Thanks!

  1. Support Staff 1 Posted by Tim on 12 Aug, 2016 08:55 PM

    Tim's Avatar

    Hi Adam,

    Are you just looking for an absolute link as opposed to a relative one? If so, try editing one of your Pages containing these links and click on the System pane. Under it, check the 'Maintain absolute links when publishing' check box and then click Submit.

    Then, try publishing that Page and let me know if those types of links are what you're looking for.

    Thanks

  2. 2 Posted by Adam on 12 Aug, 2016 09:05 PM

    Adam's Avatar

    Thanks for the quick reply Tim!

    I have tried what you suggested, however it's outputing:

    <system-xml>  
        <link href="http://domain.com/path/to/asset.css" rel="stylesheet" />
    </system-xml>
    

    instead of:

    <system-xml>  
        <link href="http://domain.com/parent/folder/path/then/path/to/asset.css" rel="stylesheet" />
    </system-xml>
    
  3. Support Staff 3 Posted by Tim on 12 Aug, 2016 09:10 PM

    Tim's Avatar

    Ah, OK. It sounds like this feature describes the functionality you're looking for. Can you confirm?

    If that is indeed the case, I do think you'll need to hard code those values.

    Let me know.

    Thanks

  4. 4 Posted by Adam on 15 Aug, 2016 12:17 PM

    Adam's Avatar

    Yeah, unfortunately, that's the functionality I was looking for. I've hardcoded all the links, however because of that, none of the css renders inside cascade. I have tried this:

    <system-xml>  
        <link href="[system-view:external]/parent/folder/path/then[/system-view:external]/path/to/asset.css" rel="stylesheet"/>
    </system-xml>
    

    However it doesn't appear to work, does the [system-view] tag not work inside an href?
    Thanks!

  5. Support Staff 5 Posted by Tim on 15 Aug, 2016 01:21 PM

    Tim's Avatar

    For the CSS to work inside Cascade, you can use a combination of both tags. For example, try something like this:

    <system-xml>
    [system-view:external] <link href="/parent/folder/path/then/path/to/asset.css" rel="stylesheet"/> [/system-view:external] [system-view:internal] <link href="/path/to/asset.css" rel="stylesheet"/> [/system-view:internal] </system-xml>
    This should force the system to use the normal rewriting process internally, but use your fully qualified path once published.

    Give that a shot and let me know if it helps.

    Thanks!

  6. 6 Posted by Adam on 15 Aug, 2016 03:02 PM

    Adam's Avatar

    I knew that was possible, and it does works. I was hoping I wouldn't have to have two links for each css file, but that seems like the only way to get the css to render inside cascade and on the server.

    Thanks for the help Tim!

  7. Support Staff 7 Posted by Tim on 15 Aug, 2016 03:03 PM

    Tim's Avatar

    You bet, Adam! Have a good one.

  8. Tim closed this discussion on 15 Aug, 2016 03:03 PM.

Discussions are closed to public comments.
If you need help with Cascade CMS please start a new discussion.

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

 

26 Aug, 2016 01:19 PM
25 Aug, 2016 03:02 PM
25 Aug, 2016 12:50 PM
24 Aug, 2016 08:43 PM
24 Aug, 2016 07:20 PM
21 Aug, 2016 01:20 PM