Copied to clipboard

Flag this post as spam?

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


  • Drew DeVault 22 posts 43 karma points
    Feb 11, 2012 @ 00:13
    Drew DeVault
    0

    Umbraco 5 - Get DocType of Current Node

    I've been customizing _layout.cshtml a bit, and I'm trying to figure out how to get the doctype of the current node as a string.  How can I accomplish this?

    Also, I've had some trouble finding any documentation on Umbraco 5 - where can I go to find this kind of information in the future?

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Feb 11, 2012 @ 07:58
    Jan Skovgaard
    0

    Hi Drew

    If I remeber correctly you should be able to do something like this..

        var rootNode = currentPage.AncestorsOrSelf.Last();
        var rootIsSelected = currentPage.Id == rootNode.Id<string>;

    For more usefull Razor snippets to learn from make sure to checkout those snippets Warren has made here: https://gist.github.com/warrenbuckley - If you have an idea for more snippets I'm sure he would love to hear it on Twitter for instance.

    Regarding the documentation on v5 you should make sure to keep an eye on the official Umbraco blog here: http://umbraco.com/follow-us.aspx and Jonathan Saxon has made a good blog series about v5 here: http://h4rdboiledegg.wordpress.com/ and Darren Ferguson is writing about how he is converting his current site to Umbraco 5 here: http://blog.darren-ferguson.com/ and Shannon from the core team is also writing some interesting stuff about v5 http://shazwazza.com/

    Make sure to keep an eye out on the blog tracker on the last column to the right of our too. That's the best you can do right now I believe.

    Hope this helps.

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft