public override IEnumerable<SEOAnalysisFacet> GetFacets(Webpage webpage, HtmlNode document, string analysisTerm) { string titleText = document.GetElementText("title") ?? string.Empty; if (titleText.Length < 50) yield return GetFacet("Title length", SEOAnalysisStatus.Error, "The title should be at least 50 characters long"); else if (titleText.Length > 90) yield return GetFacet("Title length", SEOAnalysisStatus.Error, "The title should be at most 90 characters long"); else yield return GetFacet("Title length", SEOAnalysisStatus.Success, "The title is of optimal length (50-90 characters)"); }
public override IEnumerable<SEOAnalysisFacet> GetFacets(Webpage webpage, HtmlNode document, string analysisTerm) { var element = document.GetElement("h1"); if (element == null) { yield return GetFacet("H1 is missing", SEOAnalysisStatus.Error, "The H1 element is missing in the page"); yield break; } string h1Text = document.GetElementText("h1"); if (h1Text.Contains(analysisTerm, StringComparison.OrdinalIgnoreCase)) yield return GetFacet("H1 contains term", SEOAnalysisStatus.Success, "The H1 element contains '" + analysisTerm + "'"); else yield return GetFacet("H1 contains term", SEOAnalysisStatus.Error, "The H1 element does not contain '" + analysisTerm + "'"); }
public override IEnumerable<SEOAnalysisFacet> GetFacets(Webpage webpage, HtmlNode document, string analysisTerm) { string titleText = document.GetElementText("title"); if (titleText != null && titleText.Contains(analysisTerm, StringComparison.OrdinalIgnoreCase)) { if (titleText.StartsWith(analysisTerm)) yield return GetFacet("Title contains term", SEOAnalysisStatus.Success, string.Format("The title starts with the term '{0}', which is considered to improve rankings", analysisTerm)); else { yield return GetFacet("Title contains term", SEOAnalysisStatus.CanBeImproved, string.Format( "The title contains the term '{0}'. To improve this, consider moving it to the start of the title, as this is considered to improve rankings", analysisTerm)); } } else yield return GetFacet("Title contains term", SEOAnalysisStatus.Error, string.Format("The title does not contain '{0}'", analysisTerm)); }