Copied to clipboard

Flag this post as spam?

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


  • Nick Lewis 30 posts 138 karma points
    Sep 06, 2016 @ 17:33
    Nick Lewis
    0

    Any ideas as go why my main navigation is missing? I started the project off on UaaS and have restored down to Dev and last of all my Local environment . The live site does show the nav but the others don't.

  • Alex Skrypnyk 6133 posts 23952 karma points MVP 7x admin c-trib
    Sep 06, 2016 @ 21:35
    Alex Skrypnyk
    1

    Hi Nick,

    Did you try to do republish?

    Can you show code of main navigation?

    Thanks,

    Alex

  • Nick Lewis 30 posts 138 karma points
    Sep 09, 2016 @ 16:59
    Nick Lewis
    0

    I did try to republish yes and am using the Source theme from uSkinned. The code is below:

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    
    @using Newtonsoft.Json.Linq;
    
    @{
    IPublishedContent homeNode = Model.Content.AncestorOrSelf(1);
    var settingsFolder = Umbraco.TypedContent(homeNode.GetProperty("websiteConfigurationNode").Value);
    var navigation = settingsFolder.Children.Where(x => x.IsDocumentType("USNNavigation")).First();
    
    var mainNavigation = navigation.GetPropertyValue<JArray>("mainNavigation");
    
    if (mainNavigation != null && navigation.GetPropertyValue<string>("mainNavigation", true, "").Length > 2)
    {
        <nav class="main">
            <ul>
                @foreach (JObject link in mainNavigation)
                {
                    string linkTitle = String.Empty;
                    string linkURL = String.Empty;
                    string linkTarget = String.Empty;
                    string linkIcon = String.Empty;
                    IPublishedContent node = null;
    
                    linkURL = USNStarterKit.USNBusinessLogic.USNUrlHelper.GetSingleUrlFromJObject(link, out linkTitle, out linkTarget, out linkIcon, out node);
    
                    //Display nav link for Umbraco Content Page
                    if (node != null && node.IsVisible())
                    {
                        var selected = Array.IndexOf(Model.Content.Path.Split(','), node.Id.ToString()) >= 0 ? " class=\"active\"" : "";
    
                        if (node.IsDocumentType("USNHomepage") && !Model.Content.IsDocumentType("USNHomepage"))
                        {
                            selected = "";
                        }
    
                        var subPages = node.Children.Where(x => (x.IsDocumentType("USNStandardPage") || x.IsDocumentType("USNAdvancedPage") || x.IsDocumentType("USNBlogLandingPage") || x.IsDocumentType("USNLoginPage") || x.IsDocumentType("USNSearchResultsPage")) && x.IsVisible());
    
                        string subPageClass = "";
    
                        if (subPages.Count() > 0 && !node.IsDocumentType("USNHomepage") && navigation.GetPropertyValue<bool>("displaySubPages"))
                        {
                            subPageClass = " class=\"has-child\"";
                        }
    
                        <li @Html.Raw(subPageClass)>
                            <a href="@linkURL" @Html.Raw(selected) @Html.Raw(linkTitle) @Html.Raw(linkTarget)>
                                <span>
                                    @(link.Value<string>("caption"))@Html.Raw(linkIcon)
                                </span>
                            </a>
                            @if (subPageClass != String.Empty)
                            {
                                <i class="ion-chevron-down"></i>
                            }
                            @if (subPages.Count() > 0 && navigation.GetPropertyValue<bool>("displaySubPages") && !node.IsDocumentType("USNHomepage"))
                            {
                                @SubPages(subPages)
                            }
                        </li>
                    }
                    //Display nav link for external link
                    else if (node == null && linkURL != String.Empty)
                    { 
                        <li>
                            <a href="@linkURL" @Html.Raw(linkTarget) @Html.Raw(linkTitle)>@(link.Value<string>("caption"))@Html.Raw(linkIcon)</a>                                       
                        </li>
                    }
                }
            </ul>
        </nav>
    }
    

    }

    @helper SubPages(IEnumerable

      @foreach (var node in pages) { string selected = Array.IndexOf(Model.Content.Path.Split(','), node.Id.ToString()) >= 0 ? " class=\"active\"" : "";

              var subPages = node.Children.Where(x => (x.IsDocumentType("USNStandardPage") || x.IsDocumentType("USNAdvancedPage") || x.IsDocumentType("USNBlogLandingPage") || x.IsDocumentType("USNLoginPage") || x.IsDocumentType("USNSearchResultsPage")) && x.IsVisible());
      
              string subPageClass = "";
      
              if (subPages.Count() > 0)
              {
                  subPageClass = " class=\"has-child\"";
              }
      
              <li @Html.Raw(subPageClass)>
                  <a @Html.Raw(selected) href="@node.Url()">
                      <span>
                          @if (node.HasValue("subNavigationLinkText"))
                          {
                              @node.GetProperty("subNavigationLinkText").Value;
                          }
                          else
                          {
                              @node.Name
                          }
                      </span>
                  </a>
                  @if (subPageClass != String.Empty)
                  {
                      <i class="ion-chevron-down hidden-lg hidden-md hidden-sm"></i><i class="ion-chevron-right hidden-xs"></i>
                  }
                  @if (subPages.Count() > 0)
                  {
                      @SubPages(subPages)
                  }
              </li>
          }
      </ul>
      

      }

  • Marc Love (uSkinned.net) 432 posts 1691 karma points
    Sep 19, 2016 @ 10:12
    Marc Love (uSkinned.net)
    0

    Hi Nick,

    Did you solve this issue?

    Cheers,

    Marc

Please Sign in or register to post replies

Write your reply to:

Draft