Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Keith Jackson 183 posts 552 karma points
    Jun 02, 2011 @ 11:00
    Keith Jackson
    0

    Finding A Nice home in France (but keep going to England...)

    I'm building a multilingual site in Umbraco 4.7 with an English and French site.

    I don't have separate hostnames (not an option) so I am differentiating using the 'umbracoHideTopLevelNodeFromPath' = false option in web.config.

    The problem that I have is that the top level navigation macro (Which is a slightly altered version from one of the starter kits) navigates home to '/' rather than to '/english/' or '/french/'.

    Here's the XSLT that I have so far. Can anyone indicate what I would need to do to adapt it to go to the correct home page?

        <xsl:output method="xml" omit-xml-declaration="yes" />

        <xsl:param name="currentPage"/>

        <!-- Input the documenttype you want here -->
        <xsl:variable name="level" select="1"/>
        <xsl:template match="/">

          
     <ul id="topNavigation">
           <li class="home">
             <xsl:if test="$currentPage/@id = $currentPage/ancestor-or-self::* [@level=$level]/@id">
                 <xsl:attribute name="class">home current</xsl:attribute>
             </xsl:if>
             <a>
               <xsl:attribute name="href">/</xsl:attribute>
               <xsl:value-of select="umbraco.library:GetDictionaryItem('Home Text')"/>
             </a>
           </li>
          <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
      <li>
         <xsl:if test="@id = $currentPage/@id">
            <xsl:attribute name="class">current</xsl:attribute>
          </xsl:if>
        <a class="navigation" href="{umbraco.library:NiceUrl(@id)}">
          <span><xsl:value-of select="@nodeName"/></span>
        </a>
      </li>
      
      
    </xsl:for-each>
    </ul>

        </xsl:template>

  • Keith Jackson 183 posts 552 karma points
    Jun 02, 2011 @ 11:17
    Keith Jackson
    0

    I managed to suss this one out. Here's my solution...

     <ul id="topNavigation">
           <li class="home">
             <xsl:if test="$currentPage/@id = $currentPage/ancestor-or-self::* [@level=$level]/@id">
                 <xsl:attribute name="class">home current</xsl:attribute>
             </xsl:if>
             <a href="{umbraco.library:NiceUrl($currentPage/ancestor-or-self::* [@level=1]/@id)}">
               <xsl:value-of select="umbraco.library:GetDictionaryItem('Home Text')"/>
             </a>
           </li>
          <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
      <li>
         <xsl:if test="@id = $currentPage/@id">
            <xsl:attribute name="class">current</xsl:attribute>
          </xsl:if>
        <a class="navigation" href="{umbraco.library:NiceUrl(@id)}">
          <span><xsl:value-of select="@nodeName"/></span>
        </a>
      </li>
    </xsl:for-each>
    </ul>

    I replaced the href attribute on the home a tag with the following, forcing the return of the URL from the ancestor (the site root for the language...

    <href="{umbraco.library:NiceUrl($currentPage/ancestor-or-self::* [@level=1]/@id)}">

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies