Copied to clipboard

Flag this post as spam?

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


  • shobhit agarwal 8 posts 108 karma points
    Nov 27, 2015 @ 12:40
    shobhit agarwal
    0

    Why template has its own URL in umbraco

    I have created a template named it to "home page". then i have created a content tab for this and publish it with url suppose like "www.mydomain.com". but now i can see the same page is also accessible at "www.mydomain.com\homepage". Can anyone let me know why there is a page exists for each template in umbraco. this causes me content duplication issue in SEO. Will Appreciate help.

  • Alex Skrypnyk 6060 posts 23282 karma points MVP 6x admin c-trib
    Nov 27, 2015 @ 23:28
    Alex Skrypnyk
    0

    Hi Shobhit Agarwal,

    Each template don't have it's own urls. Home page are accessible via few urls because it's your first node and it's working as root of your site.

  • shobhit agarwal 8 posts 108 karma points
    Dec 01, 2015 @ 07:17
    shobhit agarwal
    0

    Hi Alex

    this is not the case. other templates are also accessible in my website with the same behaviour.

  • Dan Diplo 1545 posts 6118 karma points MVP 4x c-trib
    Nov 30, 2015 @ 10:05
    Dan Diplo
    100

    Umbraco allows you to switch templates at runtime. So you can append a template alias to a URL and it will then render that page using that template. See https://umbraco.tv/videos/umbraco-v7/implementor/fundamentals/templating/alt-template/

    So when you go www.mydomain.com\homepage it is passing in the template "homepage" to render the content (which just happens to be the default template, anyway).

    I believe you can disable this behaviour in /config/umbracoSettings.config

    Change disableAlternativeTemplates to "true" in web.routing:

      <web.routing
        trySkipIisCustomErrors="true"
        internalRedirectPreservesTemplate="false" disableAlternativeTemplates="true"  
    disableFindContentByIdPath="false"
        umbracoApplicationUrl="">
      </web.routing>
    

    And in 404handlers.config remove

    <notFound assembly="umbraco" type="SearchForTemplate"/>
    
  • shobhit agarwal 8 posts 108 karma points
    Dec 01, 2015 @ 08:17
    shobhit agarwal
    0

    Hi dan

    Removing

    <notFound assembly="umbraco" type="SearchForTemplate"/>

    from 404handlers.config works good to me and resolves my issue.

    However if i add disableAlternativeTemplates="true" to web.routing element in umbracoSettings.config i face some application error. is this attribute is specific to any umbraco version. please note i am using umbraco 7.x

  • Dan Diplo 1545 posts 6118 karma points MVP 4x c-trib
    Dec 01, 2015 @ 08:34
    Dan Diplo
    0

    Sorry, don't really know what is causing the error - I was just basing this on the documentation. If removing it from 404handlers works, I'd just leave it :)

  • Richard Hamilton 79 posts 166 karma points
    Dec 17, 2018 @ 11:57
    Richard Hamilton
    0

    I have been experiencing the same behaviour this week and didn't know this functionality existed.

    I guess if you wanted to use this feature, you should probably name your templates with more unique names? Such as kWG8KDFy7z6Ow-Blog.cshtml

    Because it seems that certain robots will try to find common names such as /blog or /contact

    Any thoughts on this and how to use this functionality correctly?

Please Sign in or register to post replies

Write your reply to:

Draft