Copied to clipboard

Flag this post as spam?

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


  • Robin Nicholl 137 posts 277 karma points
    Mar 07, 2011 @ 03:31
    Robin Nicholl
    0

    mydomain.com/template-name is valid page

    So, I have some templates that are used for more than one type of page. Lets's say one's called 'Textpage': there are no pages/content nodes called 'Textpage' – they're called things like 'About' and 'Clients', but I don't want to create a separate template for each page when its content is similar to another page/pages.

    If I point my browser to mydoman.com/textpage the template will show up, when I would expect my 404 page to display, showing whatever is in the relevant Master template. Is there a way around this?

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Mar 07, 2011 @ 08:09
    Jan Skovgaard
    0

    Hi Robin

    You can easily allow your different document types to have more than 1 template.

    You just need to go to the document type and in the first tab select, which templates can be used to display the contents from the document type. Then you can set the default template that should be assigned automatically when the document type is creaed. When there is a page that should use another template you just go to the "properties" tab and select another template from the dropdown box.

    I hope this helps.

    /Jan

  • Robin Nicholl 137 posts 277 karma points
    Mar 07, 2011 @ 13:47
    Robin Nicholl
    0

    Hi Jan

    Thanks, yes I know that. My problem is that any template that doesn't share a name with a published page/content node can be browsed to. I can have a template called 'Textpage' used by several content nodes, but unless one of them is called 'Textpage', browsing to mydomain.com/textpage will display a page based on the master template that Textpage is based on. I do not want this to happen!

  • Matt Brailsford 4124 posts 22220 karma points MVP 9x c-trib
    Mar 07, 2011 @ 14:23
    Matt Brailsford
    0

    Hey Robin,

    This is by design and is a feature called "Alternative Templates". It basically allows you to render the current page using a different template without actually having to create it. So, in you example mydomain.com/textpage will display your mysomain.com as would look if it was using the textpage template. 

    For the most part, this isn't a problem, as aslong as you don't link to the alt templates, then nobody is going to find them. If you want to remove this feature though, you can get rid of the line:

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

    from the config/404handlers.config file and it should stop. Doing this though will mean you can't access mydomain.com/mytemplate should you want that functionality later.

    Cheers

    Matt

  • Robin Nicholl 137 posts 277 karma points
    Mar 07, 2011 @ 15:10
    Robin Nicholl
    0

    Hi Matt

    Thanks for that. I get it now (although I don't really think it's a great feature, and can't see in which situations I'd want to use it… particularly as it exposes all my content to display by an in-the-know user in ways that weren't intended, and may be undesireable).

    Also, unfortunately, removing that line from /config/404handlers.config doesn't seem to stop the feature.

    Robin

  • Matt Brailsford 4124 posts 22220 karma points MVP 9x c-trib
    Mar 07, 2011 @ 15:15
    Matt Brailsford
    1

    Hi Robin,

    It does have it's uses, I use it quite regulaly for things like AJAX calls. I'll generally have a fallback version of my site by default that uses standard "navigate to page" functionality, but then I might have say an AJAX Popup template for displaying content in a dialog. In that case, I don't really want that page in the popup style all the time, just when I'm requesting the page by AJAX, so alt templates allows me to just append the template name on the end, and bingo, I have the same page rendered in a dialog safe styling. I tend to find that it is one of those things, once you realize the use for it, you see more and more uses for it.

    You may also want to restart your app pool (resave your web.config) as changes to the config folder aren't automatically picked up.

    Cheers

    Matt

  • Robin Nicholl 137 posts 277 karma points
    Mar 07, 2011 @ 15:46
    Robin Nicholl
    0

    Hi Matt

    Thanks – the more I play about with this 'feature', the more potentially dangerous it appears.

    Robin

Please Sign in or register to post replies

Write your reply to:

Draft