Copied to clipboard

Flag this post as spam?

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


  • Dafydd Owen 33 posts 173 karma points
    Jul 05, 2013 @ 12:54
    Dafydd Owen
    0

    Hide a document type/subnode of a folder

    Hello, 

    I am hoping someone will be able to help me with this, I have searched the forums and google but I am no closer to figuring it out. I am currently working on a website which includes a list of Biographies for team members. 

    The structure in the navigation tree looks like this

    Home
    Page
    Biographies
    Biography
    Biography
    Biography
    Page
    Page

    Both Biographies and biography have their own document types but my issue with this is when I use "nideInNavi" on the sub node(Biography) it removes the content that must be shown on the Biographies page. I need to hide the Biography node since it looks super messy on the menu.

    Is there a way to hide these nodes as default or even target the document type in the navigation using Razor?

    Any help would be greatly appreciated.
    Thanks!

    :)

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Jul 05, 2013 @ 12:59
    Jeavon Leopold
    0

    Hi Dafydd,

    Could you please post your navigation Razor code, then I'm sure we can work it out. Also is your hide property alias called "umbracoNaviHide"?

    Thanks,

    Jeavon

  • Dafydd Owen 33 posts 173 karma points
    Jul 05, 2013 @ 13:14
    Dafydd Owen
    0

    Hello Jeavon,

    Thanks for the reply!

    This is the razor code I am using up to this point is below

    The version of umbraoc I am using is 4.11 and the property is labelled umbracoNaviHide which is working, but it also removes the content from the parent page, which I guess is to be expected.

    @using umbraco.MacroEngines

    @inherits DynamicNodeContext

    @{

     

     

        var root = @Model.AncestorOrSelf();

        <div class="">

    <ul class="nav">

        @{ var homeSelected = @Model.Level == 1 ? " class=\"active\"" : string.Empty; }

     

     

     

        <[email protected](homeSelected)><a href="@root.Url">@root.Name</a></li>

        @foreach (var item in root.Children.Where("Visible"))

        {

            var selected = Array.IndexOf(Model.Path.Split(','), item.Id.ToString()) >= 0 ? " class=\"active\"" : string.Empty;

            var subItems = item.Descendants("Textpage").Where("Visible");

          <[email protected](selected)><a href="@item.Url">@item.Name</a></li>

        }

        </ul>

    </div>

     

    }

     

     

    Thanks!

          

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Jul 05, 2013 @ 13:19
    Jeavon Leopold
    0

    Ah ok, so what Razor do you use on the parent page to render out the children?

  • Dafydd Owen 33 posts 173 karma points
    Jul 05, 2013 @ 13:21
    Dafydd Owen
    0

    The razor to render the biographies is below and this is placed on the Biographies template

    @using umbraco.MacroEngines

    @inherits DynamicNodeContext

    @{

        <ul class="thumbnails list">

        @foreach (var item in @Model.Children.Where("Visible"))

        {

            dynamic image = item.teamMemberImage.First;

            <li class="span3 team">

                <img src="@image.Crops.cropGalleryThumbnail" alt="@item.teamMemberImage.First.Alt" />

    <h2><span>@item.forename</span>@item.surname</h2>

    <p class="position">@item.position</p>

    <div id="nano-wrap">

    <div class="nano-bio has-scrollbar">

    <div class="content">

    <p>@item.bio</p>

    </div>

    </div>

    </div>

    <hr />

            </li>

        }

        </ul>

    }

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Jul 05, 2013 @ 13:22
    Jeavon Leopold
    100

    Cool, so just remove the .Where("Visible") so you have @foreach (var item in @Model.Children)

  • Dafydd Owen 33 posts 173 karma points
    Jul 05, 2013 @ 13:27
    Dafydd Owen
    0

    :-) 

    Thank you so much.

    You have just made my friday!!

    Have a great weekend!

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Jul 05, 2013 @ 13:31
    Jeavon Leopold
    0

    Excellent! I recognised the postcode on your profile as I grew up in Presteigne many years ago!!!

    Have a good weekend also!

  • Dafydd Owen 33 posts 173 karma points
    Jul 05, 2013 @ 13:38
    Dafydd Owen
    0

    What a small world, it is a nice place relax but it can get very quiet which can be boring...

    I hope you are doing well in London. 

     

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Jul 05, 2013 @ 13:59
    Jeavon Leopold
    0

    Indeed, incredible and brilliant to see Umbraco has reached Presteigne!

Please Sign in or register to post replies

Write your reply to:

Draft