Copied to clipboard

Flag this post as spam?

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


  • Garrett Nafzinger 2 posts 72 karma points
    Nov 30, 2017 @ 17:27
    Garrett Nafzinger
    0

    Umbraco URL Alias creates SEO duplicate content & web analytics tracking issues

    Our content staff began using URL Alias in Umbraco to create vanity/short URLs for our web content.

    I didn't realize this was occurring and it was causing problems until someone asked me for reporting on a few web pages.

    There are two issues with the way this works in Umbraco. Both the original URL, https://www.website.com/url/to/page/ and the vanity URL, https://www.website.com/urltopage/ respond with the same content with an HTTP status of 200.

    1. This causes issues in Google Analytics because a single page could show up twice in the reporting with different URLs.
    2. This causes issues with SEO because Google is pretty good about finding any URL that is out there on the web. Since both of these pages respond at different URLs with the exact same content, Google and search engines are going to have issues thinking this is duplicate content.

    It would be nice to manage vanity URLs in Umbraco, via the URL Alias field, however the correct way to do this would be to 301 redirect the vanity URL to the full URL. Maybe the Umbraco URL Aliases could be added to a web.config file and activated on a nightly basis.

    Any other thoughts on how to handle this?

    Garrett

  • Marc Goodson 2155 posts 14406 karma points MVP 9x c-trib
    Nov 30, 2017 @ 21:44
    Marc Goodson
    1

    Hi Garrett

    Have you thought about implementing a Canonical Url for pages on the site?

    https://support.google.com/webmasters/answer/139066?hl=en

    You could check to see if the Url Alias has been set and use this as the canonical or stick with the default url generated by Umbraco.

    You'd have something like this in your site master view to write out the canonical url for the content in the head section:

       var currentUri = HttpContext.Current.Request.Url;
        var port = (currentUri.Port == 80) ? "" : ":" + currentUri.Port;
        var siteUrl = currentUri.Scheme + Uri.SchemeDelimiter + currentUri.Host + port;
     var canonicalUrl = Model.Content.Url;
        // use Umbraco Url alias as the canonical url if it is set
        if (Model.Content.HasValue("umbracoUrlAlias"))
        {
            // umbracourlalias can be a comma delimited string of alterantive urls, the canonical url will be the first
            var canonicalUrls = Model.Content.GetPropertyValue<string>("umbracoUrlAlias").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            canonicalUrl = canonicalUrls.FirstOrDefault();
            if (!String.IsNullOrEmpty(canonicalUrl))
            {
                if (!canonicalUrl.StartsWith("/"))
                {
                    canonicalUrl = "/" + canonicalUrl;
                }
    //keep consistent with how your site Urls ending, eg add a slash if that is the convention you are implementing
                if (!canonicalUrl.EndsWith("/"))
                {
                    canonicalUrl = canonicalUrl + "/";
                }
            }
    
        }
        canonicalUrl = siteUrl + canonicalUrl;
    }
    
    <link rel="canonical" href="@canonicalUrl" />
    
Please Sign in or register to post replies

Write your reply to:

Draft