UNPKG

yoastseo-dep

Version:

Yoast clientside page analysis

72 lines (63 loc) 2.4 kB
import { inherits } from "util"; import { Assessor, ContentAssessor, assessments, helpers } from "yoastseo-dep"; import ListsPresenceAssessment from "../assessments/readability/ListAssessment"; const { createAnchorOpeningTag } = helpers; const { ParagraphTooLongAssessment, SentenceLengthInTextAssessment, SubheadingDistributionTooLongAssessment, TransitionWordsAssessment, PassiveVoiceAssessment, TextPresenceAssessment, } = assessments.readability; /** * Creates the Assessor * * @param {object} researcher The researcher to use for the analysis. * @param {Object} options The options for this assessor. * * @constructor */ const ProductContentAssessor = function( researcher, options ) { Assessor.call( this, researcher, options ); this.type = "productContentAssessor"; this._assessments = [ new SubheadingDistributionTooLongAssessment( { shouldNotAppearInShortText: true, urlTitle: createAnchorOpeningTag( options.subheadingUrlTitle ), urlCallToAction: createAnchorOpeningTag( options.subheadingCTAUrl ), } ), new ParagraphTooLongAssessment( { parameters: { recommendedLength: 70, maximumRecommendedLength: 100, }, urlTitle: createAnchorOpeningTag( options.paragraphUrlTitle ), urlCallToAction: createAnchorOpeningTag( options.paragraphCTAUrl ), }, true ), new SentenceLengthInTextAssessment( { slightlyTooMany: 20, farTooMany: 25, urlTitle: createAnchorOpeningTag( options.sentenceLengthUrlTitle ), urlCallToAction: createAnchorOpeningTag( options.sentenceLengthCTAUrl ), }, false, true ), new TransitionWordsAssessment( { urlTitle: createAnchorOpeningTag( options.transitionWordsUrlTitle ), urlCallToAction: createAnchorOpeningTag( options.transitionWordsCTAUrl ), } ), new PassiveVoiceAssessment( { urlTitle: createAnchorOpeningTag( options.passiveVoiceUrlTitle ), urlCallToAction: createAnchorOpeningTag( options.passiveVoiceCTAUrl ), } ), new TextPresenceAssessment( { urlTitle: createAnchorOpeningTag( options.textPresenceUrlTitle ), urlCallToAction: createAnchorOpeningTag( options.textPresenceCTAUrl ), } ), new ListsPresenceAssessment( { urlTitle: createAnchorOpeningTag( options.listsUrlTitle ), urlCallToAction: createAnchorOpeningTag( options.listsCTAUrl ), } ), ]; }; inherits( ProductContentAssessor, ContentAssessor ); export default ProductContentAssessor;