Exemple #1
0
        protected override void Validate(HtmlDocument doc, DescriptionValidatorSettings settings)
        {
            TextLengthValidator.Validate(doc, "//head/meta[@name='description']",
                                         settings.MinLength, settings.MaxLength,
                                         "<meta description>", n =>
            {
                var desc = n.Attributes["content"]?.Value;

                if (string.IsNullOrEmpty(desc))
                {
                    return(0);
                }
                else
                {
                    return(desc.Length);
                }
            });
        }
Exemple #2
0
 protected override void Validate(HtmlDocument doc, ContentValidatorSettings settings)
 {
     TextLengthValidator.Validate(doc, settings.ContentNodeSelector,
                                  settings.MinWords, settings.MaxWords,
                                  "{page content}", n => TextHelper.GetWords(HtmlHelper.HtmlToPlainText(n)).Count());
 }
Exemple #3
0
 protected override void Validate(HtmlDocument doc, TitleValidatorSettings settings)
 {
     TextLengthValidator.Validate(doc, "//head/title",
                                  settings.MinLength, settings.MaxLength,
                                  "<title>", n => n.InnerText.Length);
 }