Copied to clipboard

Flag this post as spam?

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


  • MartinB 411 posts 512 karma points
    Jan 24, 2011 @ 18:48
    MartinB
    0

    Duplicate content? My page exists both with nodeId and normal .aspx extension

    Hi there

    On a clients site i can see that Google indexes the nodeId of a given page, but also (in some cases) the normal url (mysite.com/this-is-a-page.aspx).

    I'd like that Google indexed the site by "normal" url, as we are implementing SEO in these names.

    Is there any way to stop the indexing of the node ids? If not, is it causing duplicate content issues? I can't really find anything useful on this subject in the forums :/

    Here's the XSLT is used to run through the articles on the frontpage. I wonder if that has anything to do with the IDs getting indexed:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxml="urn:schemas-microsoft-com:xslt"
    xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
    exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">

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

    <xsl:param name="currentPage"/>

    <xsl:variable name="itemsPerPage" select="5"/>
    <xsl:variable name="numberOfItems" select="count(umbraco.library:GetXmlNodeById(2343)/node [string(data [@alias='umbracoNaviHide']) != '1'])"/>

    <xsl:variable name="pageNumber">
    <xsl:choose>
    <xsl:when test="umbraco.library:RequestQueryString('page') = ''">
    <xsl:value-of select="1"/>
    </xsl:when>
    <xsl:otherwise>
    <xsl:value-of select="umbraco.library:RequestQueryString('page')"/>
    </xsl:otherwise>
    </xsl:choose>
    </xsl:variable>

    <xsl:template match="/">

    <div class="paginationContainer">
    <xsl:if test="$pageNumber &gt; 1">
    <a href="?page={$pageNumber -1}">Forrige side</a>
    </xsl:if>

    <xsl:call-template name="for.loop">
    <xsl:with-param name="i">1</xsl:with-param>
    <xsl:with-param name="count" select="ceiling($numberOfItems div $itemsPerPage)"></xsl:with-param>
    </xsl:call-template>

    <xsl:if test="(($pageNumber) * $itemsPerPage) &lt; ($numberOfItems)">
    <a href="?page={$pageNumber +1}">Næste side</a>
    </xsl:if>
    </div>

    <!-- The fun starts here -->

    <xsl:for-each select="umbraco.library:GetXmlNodeById(2343)/node">
    <xsl:sort select="@sortOrder" data-type="number" order="descending" />
    <xsl:if test="position() &gt; $itemsPerPage * number($pageNumber -1) and position() &lt;= number($itemsPerPage * number($pageNumber -1) + $itemsPerPage)">

    <div class="mdNewsContainer">
    <!-- get first photo thumbnail -->
    <div class="mdImageContainer">
    <a href="{data [@alias = 'mdLink']}" class="newsLink" title="{data [@alias = 'mdLinkText']}" target="{data [@alias = 'mdLinkMethod']}" >
    <img src="/umbraco/imagegen.ashx?image={umbraco.library:GetMedia(data [@alias = 'mdImage'],0)/data[@alias = 'umbracoFile']}&amp;width=125&amp;height=87&amp;pad=true" class="MDnewsImage" alt="{data [@alias = 'soldHeader']}" />
    </a>
    </div>
    <div class="mdTextContainer">
    <h2><xsl:value-of select="data [@alias = 'mdHeader']"/></h2>
    <xsl:value-of select="data [@alias = 'mdText']" disable-output-escaping="yes" />
    <xsl:if test="string(data [@alias = 'mdLink']) != '' ">
    <a href="{umbraco.library:NiceUrl(data [@alias = 'mdLink'])}" class="newsLink" title="{data [@alias = 'mdLinkText']}" target="_self" > <xsl:value-of select="data [@alias = 'mdLinkText']" /> </a>
    </xsl:if>
    </div>
    <div class="clear"><xsl:comment/></div>
    </div>
    </xsl:if>
    </xsl:for-each>

    <div class="paginationContainer">
    <xsl:if test="$pageNumber &gt; 1">
    <a href="?page={$pageNumber -1}">Forrige side</a>
    </xsl:if>

    <xsl:call-template name="for.loop">
    <xsl:with-param name="i">1</xsl:with-param>
    <xsl:with-param name="count" select="ceiling($numberOfItems div $itemsPerPage)"></xsl:with-param>
    </xsl:call-template>

    <xsl:if test="(($pageNumber) * $itemsPerPage) &lt; ($numberOfItems)">
    <a href="?page={$pageNumber +1}">Næste side</a>
    </xsl:if>
    </div>

    </xsl:template>

    <xsl:template name="for.loop">
    <xsl:param name="i"/>
    <xsl:param name="count"/>

    <xsl:if test="$i &lt;= $count">
    <xsl:if test="$pageNumber != $i">
    <a href="?page={$i}">
    <xsl:value-of select="$i" />
    </a>
    </xsl:if>

    <xsl:if test="$pageNumber = $i ">
    <xsl:value-of select="$i" />
    </xsl:if>

    <xsl:call-template name="for.loop">
    <xsl:with-param name="i" select="$i + 1" />
    <xsl:with-param name="count" select="$count">
    </xsl:with-param>
    </xsl:call-template>
    </xsl:if>
    </xsl:template>

    </xsl:stylesheet>

     

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Jan 24, 2011 @ 18:55
    Sebastiaan Janssen
    1

    There must be some html in your site that points to the nodeId's instead of the niceUrl. I would recommend add a rule to your urlRewriting.config that catches 4 digits(.aspx) and redirect them a proper 404 page.

  • MartinB 411 posts 512 karma points
    Jan 24, 2011 @ 19:07
    MartinB
    0

    Hi Sebastiaan

    Well, in the xslt it points both to the niceUrl (Niceurl part ) and nodeId:

    <a href="{data [@alias = 'mdLink']}"

    Would that be it? It seems it's only the Articles on the site has this issue, so i guess that could be a valid reason :/

  • MartinB 411 posts 512 karma points
    Jan 24, 2011 @ 19:30
    MartinB
    0

    Besides that, are you able to show an example of how to redirect with the 4 digit rule it sounds like something i could use in other projects.

    Your help is much appreciated!

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Jan 24, 2011 @ 20:20
    Sebastiaan Janssen
    1

    Yes, that does seem to be your problem, simply change it to:

    <a href="{umbraco.library:NiceUrl(data [@alias = 'mdLink'])}"


    and you should be fine.

    The rewrite rule should look something like this:

        <add name="contentidrewrite"
          virtualUrl="^~/([0-9]{4})/?(.*)"
          rewriteUrlParameter="ExcludeFromClientQueryString"
          destinationUrl="~/My404Page.aspx"
          redirectMode="Permanent"
          ignoreCase="true" />  

    Unfortunately, it's not possible to use urlRewriting to raise a 404 error header, so you'd have to do this in "My404Page.aspx".

  • MartinB 411 posts 512 karma points
    Jan 24, 2011 @ 21:14
    MartinB
    0

    Hi Sebastiaan

    Cool - Thanks.

    I made a little when/otherwise workaround as the link only needs to be there around the image in case mdLink contains a value.

    Have a nice evening.

Please Sign in or register to post replies

Write your reply to:

Draft