Copied to clipboard

Flag this post as spam?

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


  • Paul Stewart 2 posts 22 karma points
    Jan 25, 2013 @ 14:33
    Paul Stewart
    0

    Making Sitemap Levels in groups of?

    Hey guys, could any one point out any advice or any help with my code to convert the first level of my site in groups of 3? 

     

    @inherits umbraco.MacroEngines.DynamicNodeContext
    @helper traverse(dynamic node)
        {
        var maxLevelForSitemap = String.IsNullOrEmpty(Parameter.MaxLevelForSitemap) ? 4 : int.Parse(Parameter.MaxLevelForSitemap);
        var values = new Dictionary<string, object>();
        values.Add("maxLevelForSitemap", maxLevelForSitemap);
        var items = node.Children.Where("Visible").Where("Level <= maxLevelForSitemap", values);
        if (items.Count() > 0)
        {
            var root = Model.AncestorOrSelf(1);
            var className = "level" + @node.Level;
            
            
            
              <ul class="@className">
                @foreach (var item in items)
                {
                    <li>
    <a href="@item.Url">@item.Name</a>
    @traverse(item)
                    </li>
                } 
              </ul> 
            
        }
    }
    <div class="sitemap"> 
        @traverse(@Model.AncestorOrSelf())
    </div>

    Any ideas? 

    I have tried making if statements if node.level == 1 then make it into groups, but didnt work at all. 

     

Please Sign in or register to post replies

Write your reply to:

Draft