Copied to clipboard

Flag this post as spam?

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


  • Rob 5 posts 55 karma points
    Jan 21, 2013 @ 17:22
    Rob
    0

    When building breadcrumb two different levels get the same node.Level value

    I have this weird problem. I'll try to explain.

    I'll start with my site's content tree:

    Content
        - Home
            - Second
                - Third
                    - Fourth
                    - Fourth
                - Third
                    - Fourth
            - Second
                - Third
                - Third
                    - Fourth
                    - Fourth
                    - Fourth
                        - Fifth
                        - Fifth
            - Second
            - Second

    The razor code in breadcrumb.cshtml:

    @inherits umbraco.MacroEngines.DynamicNodeContext
    
      @foreach(var node in Model.Ancestors().Where("Visible")) {
    • @node.Name (@node.Level>
    • }
    • @Model.Name (@Model.Level)

    This is a very simple breadcrumb navigation.

    The problem is that this outputs as the following:

    • Home(1)
    • Second(2)
    • Third(2)
    • Fourth(3)

    See the problem?

    I output the level after the name, and i get level (2) for both the second and third items.

    Some more info:

     

    • umbraco v 4.11.1 (Assembly version: 1.0.4715.27659)
    • windows 7

     

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies