Posts

Showing posts from May, 2017

Umbraco 7 HTML Site Map Partial View

@inherits Umbraco.Web.Mvc.UmbracoTemplatePage @{ var home = CurrentPage.Site(); } @if (home.Children.Any()) {     @* Get the first page in the children *@     var naviLevel = home.Children.First().Level;     var listChildPages = "false";     @* Add in level for a CSS hook *@     <ul style="margin-top:0px;paddin:0px;font-size:16px;">                 @* For each child page under the home node *@         <li><a href="/" title="@CurrentPage._siteTitle">Home</a></li>         @foreach (var childPage in home.Children.Where("Visible"))         {             if (childPage.Children.Any() && listChildPages =="true"  && childPage.id != 1110)             {                                 <li style="margin-bottom:5px;">                         @if(@childPage.HasValue("navigationName"))                         {                             <a href=

Umbraco 7 Metadata, Keywords, Description and Title

@{            var SEOTitle = "";         var SEODescription = "";         var SEOKeywords = "";      }      @if(CurrentPage.seoTitle != null && CurrentPage.seoTitle != "")      {         SEOTitle = CurrentPage.seoTitle;      }      else      {         SEOTitle = @CurrentPage.Url.Replace("/"," | ") + @CurrentPage._siteTitle;         SEOTitle = SEOTitle.Substring(2, SEOTitle.Length-2);      }          @if(CurrentPage.seoDescription != null && CurrentPage.seoDesctiption != "")      {         SEODescription = CurrentPage.seoDescription;      }      else      {         SEODescription = "This page is about" + @CurrentPage.Url.Replace("/"," ") + @CurrentPage._siteTitle;      }      @if(CurrentPage.seoKeywords != null && CurrentPage.seoKeywords != "")      {         SEOKeywords = CurrentPage.seoKeywords;      }      else      {