Posts

Showing posts with the label Year

Umbraco 7 Year Now Razor Snippet

How to display the current year in Razor and in Umbraco 7  @DateTime.Now.Year For example: <p>Copyright &copy; @DateTime.Now.Year </p> I use this on a lot of my umbraco websites for keeping the copyright up to date.  You can see an example of this on the footer of my most recent Umbraco website design at: http://www.markdevelopment.co.uk/portfolio/abercromby-heating-and-plumbing-services/

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;  ...

Umbraco 7 Hide a page from Navigation or Sub Navigation with umbracoNaviHide using Razor in a template or partial view

Image
How to Allow the user to Hide a Page from Navigation in Umbraco 7. By using a tick box: This example shows hide the Search Results page from the main navigation in umbraco 7. 1)  In your Document Type add a property called "umbracoNaviHide", it must be called "umbracoNaviHide" The property should be a tick box, so it should be a "True/False " 2) In your Navigation, add the highlighted code to your for each loop that writes out the navigation:   @foreach(var p in homePage.Children() .Where("visible") )                         {                             write out navigation 3) Now when the user ticks Hide from Nav in the backend, the page will not show in the navigation: