axyseo 2.0.0-alpha.0.0.60 → 2.0.0-alpha.0.0.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/languageProcessing/researches/getSentenceBeginnings.js +2 -0
- package/build/languageProcessing/researches/getSentenceBeginnings.js.map +1 -1
- package/build/scoring/assessments/readability/ParagraphTooLongAssessment.js +4 -11
- package/build/scoring/assessments/readability/ParagraphTooLongAssessment.js.map +1 -1
- package/build/scoring/assessments/readability/RelatedKeywordsAssessment.js +4 -7
- package/build/scoring/assessments/readability/RelatedKeywordsAssessment.js.map +1 -1
- package/build/scoring/assessments/readability/SentenceBeginningsAssessment.js +6 -8
- package/build/scoring/assessments/readability/SentenceBeginningsAssessment.js.map +1 -1
- package/build/scoring/assessments/readability/SentenceLengthInTextAssessment.js +4 -8
- package/build/scoring/assessments/readability/SentenceLengthInTextAssessment.js.map +1 -1
- package/build/scoring/assessments/readability/TransitionWordsAssessment.js +4 -8
- package/build/scoring/assessments/readability/TransitionWordsAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/ImageCountAssessment.js +4 -9
- package/build/scoring/assessments/seo/ImageCountAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/InternalLinksAssessment.js +4 -8
- package/build/scoring/assessments/seo/InternalLinksAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/IntroductionKeywordAssessment.js +4 -8
- package/build/scoring/assessments/seo/IntroductionKeywordAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/KeyphraseAssessment.js +4 -8
- package/build/scoring/assessments/seo/KeyphraseAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/KeyphraseLengthAssessment.js +3 -5
- package/build/scoring/assessments/seo/KeyphraseLengthAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/KeywordDensityAssessment.js +4 -7
- package/build/scoring/assessments/seo/KeywordDensityAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/MetaDescriptionKeywordAssessment.js +4 -7
- package/build/scoring/assessments/seo/MetaDescriptionKeywordAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/MetaDescriptionLengthAssessment.js +4 -7
- package/build/scoring/assessments/seo/MetaDescriptionLengthAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/MetaTitleKeywordAssessment.js +4 -12
- package/build/scoring/assessments/seo/MetaTitleKeywordAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/NumberInMetaTitleAssessment.js +3 -6
- package/build/scoring/assessments/seo/NumberInMetaTitleAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/OutboundLinksAssessment.js +4 -7
- package/build/scoring/assessments/seo/OutboundLinksAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/PageTitleWidthAssessment.js +4 -7
- package/build/scoring/assessments/seo/PageTitleWidthAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/SchemaAssessment.js +4 -8
- package/build/scoring/assessments/seo/SchemaAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/SingleH1Assessment.js +5 -7
- package/build/scoring/assessments/seo/SingleH1Assessment.js.map +1 -1
- package/build/scoring/assessments/seo/SingleTitleAssessment.js +5 -7
- package/build/scoring/assessments/seo/SingleTitleAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/SubHeadingsKeywordAssessment.js +4 -8
- package/build/scoring/assessments/seo/SubHeadingsKeywordAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/TextImagesAssessment.js +4 -8
- package/build/scoring/assessments/seo/TextImagesAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/TextLengthAssessment.js +4 -7
- package/build/scoring/assessments/seo/TextLengthAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/UrlKeywordAssessment.js +4 -8
- package/build/scoring/assessments/seo/UrlKeywordAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/UrlLengthAssessment.js +4 -7
- package/build/scoring/assessments/seo/UrlLengthAssessment.js.map +1 -1
- package/build/scoring/assessors/avadaAssessor.js +1 -0
- package/build/scoring/assessors/avadaAssessor.js.map +1 -1
- package/build/values/AssessmentResult.js +12 -30
- package/build/values/AssessmentResult.js.map +1 -1
- package/package.json +1 -1
|
@@ -45,22 +45,19 @@ class InternalLinksAssessment extends Assessment {
|
|
|
45
45
|
*
|
|
46
46
|
* @param {Paper} paper The paper to use for the assessment.
|
|
47
47
|
* @param {Researcher} researcher The researcher used for calling research.
|
|
48
|
-
* @param i18n
|
|
49
48
|
* @returns {AssessmentResult} The result of the assessment.
|
|
50
49
|
*/
|
|
51
50
|
getResult({
|
|
52
51
|
paper,
|
|
53
|
-
researcher
|
|
54
|
-
i18n
|
|
52
|
+
researcher
|
|
55
53
|
}) {
|
|
56
54
|
this.linkStatistics = researcher.getResearch('getLinkStatistics');
|
|
57
55
|
const assessmentResult = new AssessmentResult({
|
|
58
56
|
config: this._config
|
|
59
57
|
});
|
|
60
|
-
const calculatedResult = this.calculateResult(
|
|
58
|
+
const calculatedResult = this.calculateResult();
|
|
61
59
|
assessmentResult.setScore(calculatedResult.score);
|
|
62
60
|
assessmentResult.setStatus(calculatedResult.status);
|
|
63
|
-
assessmentResult.setBody(calculatedResult.body);
|
|
64
61
|
return assessmentResult;
|
|
65
62
|
}
|
|
66
63
|
|
|
@@ -76,11 +73,10 @@ class InternalLinksAssessment extends Assessment {
|
|
|
76
73
|
}
|
|
77
74
|
|
|
78
75
|
/**
|
|
79
|
-
* Returns a score and text based on the linkStatistics object.
|
|
80
76
|
*
|
|
81
|
-
* @returns {
|
|
77
|
+
* @returns {{score: number, status: string}}
|
|
82
78
|
*/
|
|
83
|
-
calculateResult(
|
|
79
|
+
calculateResult() {
|
|
84
80
|
let status = '';
|
|
85
81
|
if (this.linkStatistics.internalTotal === 0 || this.linkStatistics.internalNofollow === this.linkStatistics.internalTotal) {
|
|
86
82
|
status = 'bad';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalLinksAssessment.js","names":["merge","Assessment","AssessmentResult","LinkIcon","INTERNAL_LINKS_ID","InternalLinksAssessment","constructor","config","defaultConfig","id","fixPosition","docUrl","icon","priority","title","content","good","improve","bad","identifier","_config","getResult","paper","researcher","
|
|
1
|
+
{"version":3,"file":"InternalLinksAssessment.js","names":["merge","Assessment","AssessmentResult","LinkIcon","INTERNAL_LINKS_ID","InternalLinksAssessment","constructor","config","defaultConfig","id","fixPosition","docUrl","icon","priority","title","content","good","improve","bad","identifier","_config","getResult","paper","researcher","linkStatistics","getResearch","assessmentResult","calculatedResult","calculateResult","setScore","score","setStatus","status","isApplicable","hasText","internalTotal","internalNofollow","getScore"],"sources":["../../../../src/scoring/assessments/seo/InternalLinksAssessment.js"],"sourcesContent":["import {merge} from 'lodash';\nimport Assessment from '../assessment';\nimport AssessmentResult from '../../../values/AssessmentResult';\nimport {LinkIcon} from '@shopify/polaris-icons';\nimport {INTERNAL_LINKS_ID} from '@axyseo/const/analysis';\n\n/**\n * Assessment to check whether the text has internal links and whether they are followed or no-followed.\n */\nclass InternalLinksAssessment extends Assessment {\n /**\n * Sets the identifier and the config.\n *\n * @param {Object} [config] The configuration to use.\n * @param {number} [config.parameters.recommendedMinimum] The recommended minimum number of internal links in the text.\n * @param {number} [config.scores.allInternalFollow] The score to return if all internal links are do-follow.\n * @param {number} [config.scores.someInternalFollow] The score to return if some but not all internal links are do-follow.\n * @param {number} [config.scores.noneInternalFollow] The score to return if all internal links are no-follow.\n * @param {number} [config.scores.noInternal] The score to return if there are no internal links.\n * @param {string} [config.url] The URL to the relevant KB article.\n *\n * @returns {void}\n */\n constructor(config = {}) {\n super();\n\n const defaultConfig = {\n id: INTERNAL_LINKS_ID,\n fixPosition: '',\n docUrl:\n 'https://docs.avada.io/seo-suite-help-center/seo-audit/on-page-seo/checklist#internal-links-outbound-links',\n icon: LinkIcon,\n priority: 'high',\n title: 'Internal links',\n content: {\n good: 'Internal links are used effectively.',\n improve: '',\n bad: 'No internal links found. Add links to other relevant pages on your website.'\n }\n };\n\n this.identifier = INTERNAL_LINKS_ID;\n this._config = merge(defaultConfig, config);\n }\n\n /**\n * Runs the getLinkStatistics module, based on this returns an assessment result with score.\n *\n * @param {Paper} paper The paper to use for the assessment.\n * @param {Researcher} researcher The researcher used for calling research.\n * @returns {AssessmentResult} The result of the assessment.\n */\n getResult({paper, researcher}) {\n this.linkStatistics = researcher.getResearch('getLinkStatistics');\n const assessmentResult = new AssessmentResult({config: this._config});\n\n const calculatedResult = this.calculateResult();\n assessmentResult.setScore(calculatedResult.score);\n assessmentResult.setStatus(calculatedResult.status);\n\n return assessmentResult;\n }\n\n /**\n * Checks if assessment is applicable to the paper.\n *\n * @param {Paper} paper The paper to be analyzed.\n *\n * @returns {boolean} Whether the paper has text.\n */\n isApplicable(paper) {\n return paper.hasText();\n }\n\n /**\n *\n * @returns {{score: number, status: string}}\n */\n calculateResult() {\n let status = '';\n if (\n this.linkStatistics.internalTotal === 0 ||\n this.linkStatistics.internalNofollow === this.linkStatistics.internalTotal\n ) {\n status = 'bad';\n } else {\n status = 'good';\n }\n\n const score = this.getScore(this._config.priority, status);\n\n return {\n score,\n status\n };\n }\n}\n\nexport default InternalLinksAssessment;\n"],"mappings":"AAAA,SAAQA,KAAK,QAAO,QAAQ;AAC5B,OAAOC,UAAU;AACjB,OAAOC,gBAAgB;AACvB,SAAQC,QAAQ,QAAO,wBAAwB;AAC/C,SAAQC,iBAAiB;;AAEzB;AACA;AACA;AACA,MAAMC,uBAAuB,SAASJ,UAAU,CAAC;EAC/C;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEK,WAAWA,CAACC,MAAM,GAAG,CAAC,CAAC,EAAE;IACvB,KAAK,CAAC,CAAC;IAEP,MAAMC,aAAa,GAAG;MACpBC,EAAE,EAAEL,iBAAiB;MACrBM,WAAW,EAAE,EAAE;MACfC,MAAM,EACJ,2GAA2G;MAC7GC,IAAI,EAAET,QAAQ;MACdU,QAAQ,EAAE,MAAM;MAChBC,KAAK,EAAE,gBAAgB;MACvBC,OAAO,EAAE;Q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EA,eAAe3B,uBAAuB","ignoreList":[]}
|
|
@@ -42,22 +42,19 @@ class IntroductionKeywordAssessment extends Assessment {
|
|
|
42
42
|
* @param {Paper} paper The paper to use for the assessment.
|
|
43
43
|
* @param {Researcher} researcher The researcher used for calling research.
|
|
44
44
|
*
|
|
45
|
-
* @param i18n
|
|
46
45
|
* @returns {AssessmentResult} The result of this assessment.
|
|
47
46
|
*/
|
|
48
47
|
getResult({
|
|
49
48
|
paper,
|
|
50
|
-
researcher
|
|
51
|
-
i18n
|
|
49
|
+
researcher
|
|
52
50
|
}) {
|
|
53
51
|
const assessmentResult = new AssessmentResult({
|
|
54
52
|
config: this._config
|
|
55
53
|
});
|
|
56
54
|
this._firstParagraphMatches = researcher.getResearch('findKeywordInFirstParagraph');
|
|
57
|
-
const calculatedResult = this.calculateResult(
|
|
55
|
+
const calculatedResult = this.calculateResult();
|
|
58
56
|
assessmentResult.setScore(calculatedResult.score);
|
|
59
57
|
assessmentResult.setStatus(calculatedResult.status);
|
|
60
|
-
assessmentResult.setBody(calculatedResult.body);
|
|
61
58
|
return assessmentResult;
|
|
62
59
|
}
|
|
63
60
|
|
|
@@ -73,11 +70,10 @@ class IntroductionKeywordAssessment extends Assessment {
|
|
|
73
70
|
}
|
|
74
71
|
|
|
75
72
|
/**
|
|
76
|
-
* Returns a result based on the number of occurrences of keyphrase in the first paragraph.
|
|
77
73
|
*
|
|
78
|
-
* @returns {
|
|
74
|
+
* @returns {{score: number, status: string}}
|
|
79
75
|
*/
|
|
80
|
-
calculateResult(
|
|
76
|
+
calculateResult() {
|
|
81
77
|
let status = 'bad';
|
|
82
78
|
if (this._firstParagraphMatches.foundInOneSentence || this._firstParagraphMatches.foundInParagraph) {
|
|
83
79
|
status = 'good';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntroductionKeywordAssessment.js","names":["merge","Assessment","AssessmentResult","KeyIcon","INTRODUCTION_KEYWORD_ID","IntroductionKeywordAssessment","constructor","config","defaultConfig","id","ctaType","priority","docUrl","fixPosition","icon","title","content","improve","bad","good","identifier","_config","getResult","paper","researcher","
|
|
1
|
+
{"version":3,"file":"IntroductionKeywordAssessment.js","names":["merge","Assessment","AssessmentResult","KeyIcon","INTRODUCTION_KEYWORD_ID","IntroductionKeywordAssessment","constructor","config","defaultConfig","id","ctaType","priority","docUrl","fixPosition","icon","title","content","improve","bad","good","identifier","_config","getResult","paper","researcher","assessmentResult","_firstParagraphMatches","getResearch","calculatedResult","calculateResult","setScore","score","setStatus","status","isApplicable","hasKeyword","hasText","foundInOneSentence","foundInParagraph","getScore"],"sources":["../../../../src/scoring/assessments/seo/IntroductionKeywordAssessment.js"],"sourcesContent":["import {merge} from 'lodash';\nimport Assessment from '../assessment';\nimport AssessmentResult from '../../../values/AssessmentResult';\nimport {KeyIcon} from '@shopify/polaris-icons';\nimport {INTRODUCTION_KEYWORD_ID} from '@axyseo/const/analysis';\n\n/**\n * Assessment to check whether the keyphrase or synonyms are encountered in the first paragraph of the article.\n */\nclass IntroductionKeywordAssessment extends Assessment {\n /**\n * Sets the identifier and the config.\n *\n * @param {Object} [config] The configuration to use.\n * @param {string} [config.url] The URL to the relevant article on Yoast.com.\n *\n * @returns {void}\n */\n constructor(config = {}) {\n super();\n\n const defaultConfig = {\n id: INTRODUCTION_KEYWORD_ID,\n ctaType: 'fix',\n priority: 'low',\n docUrl:\n 'https://docs.avada.io/seo-suite-help-center/seo-audit/on-page-seo/checklist#keyword-in-introduction',\n fixPosition: 'highlightFirstParagraph',\n icon: KeyIcon,\n title: 'Introduction Keyword',\n content: {\n improve: '',\n bad: 'No keywords found in the first sentence. Add one to improve keyword rank.',\n good: 'Keyword is included in the first sentence.'\n }\n };\n\n this.identifier = INTRODUCTION_KEYWORD_ID;\n this._config = merge(defaultConfig, config);\n }\n\n /**\n * Assesses the presence of keyphrase or synonyms in the first paragraph.\n *\n * @param {Paper} paper The paper to use for the assessment.\n * @param {Researcher} researcher The researcher used for calling research.\n *\n * @returns {AssessmentResult} The result of this assessment.\n */\n getResult({paper, researcher}) {\n const assessmentResult = new AssessmentResult({config: this._config});\n\n this._firstParagraphMatches = researcher.getResearch('findKeywordInFirstParagraph');\n const calculatedResult = this.calculateResult();\n\n assessmentResult.setScore(calculatedResult.score);\n assessmentResult.setStatus(calculatedResult.status);\n\n return assessmentResult;\n }\n\n /**\n * Checks if the paper has both keyword and text.\n *\n * @param {Paper} paper The paper to be analyzed.\n *\n * @returns {boolean} Whether the assessment is applicable or not.\n */\n isApplicable(paper) {\n return paper.hasKeyword() && paper.hasText();\n }\n\n /**\n *\n * @returns {{score: number, status: string}}\n */\n calculateResult() {\n let status = 'bad';\n\n if (\n this._firstParagraphMatches.foundInOneSentence ||\n this._firstParagraphMatches.foundInParagraph\n ) {\n status = 'good';\n } else {\n status = 'bad';\n }\n\n const score = this.getScore(this._config.priority, status);\n\n return {\n score,\n status\n };\n }\n}\n\nexport default IntroductionKeywordAssessment;\n"],"mappings":"AAAA,SAAQA,KAAK,QAAO,QAAQ;AAC5B,OAAOC,UAAU;AACjB,OAAOC,gBAAgB;AACvB,SAAQC,OAAO,QAAO,wBAAwB;AAC9C,SAAQC,uBAAuB;;AAE/B;AACA;AACA;AACA,MAAMC,6BAA6B,SAASJ,UAAU,CAAC;EACrD;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEK,WAAWA,CAACC,MAAM,GAAG,CAAC,CAAC,EAAE;IACvB,KAAK,CAAC,CAAC;IAEP,MAAMC,aAAa,GAAG;MACpBC,EAAE,EAAEL,uBAAuB;MAC3BM,OAAO,EAAE,KAAK;MACdC,QAAQ,EAAE,KAAK;MACfC,MAAM,EACJ,qGAAqG;MACvGC,WAAW,EAAE,yBAAyB;MACtCC,IAAI,EAAEX,OAAO;MACbY,KAAK,EAAE,sBAAsB;MAC7BC,OAAO,EAAE;QACPC,OAAO,EAAE,EAAE;QACXC,GAAG,EAAE,2EAA2E;QAChFC,IAAI,EAAE;MACR;IACF,CAAC;IAED,IAAI,CAACC,U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* @param {Paper} paper The Paper object to assess.
|
|
39
39
|
* @param {Researcher} researcher The Researcher object containing all available researches.
|
|
40
40
|
*
|
|
41
|
-
* @param i18n
|
|
42
41
|
* @returns {AssessmentResult} The result of the assessment, containing both a score and a descriptive text.
|
|
43
42
|
*/
|
|
44
43
|
getResult({
|
|
45
44
|
paper,
|
|
46
|
-
researcher
|
|
47
|
-
i18n
|
|
45
|
+
researcher
|
|
48
46
|
}) {
|
|
49
47
|
const assessmentResult = new AssessmentResult({
|
|
50
48
|
config: this._config
|
|
51
49
|
});
|
|
52
|
-
const calculatedResult = this.calculateResult(paper
|
|
50
|
+
const calculatedResult = this.calculateResult(paper);
|
|
53
51
|
assessmentResult.setScore(calculatedResult.score);
|
|
54
52
|
assessmentResult.setStatus(calculatedResult.status);
|
|
55
|
-
assessmentResult.setBody(calculatedResult.body);
|
|
56
53
|
return assessmentResult;
|
|
57
54
|
}
|
|
58
55
|
|
|
@@ -71,10 +68,9 @@ class KeyphraseAssessment extends Assessment {
|
|
|
71
68
|
/**
|
|
72
69
|
*
|
|
73
70
|
* @param paper
|
|
74
|
-
* @
|
|
75
|
-
* @returns {{score: number, body: React.JSX.Element, status: string}}
|
|
71
|
+
* @returns {{score: number, status: (string)}}
|
|
76
72
|
*/
|
|
77
|
-
calculateResult(paper
|
|
73
|
+
calculateResult(paper) {
|
|
78
74
|
const status = (() => {
|
|
79
75
|
const hasKeyphrase = paper.hasKeyword();
|
|
80
76
|
return hasKeyphrase ? 'good' : 'bad';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyphraseAssessment.js","names":["merge","Assessment","AssessmentResult","KEYPHRASE_ID","KeyphraseAssessment","constructor","config","defaultConfig","id","docUrl","ctaType","fixPosition","priority","title","content","improve","bad","good","identifier","_config","getResult","paper","researcher","
|
|
1
|
+
{"version":3,"file":"KeyphraseAssessment.js","names":["merge","Assessment","AssessmentResult","KEYPHRASE_ID","KeyphraseAssessment","constructor","config","defaultConfig","id","docUrl","ctaType","fixPosition","priority","title","content","improve","bad","good","identifier","_config","getResult","paper","researcher","assessmentResult","calculatedResult","calculateResult","setScore","score","setStatus","status","isApplicable","hasKeyphrase","hasKeyword","getScore"],"sources":["../../../../src/scoring/assessments/seo/KeyphraseAssessment.js"],"sourcesContent":["import {merge} from 'lodash';\n\nimport Assessment from '../assessment';\nimport AssessmentResult from '../../../values/AssessmentResult';\nimport {KEYPHRASE_ID} from '@axyseo/const/analysis';\n\n/**\n * Represents the Slug keyword assessment. This assessment checks if the keyword is present in the slug.\n */\nclass KeyphraseAssessment extends Assessment {\n /**\n * Sets the identifier and the config.\n *\n * @param {Object} config The configuration to use.\n * @returns {void}\n */\n constructor(config = {}) {\n super();\n\n const defaultConfig = {\n id: KEYPHRASE_ID,\n docUrl:\n 'https://docs.avada.io/seo-suite-help-center/seo-audit/on-page-seo/checklist#use-of-main-keyword',\n ctaType: 'fix',\n fixPosition: 'keyword search',\n priority: 'high',\n title: 'Use of main keyword',\n content: {\n improve: '',\n bad: 'No keywords found. Include keywords throughout the text.',\n good: 'Main keyword is used effectively.'\n }\n };\n\n this.identifier = KEYPHRASE_ID;\n this._config = merge(defaultConfig, config);\n }\n\n /**\n * Executes the Assessment and returns a result.\n *\n * @param {Paper} paper The Paper object to assess.\n * @param {Researcher} researcher The Researcher object containing all available researches.\n *\n * @returns {AssessmentResult} The result of the assessment, containing both a score and a descriptive text.\n */\n getResult({paper, researcher}) {\n const assessmentResult = new AssessmentResult({config: this._config});\n\n const calculatedResult = this.calculateResult(paper);\n\n assessmentResult.setScore(calculatedResult.score);\n assessmentResult.setStatus(calculatedResult.status);\n return assessmentResult;\n }\n\n /**\n * Checks whether the paper has a keyword and a slug.\n *\n * @param {Paper} paper The paper to use for the assessment.\n * @param {Researcher} researcher The researcher object.\n *\n * @returns {boolean} True if the paper contains a keyword and a slug, and if the keywordCountInSlug research is available on the researcher.\n */\n isApplicable(paper, researcher) {\n return true;\n }\n\n /**\n *\n * @param paper\n * @returns {{score: number, status: (string)}}\n */\n calculateResult(paper) {\n const status = (() => {\n const hasKeyphrase = paper.hasKeyword();\n\n return hasKeyphrase ? 'good' : 'bad';\n })();\n\n const score = this.getScore(this._config.priority, status);\n\n return {\n score,\n status\n };\n }\n}\n\nexport default KeyphraseAssessment;\n"],"mappings":"AAAA,SAAQA,KAAK,QAAO,QAAQ;AAE5B,OAAOC,UAAU;AACjB,OAAOC,gBAAgB;AACvB,SAAQC,YAAY;;AAEpB;AACA;AACA;AACA,MAAMC,mBAAmB,SAASH,UAAU,CAAC;EAC3C;AACF;AACA;AACA;AACA;AACA;EACEI,WAAWA,CAACC,MAAM,GAAG,CAAC,CAAC,EAAE;IACvB,KAAK,CAAC,CAAC;IAEP,MAAMC,aAAa,GAAG;MACpBC,EAAE,EAAEL,YAAY;MAChBM,MAAM,EACJ,iGAAiG;MACnGC,OAAO,EAAE,KAAK;MACdC,WAAW,EAAE,gBAAgB;MAC7BC,QAAQ,EAAE,MAAM;MAChBC,KAAK,EAAE,qBAAqB;MAC5BC,OAAO,EAAE;QACPC,OAAO,EAAE,EAAE;QACXC,GAAG,EAAE,0DAA0D;QAC/DC,IAAI,EAAE;MACR;IACF,CAAC;IAED,IAAI,CAACC,UAAU,GAAGf,YAAY;IAC9B,IAAI,CAACgB,OAAO,GAAGnB,KAAK,CAACO,aAAa,EAAED,MAAM,CAAC;EAC7C;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEc,SAASA,CAAC;IAACC,KAAK;IAAEC;EAAU,CAAC,EAAE;IAC7B,MAAMC,gBAAgB,GAAG,IAAIrB,gBAAgB,CAAC;MAACI,MAAM,EAAE,IAAI,CAACa;IAAO,CAAC,CAAC;IAErE,MAAMK,gBAAgB,GAAG,IAAI,CAACC,eAAe,CAACJ,KAAK,CAAC;IAEpDE,gBAAgB,CAACG,QAAQ,CAACF,gBAAgB,CAACG,KAAK,CAAC;IACjDJ,gBAAgB,CAACK,SAAS,CAACJ,gBAAgB,CAACK,MAAM,CAAC;IACnD,OAAON,gBAAgB;EACzB;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEO,YAAYA,CAACT,KAAK,EAAEC,UAAU,EAAE;IAC9B,OAAO,IAAI;EACb;;EAEA;AACF;AACA;AACA;AACA;EACEG,eAAeA,CAACJ,KAAK,EAAE;IACrB,MAAMQ,MAAM,GAAG,CAAC,MAAM;MACpB,MAAME,YAAY,GAAGV,KAAK,CAACW,UAAU,CAAC,CAAC;MAEvC,OAAOD,YAAY,GAAG,MAAM,GAAG,KAAK;IACtC,CAAC,EAAE,CAAC;IAEJ,MAAMJ,KAAK,GAAG,IAAI,CAACM,QAAQ,CAAC,IAAI,CAACd,OAAO,CAACP,QAAQ,EAAEiB,MAAM,CAAC;IAE1D,OAAO;MACLF,KAAK;MACLE;IACF,CAAC;EACH;AACF;AAEA,eAAezB,mBAAmB","ignoreList":[]}
|
|
@@ -42,18 +42,16 @@ class KeyphraseLengthAssessment extends Assessment {
|
|
|
42
42
|
* @param {Paper} paper The paper to use for the assessment.
|
|
43
43
|
* @param {Researcher} researcher The researcher used for calling research.
|
|
44
44
|
*
|
|
45
|
-
* @param i18n
|
|
46
45
|
* @returns {AssessmentResult} The result of this assessment.
|
|
47
46
|
*/
|
|
48
47
|
getResult({
|
|
49
48
|
paper,
|
|
50
|
-
researcher
|
|
51
|
-
i18n
|
|
49
|
+
researcher
|
|
52
50
|
}) {
|
|
53
51
|
const assessmentResult = new AssessmentResult({
|
|
54
52
|
config: this._config
|
|
55
53
|
});
|
|
56
|
-
const calculatedResult = this.calculateResult(paper
|
|
54
|
+
const calculatedResult = this.calculateResult(paper);
|
|
57
55
|
assessmentResult.setScore(calculatedResult.score);
|
|
58
56
|
assessmentResult.setStatus(calculatedResult.status);
|
|
59
57
|
return assessmentResult;
|
|
@@ -64,7 +62,7 @@ class KeyphraseLengthAssessment extends Assessment {
|
|
|
64
62
|
*
|
|
65
63
|
* @returns {Object} Object with score and text.
|
|
66
64
|
*/
|
|
67
|
-
calculateResult(paper
|
|
65
|
+
calculateResult(paper) {
|
|
68
66
|
const keywordLength = countWords(paper.getKeyword());
|
|
69
67
|
let status = '';
|
|
70
68
|
if (keywordLength <= 4) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyphraseLengthAssessment.js","names":["merge","Assessment","AssessmentResult","KeyIcon","countWords","KEYPHRASE_LENGTH_ID","KeyphraseLengthAssessment","constructor","config","defaultConfig","id","ctaType","priority","docUrl","fixPosition","icon","title","content","improve","bad","good","identifier","_config","getResult","paper","researcher","
|
|
1
|
+
{"version":3,"file":"KeyphraseLengthAssessment.js","names":["merge","Assessment","AssessmentResult","KeyIcon","countWords","KEYPHRASE_LENGTH_ID","KeyphraseLengthAssessment","constructor","config","defaultConfig","id","ctaType","priority","docUrl","fixPosition","icon","title","content","improve","bad","good","identifier","_config","getResult","paper","researcher","assessmentResult","calculatedResult","calculateResult","setScore","score","setStatus","status","keywordLength","getKeyword","getScore","isApplicable","hasKeyword"],"sources":["../../../../src/scoring/assessments/seo/KeyphraseLengthAssessment.js"],"sourcesContent":["import {merge} from 'lodash';\nimport Assessment from '../assessment';\nimport AssessmentResult from '../../../values/AssessmentResult';\nimport {KeyIcon} from '@shopify/polaris-icons';\nimport {countWords} from '@axyseo/helpers';\nimport {KEYPHRASE_LENGTH_ID} from '@axyseo/const/analysis';\n\n/**\n * Assessment to check whether the keyphrase has a good length.\n */\nclass KeyphraseLengthAssessment extends Assessment {\n /**\n * Sets the identifier and the config.\n *\n * @param {Object} [config] The configuration to use.\n *\n * @returns {void}\n */\n constructor(config) {\n super();\n\n this.defaultConfig = {\n id: KEYPHRASE_LENGTH_ID,\n ctaType: 'fix',\n priority: 'low',\n docUrl:\n 'https://docs.avada.io/seo-suite-help-center/seo-audit/on-page-seo/checklist#keyword-length',\n fixPosition: 'keyword search',\n icon: KeyIcon,\n title: 'Keyword length',\n content: {\n improve: '',\n bad: 'Keyword too long. Keep keyword length less than 4 words for readability.',\n good: 'Keyword length is optimized, less than 4 words.'\n }\n };\n\n this.identifier = KEYPHRASE_LENGTH_ID;\n this._config = merge(this.defaultConfig, config);\n }\n\n /**\n * Assesses the keyphrase presence and length.\n *\n * @param {Paper} paper The paper to use for the assessment.\n * @param {Researcher} researcher The researcher used for calling research.\n *\n * @returns {AssessmentResult} The result of this assessment.\n */\n getResult({paper, researcher}) {\n const assessmentResult = new AssessmentResult({config: this._config});\n\n const calculatedResult = this.calculateResult(paper);\n\n assessmentResult.setScore(calculatedResult.score);\n assessmentResult.setStatus(calculatedResult.status);\n\n return assessmentResult;\n }\n\n /**\n * Calculates the result based on the keyphraseLength research.\n *\n * @returns {Object} Object with score and text.\n */\n calculateResult(paper) {\n const keywordLength = countWords(paper.getKeyword());\n\n let status = '';\n if (keywordLength <= 4) {\n status = 'good';\n } else {\n status = 'bad';\n }\n\n const score = this.getScore(this._config.priority, status);\n\n return {\n score,\n status\n };\n }\n\n /**\n * Checks whether the paper has a text.\n *\n * @param {Paper} paper The paper to use for the assessment.\n *\n * @returns {boolean} True when there is text.\n */\n isApplicable(paper) {\n return paper.hasKeyword();\n }\n}\n\nexport default KeyphraseLengthAssessment;\n"],"mappings":"AAAA,SAAQA,KAAK,QAAO,QAAQ;AAC5B,OAAOC,UAAU;AACjB,OAAOC,gBAAgB;AACvB,SAAQC,OAAO,QAAO,wBAAwB;AAC9C,SAAQC,UAAU;AAClB,SAAQC,mBAAmB;;AAE3B;AACA;AACA;AACA,MAAMC,yBAAyB,SAASL,UAAU,CAAC;EACjD;AACF;AACA;AACA;AACA;AACA;AACA;EACEM,WAAWA,CAACC,MAAM,EAAE;IAClB,KAAK,CAAC,CAAC;IAEP,IAAI,CAACC,aAAa,GAAG;MACnBC,EAAE,EAAEL,mBAAmB;MACvBM,OAAO,EAAE,KAAK;MACdC,QAAQ,EAAE,KAAK;MACfC,MAAM,EACJ,4FAA4F;MAC9FC,WAAW,EAAE,gBAAgB;MAC7BC,IAAI,EAAEZ,OAAO;MACba,K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yBAAyB","ignoreList":[]}
|
|
@@ -38,13 +38,11 @@ class KeyphraseDensityAssessment extends Assessment {
|
|
|
38
38
|
* @param {Paper} paper The paper to use for the assessment.
|
|
39
39
|
* @param {Researcher} researcher The researcher used for calling the research.
|
|
40
40
|
*
|
|
41
|
-
* @param i18n
|
|
42
41
|
* @returns {AssessmentResult} The result of the assessment.
|
|
43
42
|
*/
|
|
44
43
|
getResult({
|
|
45
44
|
paper,
|
|
46
|
-
researcher
|
|
47
|
-
i18n
|
|
45
|
+
researcher
|
|
48
46
|
}) {
|
|
49
47
|
this._keyphraseCount = researcher.getResearch('getKeyphraseCount');
|
|
50
48
|
const keyphraseLength = this._keyphraseCount.keyphraseLength;
|
|
@@ -53,7 +51,7 @@ class KeyphraseDensityAssessment extends Assessment {
|
|
|
53
51
|
const assessmentResult = new AssessmentResult({
|
|
54
52
|
config: this._config
|
|
55
53
|
});
|
|
56
|
-
const calculatedResult = this.calculateResult(paper
|
|
54
|
+
const calculatedResult = this.calculateResult(paper);
|
|
57
55
|
assessmentResult.setScore(calculatedResult.score);
|
|
58
56
|
assessmentResult.setStatus(calculatedResult.status);
|
|
59
57
|
assessmentResult.setTitle(calculatedResult.title);
|
|
@@ -61,11 +59,10 @@ class KeyphraseDensityAssessment extends Assessment {
|
|
|
61
59
|
}
|
|
62
60
|
|
|
63
61
|
/**
|
|
64
|
-
* Returns the score for the keyphrase density.
|
|
65
62
|
*
|
|
66
|
-
* @returns {
|
|
63
|
+
* @returns {{title: string, score: number, status: string}}
|
|
67
64
|
*/
|
|
68
|
-
calculateResult(
|
|
65
|
+
calculateResult() {
|
|
69
66
|
const density = this._keyphraseDensity;
|
|
70
67
|
const roundedDensity = parseFloat(density.toFixed(2));
|
|
71
68
|
let status = '';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeywordDensityAssessment.js","names":["merge","Assessment","AssessmentResult","keyphraseLengthFactor","KEYPHRASE_DENSITY_ID","KeyphraseDensityAssessment","constructor","config","defaultConfig","id","fixPosition","docUrl","ctaType","priority","title","content","good","bad","improve","identifier","_config","getResult","paper","researcher","
|
|
1
|
+
{"version":3,"file":"KeywordDensityAssessment.js","names":["merge","Assessment","AssessmentResult","keyphraseLengthFactor","KEYPHRASE_DENSITY_ID","KeyphraseDensityAssessment","constructor","config","defaultConfig","id","fixPosition","docUrl","ctaType","priority","title","content","good","bad","improve","identifier","_config","getResult","paper","researcher","_keyphraseCount","getResearch","keyphraseLength","_keyphraseDensity","assessmentResult","calculatedResult","calculateResult","setScore","score","setStatus","status","setTitle","density","roundedDensity","parseFloat","toFixed","getScore","isApplicable","hasText","hasKeyword"],"sources":["../../../../src/scoring/assessments/seo/KeywordDensityAssessment.js"],"sourcesContent":["import {merge} from 'lodash';\nimport Assessment from '../assessment';\nimport AssessmentResult from '../../../values/AssessmentResult';\n\nimport keyphraseLengthFactor from '../../../scoring/helpers/assessments/keyphraseLengthFactor';\nimport {KEYPHRASE_DENSITY_ID} from '@axyseo/const/analysis';\n\n/**\n * Represents the assessment that will look if the keyphrase density is within the recommended range.\n */\nclass KeyphraseDensityAssessment extends Assessment {\n /**\n *\n * @param config\n */\n constructor(config = {}) {\n super();\n\n const defaultConfig = {\n id: KEYPHRASE_DENSITY_ID,\n fixPosition: 'highlightKeyword',\n docUrl:\n 'https://docs.avada.io/seo-suite-help-center/seo-audit/on-page-seo/checklist#main-keyword-density',\n ctaType: 'fix',\n priority: 'high',\n title: 'Main keyword density',\n content: {\n good: 'Keyword density is optimized, between 1 - 1.5%.',\n bad: 'Keep keyword density from 1% - 1.5%.',\n improve: ''\n }\n };\n\n this.identifier = KEYPHRASE_DENSITY_ID;\n this._config = merge(defaultConfig, config);\n }\n\n /**\n * Runs the keyphrase density module, based on this returns an assessment\n * result with score.\n *\n * @param {Paper} paper The paper to use for the assessment.\n * @param {Researcher} researcher The researcher used for calling the research.\n *\n * @returns {AssessmentResult} The result of the assessment.\n */\n getResult({paper, researcher}) {\n this._keyphraseCount = researcher.getResearch('getKeyphraseCount');\n const keyphraseLength = this._keyphraseCount.keyphraseLength;\n\n this._keyphraseDensity = researcher.getResearch('getKeyphraseDensity');\n\n this._keyphraseDensity = this._keyphraseDensity * keyphraseLengthFactor(keyphraseLength);\n const assessmentResult = new AssessmentResult({config: this._config});\n\n const calculatedResult = this.calculateResult(paper);\n\n assessmentResult.setScore(calculatedResult.score);\n assessmentResult.setStatus(calculatedResult.status);\n assessmentResult.setTitle(calculatedResult.title);\n return assessmentResult;\n }\n\n /**\n *\n * @returns {{title: string, score: number, status: string}}\n */\n calculateResult() {\n const density = this._keyphraseDensity;\n const roundedDensity = parseFloat(density.toFixed(2));\n\n let status = '';\n if (roundedDensity >= 1 && roundedDensity <= 1.5) {\n status = 'good';\n } else {\n status = 'bad';\n }\n\n const score = this.getScore(this._config.priority, status);\n\n return {\n title: (this._config.title || 'Main keyword density') + ': ' + roundedDensity + '%',\n score,\n status\n };\n }\n\n /**\n * Checks whether the paper has a text of the minimum required length and a keyphrase is set. Language-specific length requirements and methods\n * of counting text length may apply (e.g. for Japanese, the text should be counted in characters instead of words, which also makes the minimum\n * required length higher).\n *\n * @param {Paper} \t\tpaper \t\tThe paper to use for the assessment.\n * @param {Researcher} researcher The paper to use for the assessment.\n *\n * @returns {boolean} True if applicable.\n */\n isApplicable(paper, researcher) {\n return paper.hasText() && paper.hasKeyword();\n }\n}\n\nexport default KeyphraseDensityAssessment;\n"],"mappings":"AAAA,SAAQA,KAAK,QAAO,QAAQ;AAC5B,OAAOC,UAAU;AACjB,OAAOC,gBAAgB;AAEvB,OAAOC,qBAAqB;AAC5B,SAAQC,oBAAoB;;AAE5B;AACA;AACA;AACA,MAAMC,0BAA0B,SAASJ,UAAU,CAAC;EAClD;AACF;AACA;AACA;EACEK,WAAWA,CAACC,MAAM,GAAG,CAAC,CAAC,EAAE;IACvB,KAAK,CAAC,CAAC;IAEP,MAAMC,aAAa,GAAG;MACpBC,EAAE,EAAEL,oBAAoB;MACxBM,WAAW,EAAE,k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U,CAACF,OAAO,CAACG,OAAO,CAAC,CAAC,CAAC,CAAC;IAErD,IAAIL,MAAM,GAAG,EAAE;IACf,IAAIG,cAAc,IAAI,CAAC,IAAIA,cAAc,IAAI,GAAG,EAAE;MAChDH,MAAM,GAAG,MAAM;IACjB,CAAC,MAAM;MACLA,MAAM,GAAG,KAAK;IAChB;IAEA,MAAMF,KAAK,GAAG,IAAI,CAACQ,QAAQ,CAAC,IAAI,CAACpB,OAAO,CAACP,QAAQ,EAAEqB,MAAM,CAAC;IAE1D,OAAO;MACLpB,KAAK,EAAE,CAAC,IAAI,CAACM,OAAO,CAACN,KAAK,IAAI,sBAAsB,IAAI,IAAI,GAAGuB,cAAc,GAAG,GAAG;MACnFL,KAAK;MACLE;IACF,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEO,YAAYA,CAACnB,KAAK,EAAEC,UAAU,EAAE;IAC9B,OAAOD,KAAK,CAACoB,OAAO,CAAC,CAAC,IAAIpB,KAAK,CAACqB,UAAU,CAAC,CAAC;EAC9C;AACF;AAEA,eAAetC,0BAA0B","ignoreList":[]}
|
|
@@ -46,30 +46,27 @@ class MetaDescriptionKeywordAssessment extends Assessment {
|
|
|
46
46
|
* @param {Paper} paper The paper to use for the assessment.
|
|
47
47
|
* @param {Researcher} researcher The researcher used for calling research.
|
|
48
48
|
*
|
|
49
|
-
* @param i18n
|
|
50
49
|
* @returns {AssessmentResult} The assessment result.
|
|
51
50
|
*/
|
|
52
51
|
getResult({
|
|
53
52
|
paper,
|
|
54
|
-
researcher
|
|
55
|
-
i18n
|
|
53
|
+
researcher
|
|
56
54
|
}) {
|
|
57
55
|
this._keyphraseCounts = researcher.getResearch('metaDescriptionKeyword');
|
|
58
56
|
const assessmentResult = new AssessmentResult({
|
|
59
57
|
config: this._config
|
|
60
58
|
});
|
|
61
|
-
const calculatedResult = this.calculateResult(paper
|
|
59
|
+
const calculatedResult = this.calculateResult(paper);
|
|
62
60
|
assessmentResult.setScore(calculatedResult.score);
|
|
63
61
|
assessmentResult.setStatus(calculatedResult.status);
|
|
64
62
|
return assessmentResult;
|
|
65
63
|
}
|
|
66
64
|
|
|
67
65
|
/**
|
|
68
|
-
* Returns the result object based on the number of keyword matches in the meta description.
|
|
69
66
|
*
|
|
70
|
-
* @returns {
|
|
67
|
+
* @returns {{score: number, status: string}}
|
|
71
68
|
*/
|
|
72
|
-
calculateResult(
|
|
69
|
+
calculateResult() {
|
|
73
70
|
let status = '';
|
|
74
71
|
if (this._keyphraseCounts > 0) {
|
|
75
72
|
status = 'good';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MetaDescriptionKeywordAssessment.js","names":["isNumber","merge","Assessment","AssessmentResult","KeyIcon","matchTextWithWord","META_DESCRIPTION_KEYWORD_ID","MetaDescriptionKeywordAssessment","constructor","config","defaultConfig","id","priority","fixPosition","ctaType","docUrl","icon","title","content","bad","good","improve","identifier","_config","getResult","paper","researcher","
|
|
1
|
+
{"version":3,"file":"MetaDescriptionKeywordAssessment.js","names":["isNumber","merge","Assessment","AssessmentResult","KeyIcon","matchTextWithWord","META_DESCRIPTION_KEYWORD_ID","MetaDescriptionKeywordAssessment","constructor","config","defaultConfig","id","priority","fixPosition","ctaType","docUrl","icon","title","content","bad","good","improve","identifier","_config","getResult","paper","researcher","_keyphraseCounts","getResearch","assessmentResult","calculatedResult","calculateResult","setScore","score","setStatus","status","getScore","isApplicable","hasKeyword","hasDescription"],"sources":["../../../../src/scoring/assessments/seo/MetaDescriptionKeywordAssessment.js"],"sourcesContent":["import {isNumber, merge} from 'lodash';\nimport Assessment from '../assessment';\nimport AssessmentResult from '../../../values/AssessmentResult';\nimport {KeyIcon} from '@shopify/polaris-icons';\nimport matchTextWithWord from '@axyseo/languageProcessing/helpers/match/matchTextWithWord';\nimport {META_DESCRIPTION_KEYWORD_ID} from '@axyseo/const/analysis';\n\n/**\n * Assessment for checking the keyword matches in the meta description.\n */\nclass MetaDescriptionKeywordAssessment extends Assessment {\n /**\n * Sets the identifier and the config.\n *\n * @param {Object} [config] The configuration to use.\n * @param {number} [config.parameters.recommendedMinimum] The recommended minimum of keyword occurrences in the meta description.\n * @param {number} [config.scores.good] The score to return if there are enough keyword occurrences in the meta description.\n * @param {number} [config.scores.bad] The score to return if there aren't enough keyword occurrences in the meta description.\n * @param {string} [config.url] The URL to the relevant article on Yoast.com.\n *\n * @returns {void}\n */\n constructor(config = {}) {\n super();\n\n const defaultConfig = {\n id: META_DESCRIPTION_KEYWORD_ID,\n priority: 'high',\n fixPosition: 'meta description',\n ctaType: 'fix',\n docUrl: 'https://help.seoon.io/seo/seo-checklist',\n icon: KeyIcon,\n title: 'Meta description keyword',\n content: {\n bad: 'No keywords found in meta description. Add at least one to improve keyword rank.',\n good: 'Keywords are included meta description.',\n improve: ''\n }\n };\n\n this.identifier = META_DESCRIPTION_KEYWORD_ID;\n this._config = merge(defaultConfig, config);\n }\n\n /**\n * Runs the metaDescriptionKeyword researcher and based on this, returns an assessment result with score.\n *\n * @param {Paper} paper The paper to use for the assessment.\n * @param {Researcher} researcher The researcher used for calling research.\n *\n * @returns {AssessmentResult} The assessment result.\n */\n getResult({paper, researcher}) {\n this._keyphraseCounts = researcher.getResearch('metaDescriptionKeyword');\n\n const assessmentResult = new AssessmentResult({config: this._config});\n const calculatedResult = this.calculateResult(paper);\n\n assessmentResult.setScore(calculatedResult.score);\n assessmentResult.setStatus(calculatedResult.status);\n\n return assessmentResult;\n }\n\n /**\n *\n * @returns {{score: number, status: string}}\n */\n calculateResult() {\n let status = '';\n if (this._keyphraseCounts > 0) {\n status = 'good';\n } else {\n status = 'bad';\n }\n const score = this.getScore(this._config.priority, status);\n\n return {\n score,\n status\n };\n }\n\n /**\n * Checks whether the paper has a keyword and a meta description.\n *\n * @param {Paper} paper The paper to use for the assessment.\n *\n * @returns {boolean} True if the paper has a keyword and a meta description.\n */\n isApplicable(paper) {\n return paper.hasKeyword() && paper.hasDescription();\n }\n}\n\nex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BAAgB,CAACK,SAAS,CAACJ,gBAAgB,CAACK,MAAM,CAAC;IAEnD,OAAON,gBAAgB;EACzB;;EAEA;AACF;AACA;AACA;EACEE,eAAeA,CAAA,EAAG;IAChB,IAAII,MAAM,GAAG,EAAE;IACf,IAAI,IAAI,CAACR,gBAAgB,GAAG,CAAC,EAAE;MAC7BQ,MAAM,GAAG,MAAM;IACjB,CAAC,MAAM;MACLA,MAAM,GAAG,KAAK;IAChB;IACA,MAAMF,KAAK,GAAG,IAAI,CAACG,QAAQ,CAAC,IAAI,CAACb,OAAO,CAACX,QAAQ,EAAEuB,MAAM,CAAC;IAE1D,OAAO;MACLF,KAAK;MACLE;IACF,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACEE,YAAYA,CAACZ,KAAK,EAAE;IAClB,OAAOA,KAAK,CAACa,UAAU,CAAC,CAAC,IAAIb,KAAK,CAACc,cAAc,CAAC,CAAC;EACrD;AACF;AAEA,eAAehC,gCAAgC","ignoreList":[]}
|
|
@@ -39,18 +39,16 @@ export default class MetaDescriptionLengthAssessment extends Assessment {
|
|
|
39
39
|
* @param {Paper} paper The paper to use for the assessment.
|
|
40
40
|
* @param {Researcher} researcher The researcher used for calling research.
|
|
41
41
|
*
|
|
42
|
-
* @param i18n
|
|
43
42
|
* @returns {AssessmentResult} The assessment result.
|
|
44
43
|
*/
|
|
45
44
|
getResult({
|
|
46
45
|
paper,
|
|
47
|
-
researcher
|
|
48
|
-
i18n
|
|
46
|
+
researcher
|
|
49
47
|
}) {
|
|
50
48
|
const assessmentResult = new AssessmentResult({
|
|
51
49
|
config: this._config
|
|
52
50
|
});
|
|
53
|
-
const calculatedResult = this.calculateResult(paper
|
|
51
|
+
const calculatedResult = this.calculateResult(paper);
|
|
54
52
|
assessmentResult.setScore(calculatedResult.score);
|
|
55
53
|
assessmentResult.setStatus(calculatedResult.status);
|
|
56
54
|
return assessmentResult;
|
|
@@ -59,10 +57,9 @@ export default class MetaDescriptionLengthAssessment extends Assessment {
|
|
|
59
57
|
/**
|
|
60
58
|
*
|
|
61
59
|
* @param paper
|
|
62
|
-
* @
|
|
63
|
-
* @returns {{score: number, body: React.JSX.Element, status: string}}
|
|
60
|
+
* @returns {{score: number, status: string}}
|
|
64
61
|
*/
|
|
65
|
-
calculateResult(paper
|
|
62
|
+
calculateResult(paper) {
|
|
66
63
|
const length = paper.getDescription().length;
|
|
67
64
|
let status = '';
|
|
68
65
|
if (length === 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MetaDescriptionLengthAssessment.js","names":["merge","Assessment","AssessmentResult","META_DESCRIPTION_LENGTH_ID","MetaDescriptionLengthAssessment","constructor","config","defaultConfig","id","ctaType","docUrl","priority","fixPosition","title","content","good","improve","bad","identifier","_config","getResult","paper","researcher","
|
|
1
|
+
{"version":3,"file":"MetaDescriptionLengthAssessment.js","names":["merge","Assessment","AssessmentResult","META_DESCRIPTION_LENGTH_ID","MetaDescriptionLengthAssessment","constructor","config","defaultConfig","id","ctaType","docUrl","priority","fixPosition","title","content","good","improve","bad","identifier","_config","getResult","paper","researcher","assessmentResult","calculatedResult","calculateResult","setScore","score","setStatus","status","length","getDescription","getScore","isApplicable"],"sources":["../../../../src/scoring/assessments/seo/MetaDescriptionLengthAssessment.js"],"sourcesContent":["import {merge} from 'lodash';\nimport Assessment from '../assessment';\nimport AssessmentResult from '../../../values/AssessmentResult';\nimport {META_DESCRIPTION_LENGTH_ID} from '@axyseo/const/analysis';\n\n/**\n * Assessment for calculating the length of the meta description.\n */\nexport default class MetaDescriptionLengthAssessment extends Assessment {\n /**\n * Sets the identifier and the config.\n *\n * @param {Object} [config] The configuration to use.\n *\n * @returns {void}\n */\n constructor(config = {}) {\n super();\n\n const defaultConfig = {\n id: META_DESCRIPTION_LENGTH_ID,\n ctaType: 'fix',\n docUrl:\n 'https://docs.avada.io/seo-suite-help-center/seo-audit/on-page-seo/checklist#meta-description',\n priority: 'high',\n fixPosition: 'meta description',\n title: 'Meta description length',\n content: {\n good: 'Meta description is optimized, less than 160 characters.',\n improve: 'Write a unique and compelling description of 150-160 characters.',\n bad:\n 'Missing meta description. Write a unique and compelling description under 160 characters.'\n }\n };\n\n this.identifier = META_DESCRIPTION_LENGTH_ID;\n this._config = merge(defaultConfig, config);\n }\n\n /**\n * Runs the metaDescriptionLength module, based on this returns an assessment result with score.\n *\n * @param {Paper} paper The paper to use for the assessment.\n * @param {Researcher} researcher The researcher used for calling research.\n *\n * @returns {AssessmentResult} The assessment result.\n */\n getResult({paper, researcher}) {\n const assessmentResult = new AssessmentResult({config: this._config});\n\n const calculatedResult = this.calculateResult(paper);\n\n assessmentResult.setScore(calculatedResult.score);\n assessmentResult.setStatus(calculatedResult.status);\n\n return assessmentResult;\n }\n\n /**\n *\n * @param paper\n * @returns {{score: number, status: string}}\n */\n calculateResult(paper) {\n const length = paper.getDescription().length;\n\n let status = '';\n\n if (length === 0) {\n status = 'bad';\n }\n if (length > 0 && (length < 150 || length > 160)) {\n status = 'improve';\n }\n\n if (length <= 160 && length >= 150) {\n status = 'good';\n }\n const score = this.getScore(this._config.priority, status);\n\n return {\n score,\n status\n };\n }\n\n /**\n * Checks whether the paper has a text.\n *\n * @param {Paper} paper The paper to use for the assessment.\n *\n * @returns true\n */\n isApplicable(paper) {\n return true;\n }\n}\n"],"mappings":"AAAA,SAAQA,KAAK,QAAO,QAAQ;AAC5B,OAAOC,UAAU;AACjB,OAAOC,gBAAgB;AACvB,SAAQC,0BAA0B;;AAElC;AACA;AACA;AACA,eAAe,MAAMC,+BAA+B,SAASH,UAAU,CAAC;EACtE;AACF;AACA;AACA;AACA;AACA;AACA;EACEI,WAAWA,CAACC,MAAM,GAAG,CAAC,CAAC,EAAE;IACvB,KAAK,CAAC,CAAC;IAEP,MAAMC,aAAa,GAAG;MACpBC,EAAE,EAAEL,0BAA0B;MAC9BM,OAAO,EAAE,KAAK;MACdC,MAAM,EACJ,8FAA8F;MAChGC,QAAQ,EAAE,MAAM;MAChBC,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AC;IAE1D,OAAO;MACLF,KAAK;MACLE;IACF,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACEI,YAAYA,CAACZ,KAAK,EAAE;IAClB,OAAO,IAAI;EACb;AACF","ignoreList":[]}
|
|
@@ -43,35 +43,27 @@ export default class MetaTitleKeywordAssessment extends Assessment {
|
|
|
43
43
|
* @param {Paper} paper The paper to use for the assessment.
|
|
44
44
|
* @param {Researcher} researcher The researcher used for calling research.
|
|
45
45
|
*
|
|
46
|
-
* @param i18n
|
|
47
46
|
* @returns {AssessmentResult} The assessment result.
|
|
48
47
|
*/
|
|
49
48
|
getResult({
|
|
50
49
|
paper,
|
|
51
|
-
researcher
|
|
52
|
-
i18n
|
|
50
|
+
researcher
|
|
53
51
|
}) {
|
|
54
52
|
this._keyphraseMatches = researcher.getResearch('findKeyphraseInSEOTitle');
|
|
55
53
|
const assessmentResult = new AssessmentResult({
|
|
56
54
|
config: this._config
|
|
57
55
|
});
|
|
58
|
-
const calculatedResult = this.calculateResult(
|
|
59
|
-
i18n
|
|
60
|
-
});
|
|
56
|
+
const calculatedResult = this.calculateResult();
|
|
61
57
|
assessmentResult.setScore(calculatedResult.score);
|
|
62
58
|
assessmentResult.setStatus(calculatedResult.status);
|
|
63
|
-
assessmentResult.setBody(calculatedResult.body);
|
|
64
59
|
return assessmentResult;
|
|
65
60
|
}
|
|
66
61
|
|
|
67
62
|
/**
|
|
68
|
-
* Returns the result object based on the number of keyword matches in the meta description.
|
|
69
63
|
*
|
|
70
|
-
* @returns {
|
|
64
|
+
* @returns {{score: number, status: string}}
|
|
71
65
|
*/
|
|
72
|
-
calculateResult({
|
|
73
|
-
i18n
|
|
74
|
-
}) {
|
|
66
|
+
calculateResult() {
|
|
75
67
|
const exactMatchFound = this._keyphraseMatches.exactMatchFound;
|
|
76
68
|
const allWordsFound = this._keyphraseMatches.allWordsFound;
|
|
77
69
|
const exactMatchKeyphrase = this._keyphraseMatches.exactMatchKeyphrase;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MetaTitleKeywordAssessment.js","names":["merge","Assessment","AssessmentResult","TITLE_KEYWORD_ID","MetaTitleKeywordAssessment","constructor","config","defaultConfig","id","docUrl","fixPosition","ctaType","priority","title","content","bad","good","improve","identifier","_config","getResult","paper","researcher","
|
|
1
|
+
{"version":3,"file":"MetaTitleKeywordAssessment.js","names":["merge","Assessment","AssessmentResult","TITLE_KEYWORD_ID","MetaTitleKeywordAssessment","constructor","config","defaultConfig","id","docUrl","fixPosition","ctaType","priority","title","content","bad","good","improve","identifier","_config","getResult","paper","researcher","_keyphraseMatches","getResearch","assessmentResult","calculatedResult","calculateResult","setScore","score","setStatus","status","exactMatchFound","allWordsFound","exactMatchKeyphrase","getScore","isApplicable","hasKeyword"],"sources":["../../../../src/scoring/assessments/seo/MetaTitleKeywordAssessment.js"],"sourcesContent":["import {merge} from 'lodash';\nimport Assessment from '../assessment';\nimport AssessmentResult from '../../../values/AssessmentResult';\nimport {TITLE_KEYWORD_ID} from '@axyseo/const/analysis';\n\n/**\n * Assessment for checking the keyword matches in the meta title.\n */\nexport default class MetaTitleKeywordAssessment extends Assessment {\n /**\n * Sets the identifier and the config.\n *\n * @param {Object} [config] The configuration to use.\n * @param {number} [config.parameters.recommendedMinimum] The recommended minimum of keyword occurrences in the meta description.\n * @param {number} [config.scores.good] The score to return if there are enough keyword occurrences in the meta description.\n * @param {number} [config.scores.bad] The score to return if there aren't enough keyword occurrences in the meta description.\n * @param {string} [config.url] The URL to the relevant article on Yoast.com.\n *\n * @returns {void}\n */\n constructor(config = {}) {\n super();\n\n const defaultConfig = {\n id: TITLE_KEYWORD_ID,\n docUrl:\n 'https://docs.avada.io/seo-suite-help-center/seo-audit/on-page-seo/checklist#keyword-in-title',\n fixPosition: 'meta title',\n ctaType: 'fix',\n priority: 'high',\n title: 'Keyword in meta title',\n content: {\n bad:\n 'No keywords found in meta title. Add one to improve keyword rank and click through rate.',\n good: 'Keyword is included in meta title.',\n improve: ''\n }\n };\n\n this.identifier = TITLE_KEYWORD_ID;\n this._config = merge(defaultConfig, config);\n }\n\n /**\n * Runs the metaDescriptionKeyword researcher and based on this, returns an assessment result with score.\n *\n * @param {Paper} paper The paper to use for the assessment.\n * @param {Researcher} researcher The researcher used for calling research.\n *\n * @returns {AssessmentResult} The assessment result.\n */\n getResult({paper, researcher}) {\n this._keyphraseMatches = researcher.getResearch('findKeyphraseInSEOTitle');\n\n const assessmentResult = new AssessmentResult({\n config: this._config\n });\n const calculatedResult = this.calculateResult();\n\n assessmentResult.setScore(calculatedResult.score);\n assessmentResult.setStatus(calculatedResult.status);\n\n return assessmentResult;\n }\n\n /**\n *\n * @returns {{score: number, status: string}}\n */\n calculateResult() {\n const exactMatchFound = this._keyphraseMatches.exactMatchFound;\n const allWordsFound = this._keyphraseMatches.allWordsFound;\n const exactMatchKeyphrase = this._keyphraseMatches.exactMatchKeyphrase;\n\n let status = 'bad';\n if (exactMatchFound === true || allWordsFound) {\n status = 'good';\n }\n if (exactMatchKeyphrase) {\n status = 'bad';\n }\n\n const score = this.getScore(this._config.priority, status);\n\n return {\n score,\n status\n };\n }\n\n /**\n * Checks whether the paper has a keyword and a meta description.\n *\n * @param {Paper} paper The paper to use for the assessment.\n *\n * @returns {boolean} True if the paper has a keyword and a meta description.\n */\n isApplicable(paper) {\n return paper.hasKeyword();\n }\n}\n"],"mappings":"AAAA,SAAQA,KAAK,QAAO,QAAQ;AAC5B,OAAOC,UAAU;AACjB,OAAOC,gBAAgB;AACvB,SAAQC,gBAAgB;;AAExB;AACA;AACA;AACA,eAAe,MAAMC,0BAA0B,SAASH,UAAU,CAAC;EACjE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEI,WAAWA,CAACC,MAAM,GAAG,CAAC,CAAC,EAAE;IACvB,KAAK,CAAC,CAAC;IAEP,MAAMC,aAAa,GAAG;MACpBC,EAAE,EAAEL,gBAAgB;MACpBM,MAAM,EACJ,8FAA8F;MA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,IAAI,CAACM,QAAQ,CAAC,IAAI,CAAChB,OAAO,CAACP,QAAQ,EAAEmB,MAAM,CAAC;IAE1D,OAAO;MACLF,KAAK;MACLE;IACF,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACEK,YAAYA,CAACf,KAAK,EAAE;IAClB,OAAOA,KAAK,CAACgB,UAAU,CAAC,CAAC;EAC3B;AACF","ignoreList":[]}
|
|
@@ -39,18 +39,16 @@ export default class NumberInMetaTitleAssessment extends Assessment {
|
|
|
39
39
|
*
|
|
40
40
|
* @param {Paper} paper The paper to use for the assessment.
|
|
41
41
|
* @param {Researcher} researcher The researcher used for calling the research.
|
|
42
|
-
* @param i18n
|
|
43
42
|
* @returns {AssessmentResult} The assessment result.
|
|
44
43
|
*/
|
|
45
44
|
getResult({
|
|
46
45
|
paper,
|
|
47
|
-
researcher
|
|
48
|
-
i18n
|
|
46
|
+
researcher
|
|
49
47
|
}) {
|
|
50
48
|
const assessmentResult = new AssessmentResult({
|
|
51
49
|
config: this._config
|
|
52
50
|
});
|
|
53
|
-
const calculatedResult = this.calculateResult(paper
|
|
51
|
+
const calculatedResult = this.calculateResult(paper);
|
|
54
52
|
assessmentResult.setScore(calculatedResult.score);
|
|
55
53
|
assessmentResult.setStatus(calculatedResult.status);
|
|
56
54
|
return assessmentResult;
|
|
@@ -59,10 +57,9 @@ export default class NumberInMetaTitleAssessment extends Assessment {
|
|
|
59
57
|
/**
|
|
60
58
|
*
|
|
61
59
|
* @param paper
|
|
62
|
-
* @param i18n
|
|
63
60
|
* @returns {{score: number, body: React.JSX.Element, status: string}}
|
|
64
61
|
*/
|
|
65
|
-
calculateResult(paper
|
|
62
|
+
calculateResult(paper) {
|
|
66
63
|
const title = paper.getTitle();
|
|
67
64
|
let status = '';
|
|
68
65
|
if (!/\d/.test(title)) {
|