Beispiel #1
0
        private void SetCanonicalUrl()
        {
            string url = Request.Url.Scheme + "://" + Request.Url.Host;

            if (PageItem.InnerItem.TemplateID.ToString() == UnderstoodDotOrg.Domain.SitecoreCIG.Poses.Pages.HomePageItem.TemplateId)
            {
                url += "/";
            }
            else
            {
                url += PageItem.GetUrl();
            }

            var canonicalLink = new HtmlLink();

            canonicalLink.Attributes.Add("rel", "canonical");
            canonicalLink.Attributes.Add("href", url);
            this.Header.Controls.Add(canonicalLink);
        }