Copied to clipboard

Flag this post as spam?

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


  • Mike Livermore 6 posts 26 karma points
    Sep 10, 2009 @ 17:01
    Mike Livermore
    0

    Redirect in href always including current parent path

    I am trying the href links to a different part of the site (redirect) and am having issues in xslt - it always puts the current website/parent nodes/ before any path.  What I want is to eliminate the current /parent nodes/ to leave just the website/ and add the passed in path to the url.  So for example - it is rendering:

    href="localhost/current parent/new node path"

    and what I want is

    href="localhost/new node path"

    Here is the macro code

      <xsl:variable name="urlRedirect" select="/macro/urlClassicRoot"/>

      <xsl:variable name="nodeTypeAlias" select="$currentPage/node[$pos]/@nodeTypeAlias"/>

            <xsl:choose>
              <xsl:when test="$nodeTypeAlias = 'Classic' ">
                <xsl:element name="a">
                  <xsl:attribute name="href">
                    <xsl:value-of select="$urlRedirect"/>
                  </xsl:attribute>
                  <xsl:value-of select="$currentPage/node[$pos]/data [@alias = 'FriendlyName']/text()"/>
                </xsl:element>
              </xsl:when>
              <xsl:otherwise >
                <a href="{umbraco.library:NiceUrl($currentPage/node[$pos]/@id)}">
                  <xsl:value-of select="$currentPage/node[$pos]/data [@alias = 'FriendlyName']/text()"/>
                </a>
              </xsl:otherwise>
            </xsl:choose>

    I tried this using an <a href> instead of <xsl:element> and had no luck there either.

    Any ideas would be greatly appreciated!

    Thanks,

    Mike

  • Ron Brouwer 273 posts 768 karma points
    Sep 10, 2009 @ 17:09
    Ron Brouwer
    0

    I don't know exactly what you want but do you mean that when you click the link generated by    <xsl:value-of select="$urlRedirect"/>
    the problem starts? maybe to simple but it might be just a '/' before the url.

    Ron

  • dandrayne 1138 posts 2262 karma points
    Sep 10, 2009 @ 18:06
    dandrayne
    0

    Perhaps I'm not understanding the question, but if you want a simple redirect add a property to the documentType called

    umbracoRedirect

    with a data type of content picker, then the page will automatically redirect to the node picked using the content picker,

  • Mike Livermore 6 posts 26 karma points
    Sep 11, 2009 @ 23:33
    Mike Livermore
    0

    Thanks so much Ron - that was it!  I can't believe I forgot the "/" at the beginning of the url!

    Thanks guys!

    Mike

  • 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