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
     {
        SEOKeywords = @CurrentPage.Url.Replace("/",",") + @CurrentPage._siteTitle;
        SEOKeywords = SEOKeywords.Substring(1, SEOKeywords.Length-1);
     }<title>@SEOTitle.Truncate(60)</title>

Comments

Popular posts from this blog

Create a .NET Contact Form that Gets the Last Url Visited in C# Can also be Used in Umbraco

Umbraco - Reset the Admin Password via SQL Server

Umbraco Macro for IFrame when Embedding Video, Vimeo Universal Player, or other types of IFrame on to a Page XSLT version and Razor Version