Publishing relative links when the base site url contains a folder

johnvinebti's Avatar

johnvinebti

29 Jan, 2015 06:21 PM

We have a client that has multiple cascade sites publishing to the same url, but within different root folders (www.domain.com/site1, www.domain.com/site2, www.domain.com/site3) and when a link in a WYSIWYG is published it only includes the cascade site's path from the site root, which doesn't include 'site1', 'site2', 'site3', etc. I tried adding the following to the format, but it causes a broken link error during the publish, and somehow defaults to what should normally be the relative path to the asset:

<xsl:template match="node()|@*">
<!-- Copy attributes and elements without changing them -->
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="a/@href">
<xsl:variable name="currentLink" select="."/>
<xsl:variable name="rooPath" select="'/extra/'"/>
<xsl:attribute name="href">
<xsl:value-of select="concat('/extra/', $currentLink)"/>
</xsl:attribute>
</xsl:template>

Is there a way for me to tack on the site's root folder, or even the entire site domain (as if it was a cross site link) without moving the asset and what it links to into seperate sites?

  1. 1 Posted by Ryan Griffith on 30 Jan, 2015 02:55 PM

    Ryan Griffith's Avatar

    Hi John,

    You shouldn't need to worry about this issue if we're dealing with cross-site links, so it sounds as though these Sites may need some tweaking. How are each of these Sites set up? That is, what is their Site URL and what does the top level folder structure look like (feel free to attach a screenshot of this)? What do the Destinations look like as far as what directory they are publishing to?

    Please let me know if you have any questions.

    Thanks!

  2. 2 Posted by johnvinebti on 30 Jan, 2015 07:08 PM

    johnvinebti's Avatar

    Each site is actually just a sub-folder of a single site. The site URLs are: www.domain.com/site1, www.domain.com/site2, www.domain.com/site3 but "site1", "site2", and "site3" folders don't existing in each cascade site. The destinations for each point to the site1, site2, and site3 folders, and everything publishes properly. The issue isn't even with cross site links, because those all get prepended with the url for the site they point to. Linking within the site however is what is becoming the problem. We're trying to create shared assets that can be included on multiple pages without having the content exist on all those pages, and since the assets can be included all over the site we can't use relative paths the relative path from the location the shared asset publishes to might not be correct for the page it then gets included on. The problem with using absolute links, is that when cascade publishes an asset that links to "widgets" folder in site1, the absolute path is "/widgets..." instead of "/site1/widgets...". so I added the logic above to find those links, and prepend the site folder, in this case "extra" but it creates a broken link.

  3. 3 Posted by Ryan Griffith on 04 Mar, 2015 09:01 PM

    Ryan Griffith's Avatar

    Hi John,

    My apologies for such a delayed response to your discussion.

    I wanted to follow up to see if you had a chance to resolve your linking issue. If not, I was trying to picture how you have your "sites" and Destinations set up, but I'm not sure if I'm following correctly. Starting at the Site's base folder, do you have a folder for each sub-site? For example:

    - Base Folder
    -- site1
    -- site2
    -- site3
    

    If so, can you describe in more detail what you mean by the following:

    The site URLs are: www.domain.com/site1, www.domain.com/site2, www.domain.com/site3 but "site1", "site2", and "site3" folders don't existing in each cascade site. The destinations for each point to the site1, site2, and site3 folders, and everything publishes properly.

    Thanks!

  4. Ryan Griffith closed this discussion on 11 Mar, 2015 07:24 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