Last active
February 10, 2017 20:48
-
-
Save rbaty-barr/d68aea8741d8fabd3022b256174b2920 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage | |
@using System | |
@{ | |
var siteRoot = CurrentPage.AncestorOrSelf(1); | |
string thePage = ""; | |
var canonicalUrl= String.Empty; | |
var siteHost = Request.ServerVariables["HTTP_HOST"]; | |
string sepChar = " — "; | |
if(CurrentPage.HasValue("metaTitleOverride")) { | |
thePage = CurrentPage.metaTitleOverride; | |
} else if(CurrentPage.HasValue("pageHeadging")){ | |
thePage = CurrentPage.pageHeadging; | |
} else { | |
thePage = @CurrentPage.Name; | |
} | |
string siteName = siteRoot.HasValue("siteName") ? Umbraco.StripHtml(thePage) + sepChar + @siteRoot.siteName : Umbraco.StripHtml(thePage).ToString(); | |
} | |
<title>@Html.Raw(siteName)</title> | |
@if(@siteHost.ToLower().StartsWith("www")){ | |
canonicalUrl = "http://" + @siteHost + @CurrentPage.Url; | |
} else { | |
canonicalUrl = "http://" + @siteHost + @CurrentPage.Url; | |
} | |
<link rel="canonical" href="@canonicalUrl" /> | |
@if(CurrentPage.HasValue("metaDescription")){ | |
<meta name="description" content="@CurrentPage.metaDescription"> | |
} | |
@{ | |
var docType = CurrentPage.DocumentTypeAlias; | |
<meta name="category" content="@docType"> | |
<!-- | |
<PageMap> | |
<DataObject type="metatags"> | |
<Attribute name = "category" value="@docType" /> | |
</DataObject> | |
</PageMap> | |
--> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment