Copied to clipboard

Flag this post as spam?

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


  • Jim Lesinski 32 posts 54 karma points
    Mar 09, 2011 @ 22:19
    Jim Lesinski
    0

    Create a document type that just links to another node

    Hello, I currently have a redirect type page set up which uses a content picker to set the umbracoRedirect property. This works well and allows me to create a page which shows up in menu's properly, while still linking to another location within a site.

    However, I am wondering if there is a better way to do this? I want to be able to categorize my menu in a slightly different way than the page structure, but I am concerned that using umbracoRedirect is causing alot of unnecessary redirects which may be "frowned upon" by search engines. 

    I appreciate your thoughts and suggestions. 

    Thanks!
    Jim

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Mar 09, 2011 @ 22:50
    Tom Fulton
    0

    Hi Jim,

    I also do this frequently, but instead handle the redirect logic in my menu, so no redirects are needed.  I typically create a special doctype called something like "Navigation Link / Pointer" and use uComponents URL Picker so the user can external/internal/media links.

    Here's a quick XSLT snippet:

    <li>
          <a href="{umbraco.library:NiceUrl(@id)}">
            <xsl:if test="name() = 'NavigationMenuLinkPointer'">
              <xsl:attribute name="href">
                <xsl:call-template name="get-url-picker-link">
                  <xsl:with-param name="linkXml" select="./linkTo"/>
                </xsl:call-template>
              </xsl:attribute>
              <xsl:if test="string(./linkTo/url-picker/new-window) = 'True'">
                <xsl:attribute name="target">_blank</xsl:attribute>
              </xsl:if>
            </xsl:if>
            
            <xsl:value-of select="@nodeName"/>
          </a>
    </li>
    <xsl:template name="get-url-picker-link">
      <xsl:param name="linkXml"/>
        <xsl:choose>
          <xsl:when test="$linkXml/url-picker/@mode = 'URL'">
            <xsl:value-of select="$linkXml/url-picker/url"/>
          </xsl:when>
          <xsl:when test="$linkXml/url-picker/@mode= 'Content'">
            <xsl:value-of select="umbraco.library:NiceUrl($linkXml/url-picker/node-id)"/>
          </xsl:when>
          <xsl:when test="$linkXml/url-picker/@mode = 'Media'">
            <xsl:value-of select="umbraco.library:GetMedia($linkXml/url-picker/node-id,false())/umbracoFile"/>
          </xsl:when>
          <xsl:when test="$linkXml/url-picker/@mode = 'Upload'">
            <xsl:value-of select="$linkXml/url-picker/url"/>
          </xsl:when>         
          <xsl:otherwise>/</xsl:otherwise>
        </xsl:choose>
    </xsl:template>

    Of course it might be a bit more work because you have to account for this in all your Navigation macros, but in my opinion is cleaner than doing redirects.

    Hope this helps,

    Tom

  • Jim Lesinski 32 posts 54 karma points
    Mar 14, 2011 @ 19:53
    Jim Lesinski
    0

    Hey Tom - Nice solution! I was thinking this would be one way to do it but wanted to make sure there wasn't a built in umbraco property. Thanks!

Please Sign in or register to post replies

Write your reply to:

Draft