Copied to clipboard

Flag this post as spam?

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


  • Bram Loquet 72 posts 102 karma points
    Aug 04, 2010 @ 14:44
    Bram Loquet
    1

    How do you handle doctypes that don't need a template?

    How do you handle doctypes that don't need a template, the so called RepositoryDoctypes?

    My Do's:

    • You can add a meta redirect in the head of your page to go one level up in your tree.
      <meta http-equiv="refresh" content="0;URL=./" />
    • You can use .net code to go one level up in our tree.
      <% Response.Redirect("./"); %>
    • I even made a small usercontrol "RedirectToParent" to redirect to the parent.
      Node current = Node.GetCurrent();
      if (current != null && current.Parent != null)
      {
      Response.Redirect(current.Parent.NiceUrl);
      }

    My Don'ts:

    • You can't leave the template empty, this will result in an empty page on you website.
    • You can use umbracoRedirect but then you has to set this property every time. You can't expect this from your customer, can you?

    Can you agree with this aproach or is there a much better way to do this?
    If so, let me know.

     

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Aug 04, 2010 @ 14:52
    Matt Brailsford
    0

    Hi Bram

    I generally don't go to that extent.

    I just make sure that no link is every displayed that would link direct to that item. When creating navigations and such, I'll usually create a paramter within it called "excludes" which contains a list of docTypeAlias' to exclude, I then do a check in my for-each statement. I even modify XSLT search in a similar way (though Doug mentioned he was implementing something similar). And then end of it, it's just a case that there is nowhere on the site that links to the page, that it is never displayed (yea you could go direct, but who would know it's there?)

    If I was going to implement a redirect, i'd be sure to make it a 301 so that search engines don't bother going back.

    Matt

  • Bas Schouten 135 posts 233 karma points
    Aug 04, 2010 @ 15:01
    Bas Schouten
    0

    Hi Matt, Bram,

    I was thinking about a solution to. And I wonder if its possible to set the checkbox as checkt by default (maybe based on docTypeAlias).  

    Bas

  • Bram Loquet 72 posts 102 karma points
    Aug 04, 2010 @ 15:05
    Bram Loquet
    0

    301 is a good point Matt

                    Response.StatusCode = 301;
                    Response.AddHeader("Location", current.Parent.NiceUrl);

  • Bram Loquet 72 posts 102 karma points
    Aug 04, 2010 @ 15:10
    Bram Loquet
    0

    Hi Bas,

    You mean by making a BeforePublish event and then set the umbracoRedirect to his parentId.
    Seems like a good solutions either but then you have to do this for every DocumentType.

    If you put the logic in the template you can just make one template and the call that template whenever needed.

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Aug 04, 2010 @ 15:16
    Matt Brailsford
    0

    A couple of other things I've thought about on the redirect.

    1) You may want to make it smarter incase you nest "RepositoryDoctypes" as you would get a series of redirects in your current situation (not sure how google interprates mulitple redirects)

    2) It's only good for RepositoryDoctypes that are situated within the bounds of your website. I'll often create a "Misc" folder outside of the root of the site, redirecting to parent on these would be pointless, as they'd never get to a page that is valid (unless you do a final check and just redirect to homepage).

    Matt

  • Bas Schouten 135 posts 233 karma points
    Aug 04, 2010 @ 15:26
    Bas Schouten
    0

    All answers combined, i think this could be the best way for me.

    1) A BeforePublish event based on a doctype (repository). This document type contains a parameter like "umbracoNiviHide" that is set default to true.
    2) The selected template must have the redirect.

    In this soulution your client does not have to do anything, and te created node cant be reached in search engines.

    Step 2 of Matts solution is also good, but learning from experience it is not always the easiest way to work for customers.

    Bas

Please Sign in or register to post replies

Write your reply to:

Draft