public static string GetTitle(SeoHelper seoHelper) { if (seoHelper == null) { throw new ArgumentNullException(nameof(seoHelper)); } bool isBaseTitleSet = !string.IsNullOrWhiteSpace(seoHelper.BaseTitle); bool isPageTitleSet = !string.IsNullOrWhiteSpace(seoHelper.Title); if (isBaseTitleSet && isPageTitleSet) { string titleFormat = !string.IsNullOrWhiteSpace(seoHelper.TitleFormat) ? seoHelper.TitleFormat : SeoHelper.DefaultTitleFormat; string title = string.Format(titleFormat, seoHelper.Title, seoHelper.BaseTitle); return(title); } if (!isBaseTitleSet) { return(!string.IsNullOrWhiteSpace(seoHelper.Title) ? seoHelper.Title : null); } return(!string.IsNullOrWhiteSpace(seoHelper.BaseTitle) ? seoHelper.BaseTitle : null); }
public static SeoHelper GetSeoHelper(this ViewDataDictionary viewData) { if (viewData == null) { throw new ArgumentNullException(nameof(viewData)); } var seoHelperData = viewData[ViewDataKey] as SeoHelper; if (seoHelperData == null) { lock (viewData) { seoHelperData = viewData[ViewDataKey] as SeoHelper; if (seoHelperData == null) { seoHelperData = new SeoHelper(); viewData[ViewDataKey] = seoHelperData; } } } return(seoHelperData); }
public override void OnHandleSeoValues(SeoHelper seoHelper) { if (seoHelper == null) { throw new ArgumentNullException(nameof(seoHelper)); } seoHelper.BaseLinkCanonical = this.linkCanonical; }
public override void OnHandleSeoValues(SeoHelper seoHelper) { if (this.Append) { seoHelper.AddMetaKeyword(this.metaKeywords); } else { seoHelper.MetaKeywords = this.metaKeywords; } }
protected override void Initialize(RequestContext requestContext) { if (requestContext == null) { throw new ArgumentNullException(nameof(requestContext)); } base.Initialize(requestContext); this.Seo = this.GetSeoHelper(); }
public override void OnHandleSeoValues(SeoHelper seoHelper) { if (seoHelper == null) { throw new ArgumentNullException(nameof(seoHelper)); } base.OnHandleSeoValues(seoHelper); seoHelper.BaseTitle = this.title; }
public override void OnHandleSeoValues(SeoHelper seoHelper) { if (seoHelper == null) { throw new ArgumentNullException(nameof(seoHelper)); } if (!string.IsNullOrWhiteSpace(this.Format)) { seoHelper.TitleFormat = this.Format; } }
public abstract void OnHandleSeoValues(SeoHelper seoHelper);
public override void OnHandleSeoValues(SeoHelper seoHelper) { seoHelper.MetaDescription = this.metaDescription; }
public override void InitHelpers() { base.InitHelpers(); this.Seo = this.GetSeoHelper(); }
public override void OnHandleSeoValues(SeoHelper seoHelper) { seoHelper.MetaRobotsIndex = this.robotsIndex; }
public override void OnHandleSeoValues(SeoHelper seoHelper) { seoHelper.LinkCanonical = this.linkCanonical; }