yoastseo-dep
Version:
Yoast clientside page analysis
79 lines (70 loc) • 2.62 kB
JavaScript
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 ProductCornerstoneContentAssessor = function( researcher, options ) {
Assessor.call( this, researcher, options );
this.type = "productCornerstoneContentAssessor";
this._assessments = [
new SubheadingDistributionTooLongAssessment( {
parameters: {
slightlyTooMany: 250,
farTooMany: 300,
recommendedMaximumLength: 250,
},
applicableIfTextLongerThan: 250,
shouldNotAppearInShortText: true,
urlTitle: createAnchorOpeningTag( options.subheadingUrlTitle ),
urlCallToAction: createAnchorOpeningTag( options.subheadingCTAUrl ),
cornerstoneContent: true,
} ),
new ParagraphTooLongAssessment( {
parameters: {
recommendedLength: 70,
maximumRecommendedLength: 100,
},
urlTitle: createAnchorOpeningTag( options.paragraphUrlTitle ),
urlCallToAction: createAnchorOpeningTag( options.paragraphCTAUrl ),
}, true ),
new SentenceLengthInTextAssessment( {
slightlyTooMany: 15,
farTooMany: 20,
urlTitle: createAnchorOpeningTag( options.sentenceLengthUrlTitle ),
urlCallToAction: createAnchorOpeningTag( options.sentenceLengthCTAUrl ),
}, true, 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( ProductCornerstoneContentAssessor, ContentAssessor );
export default ProductCornerstoneContentAssessor;