axyseo 2025.1.0-blog.12 → 2025.1.0-blog.13
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/cjs/scoring/assessments/seo/SingleH1Assessment.js +3 -9
- package/build/cjs/scoring/assessments/seo/SingleH1Assessment.js.map +1 -1
- package/build/cjs/scoring/assessments/seo/SingleTitleAssessment.js +6 -4
- package/build/cjs/scoring/assessments/seo/SingleTitleAssessment.js.map +1 -1
- package/build/esm/scoring/assessments/seo/SingleH1Assessment.js +3 -9
- package/build/esm/scoring/assessments/seo/SingleH1Assessment.js.map +1 -1
- package/build/esm/scoring/assessments/seo/SingleTitleAssessment.js +6 -4
- package/build/esm/scoring/assessments/seo/SingleTitleAssessment.js.map +1 -1
- package/package.json +1 -1
|
@@ -72,15 +72,9 @@ class SingleH1Assessment extends _assessment.default {
|
|
|
72
72
|
const htmlString = paper.getText();
|
|
73
73
|
const desHasH1Tag = htmlString.includes('<h1>');
|
|
74
74
|
let status = '';
|
|
75
|
-
if (this._h1Count === 1)
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (this._h1Count === 0 && !desHasH1Tag) {
|
|
79
|
-
status = 'good';
|
|
80
|
-
}
|
|
81
|
-
if (this._h1Count > 1) {
|
|
82
|
-
status = 'bad';
|
|
83
|
-
}
|
|
75
|
+
if (this._h1Count === 1) status = 'good';
|
|
76
|
+
if (this._h1Count === 0 && !desHasH1Tag) status = 'good';
|
|
77
|
+
if (this._h1Count > 1) status = 'bad';
|
|
84
78
|
const score = this.getScore(_analysis.TECHNICAL_SEO_POINTS, status);
|
|
85
79
|
return {
|
|
86
80
|
score,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SingleH1Assessment.js","names":["_lodash","require","_assessment","_interopRequireDefault","_AssessmentResult","_analysis","e","__esModule","default","SingleH1Assessment","Assessment","constructor","config","defaultConfig","id","SINGLE_H1_ID","docUrl","fixPosition","ctaType","priority","title","content","good","improve","bad","identifier","_config","merge","getResult","paper","researcher","_h1Count","getResearch","assessmentResult","AssessmentResult","calculatedResult","calculateResult","isUndefined","setScore","score","setStatus","status","htmlString","getText","desHasH1Tag","includes","getScore","TECHNICAL_SEO_POINTS","isApplicable","_default","exports"],"sources":["../../../../../src/scoring/assessments/seo/SingleH1Assessment.js"],"sourcesContent":["import {isUndefined, merge} from 'lodash';\nimport Assessment from '../assessment.js';\nimport AssessmentResult from '../../../values/AssessmentResult.js';\nimport {SINGLE_H1_ID, TECHNICAL_SEO_POINTS} from '@axyseo/const/analysis';\n\n/**\n * Assessment to check whether the body of the text contains more than 1 H1s in the body.\n * This assessment doesn't penalize H1 that is not in the very beginning of the body.\n */\nclass SingleH1Assessment 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: SINGLE_H1_ID,\n docUrl: 'https://help.seoon.io/seo/seo-checklist',\n fixPosition: 'description',\n ctaType: 'contactUs',\n priority: 'high',\n title: 'H1 tag',\n content: {\n good: 'H1 tag is optimized.',\n improve: 'You should use only one H1 tag',\n bad: 'Missing H1 tag. Add one H1 to clearly define your page`s topic.'\n }\n };\n\n this.identifier = SINGLE_H1_ID;\n this._config = merge(defaultConfig, config);\n }\n\n /**\n * Runs the h1 research and based on this returns an assessment result with a 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 * @returns {AssessmentResult} The assessment result.\n */\n getResult({paper, researcher}) {\n this._h1Count = researcher.getResearch('h1s');\n const assessmentResult = new AssessmentResult({config: this._config});\n\n const calculatedResult = this.calculateResult(paper);\n\n if (!isUndefined(calculatedResult)) {\n assessmentResult.setScore(calculatedResult.score);\n assessmentResult.setStatus(calculatedResult.status);\n }\n\n return assessmentResult;\n }\n\n /**\n *\n * @param paper\n * @returns {{score: number, status: string}}\n */\n calculateResult(paper) {\n const htmlString = paper.getText();\n const desHasH1Tag = htmlString.includes('<h1>');\n\n let status = '';\n if (this._h1Count === 1)
|
|
1
|
+
{"version":3,"file":"SingleH1Assessment.js","names":["_lodash","require","_assessment","_interopRequireDefault","_AssessmentResult","_analysis","e","__esModule","default","SingleH1Assessment","Assessment","constructor","config","defaultConfig","id","SINGLE_H1_ID","docUrl","fixPosition","ctaType","priority","title","content","good","improve","bad","identifier","_config","merge","getResult","paper","researcher","_h1Count","getResearch","assessmentResult","AssessmentResult","calculatedResult","calculateResult","isUndefined","setScore","score","setStatus","status","htmlString","getText","desHasH1Tag","includes","getScore","TECHNICAL_SEO_POINTS","isApplicable","_default","exports"],"sources":["../../../../../src/scoring/assessments/seo/SingleH1Assessment.js"],"sourcesContent":["import {isUndefined, merge} from 'lodash';\nimport Assessment from '../assessment.js';\nimport AssessmentResult from '../../../values/AssessmentResult.js';\nimport {SINGLE_H1_ID, TECHNICAL_SEO_POINTS} from '@axyseo/const/analysis';\n\n/**\n * Assessment to check whether the body of the text contains more than 1 H1s in the body.\n * This assessment doesn't penalize H1 that is not in the very beginning of the body.\n */\nclass SingleH1Assessment 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: SINGLE_H1_ID,\n docUrl: 'https://help.seoon.io/seo/seo-checklist',\n fixPosition: 'description',\n ctaType: 'contactUs',\n priority: 'high',\n title: 'H1 tag',\n content: {\n good: 'H1 tag is optimized.',\n improve: 'You should use only one H1 tag',\n bad: 'Missing H1 tag. Add one H1 to clearly define your page`s topic.'\n }\n };\n\n this.identifier = SINGLE_H1_ID;\n this._config = merge(defaultConfig, config);\n }\n\n /**\n * Runs the h1 research and based on this returns an assessment result with a 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 * @returns {AssessmentResult} The assessment result.\n */\n getResult({paper, researcher}) {\n this._h1Count = researcher.getResearch('h1s');\n const assessmentResult = new AssessmentResult({config: this._config});\n\n const calculatedResult = this.calculateResult(paper);\n\n if (!isUndefined(calculatedResult)) {\n assessmentResult.setScore(calculatedResult.score);\n assessmentResult.setStatus(calculatedResult.status);\n }\n\n return assessmentResult;\n }\n\n /**\n *\n * @param paper\n * @returns {{score: number, status: string}}\n */\n calculateResult(paper) {\n const htmlString = paper.getText();\n const desHasH1Tag = htmlString.includes('<h1>');\n\n let status = '';\n if (this._h1Count === 1) status = 'good';\n if (this._h1Count === 0 && !desHasH1Tag) status = 'good';\n if (this._h1Count > 1) status = 'bad';\n\n const score = this.getScore(TECHNICAL_SEO_POINTS, 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 true;\n }\n}\n\nexport default SingleH1Assessment;\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAA0E,SAAAE,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE1E;AACA;AACA;AACA;AACA,MAAMG,kBAAkB,SAASC,mBAAU,CAAC;EAC1C;AACF;AACA;AACA;AACA;AACA;AACA;EACEC,WAAWA,CAACC,MAAM,GAAG,CAAC,CAAC,EAAE;IACvB,KAAK,CAAC,CAAC;IAEP,MAAMC,aAAa,GAAG;MACpBC,EAAE,EAAEC,sBAAY;MAChBC,MAAM,EAAE,yCAAyC;MACjDC,WAAW,EAAE,aAAa;MAC1BC,OAAO,EAAE,WAAW;MACpBC,QAAQ,EAAE,MAAM;MAChBC,KAAK,EAAE,QAAQ;MACfC,OAAO,EAAE;QACPC,IAAI,EAAE,sBAAs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M,CAAC;IAEzD,OAAO;MACLF,KAAK;MACLE;IACF,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACEO,YAAYA,CAACnB,KAAK,EAAE;IAClB,OAAO,IAAI;EACb;AACF;AAAC,IAAAoB,QAAA,GAAAC,OAAA,CAAA1C,OAAA,GAEcC,kBAAkB","ignoreList":[]}
|
|
@@ -67,10 +67,12 @@ class SingleTitleAssessment extends _assessment.default {
|
|
|
67
67
|
* @returns {{score: number, status: string}}
|
|
68
68
|
*/
|
|
69
69
|
calculateResult(paper) {
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
const title = paper.getTitle();
|
|
71
|
+
const bodyText = paper.getText();
|
|
72
|
+
let status = 'good';
|
|
73
|
+
if (title && bodyText) {
|
|
74
|
+
const titleLower = title.toLowerCase().trim();
|
|
75
|
+
if (titleLower && bodyText.toLowerCase().includes(titleLower)) status = 'bad';
|
|
74
76
|
}
|
|
75
77
|
const score = this.getScore(_analysis.TECHNICAL_SEO_POINTS, status);
|
|
76
78
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SingleTitleAssessment.js","names":["_lodash","require","_assessment","_interopRequireDefault","_AssessmentResult","_analysis","e","__esModule","default","SingleTitleAssessment","Assessment","constructor","config","defaultConfig","id","SINGLE_TITLE_ID","docUrl","ctaType","priority","title","content","improve","bad","good","identifier","_config","merge","getResult","paper","researcher","assessmentResult","AssessmentResult","calculatedResult","calculateResult","isUndefined","setScore","score","setStatus","status","
|
|
1
|
+
{"version":3,"file":"SingleTitleAssessment.js","names":["_lodash","require","_assessment","_interopRequireDefault","_AssessmentResult","_analysis","e","__esModule","default","SingleTitleAssessment","Assessment","constructor","config","defaultConfig","id","SINGLE_TITLE_ID","docUrl","ctaType","priority","title","content","improve","bad","good","identifier","_config","merge","getResult","paper","researcher","assessmentResult","AssessmentResult","calculatedResult","calculateResult","isUndefined","setScore","score","setStatus","status","getTitle","bodyText","getText","titleLower","toLowerCase","trim","includes","getScore","TECHNICAL_SEO_POINTS","isApplicable","_default","exports"],"sources":["../../../../../src/scoring/assessments/seo/SingleTitleAssessment.js"],"sourcesContent":["import {isUndefined, merge} from 'lodash';\nimport Assessment from '../assessment.js';\nimport AssessmentResult from '../../../values/AssessmentResult.js';\nimport {SINGLE_TITLE_ID, TECHNICAL_SEO_POINTS} from '@axyseo/const/analysis';\n\n/**\n * Assessment to check whether the body of the text contains more than 1 H1s in the body.\n * This assessment doesn't penalize H1 that is not in the very beginning of the body.\n */\nclass SingleTitleAssessment 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: SINGLE_TITLE_ID,\n docUrl: 'https://help.seoon.io/seo/seo-checklist',\n ctaType: 'contactUs',\n priority: 'high',\n title: 'Duplicate title',\n content: {\n improve: '',\n bad: 'Found duplicate titles. Check your content and create unique titles.',\n good: 'No duplicate titles found.'\n }\n };\n\n this.identifier = SINGLE_TITLE_ID;\n this._config = merge(defaultConfig, config);\n }\n\n /**\n * Runs the h1 research and based on this returns an assessment result with a 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 * @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 if (!isUndefined(calculatedResult)) {\n assessmentResult.setScore(calculatedResult.score);\n assessmentResult.setStatus(calculatedResult.status);\n }\n\n return assessmentResult;\n }\n\n /**\n *\n * @param paper\n * @returns {{score: number, status: string}}\n */\n calculateResult(paper) {\n const title = paper.getTitle();\n const bodyText = paper.getText();\n\n let status = 'good';\n if (title && bodyText) {\n const titleLower = title.toLowerCase().trim();\n if (titleLower && bodyText.toLowerCase().includes(titleLower)) status = 'bad';\n }\n\n const score = this.getScore(TECHNICAL_SEO_POINTS, 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 true;\n }\n}\n\nexport default SingleTitleAssessment;\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAA6E,SAAAE,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE7E;AACA;AACA;AACA;AACA,MAAMG,qBAAqB,SAASC,mBAAU,CAAC;EAC7C;AACF;AACA;AACA;AACA;AACA;AACA;EACEC,WAAWA,CAACC,MAAM,GAAG,CAAC,CAAC,EAAE;IACvB,KAAK,CAAC,CAAC;IAEP,MAAMC,aAAa,GAAG;MACpBC,EAAE,EAAEC,yBAAe;MACnBC,MAAM,EAAE,yCAAyC;MACjDC,OAAO,EAAE,WAAW;MACpBC,QAAQ,EAAE,MAAM;MAChBC,KAAK,EAAE,iBAAiB;MACxBC,OAAO,EAAE;QACPC,OAAO,EAAE,EAAE;QACXC,GAAG,EAAE,sEAAsE;QAC3EC,IAAI,EAAE;MACR;IACF,CAAC;IAED,IAAI,CAACC,UAAU,GAAGT,yBAAe;IACjC,IAAI,CAACU,OAAO,GAAG,IAAAC,aAAK,EAACb,aAAa,EAAED,MAAM,CAAC;EAC7C;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACEe,SAASA,CAAC;IAACC,KAAK;IAAEC;EAAU,CAAC,EAAE;IAC7B,MAAMC,gBAAgB,GAAG,IAAIC,yBAAgB,CAAC;MAACnB,MAAM,EAAE,IAAI,CAACa;IAAO,CAAC,CAAC;IAErE,MAAMO,gBAAgB,GAAG,IAAI,CAACC,eAAe,CAACL,KAAK,CAAC;IAEpD,IAAI,CAAC,IAAAM,mBAAW,EAACF,gBAAgB,CAAC,EAAE;MAClCF,gBAAgB,CAACK,QAAQ,CAACH,gBAAgB,CAACI,KAAK,CAAC;MACjDN,gBAAgB,CAACO,SAAS,CAACL,gBAAgB,CAACM,MAAM,CAAC;IACrD;IAEA,OAAOR,gBAAgB;EACzB;;EAEA;AACF;AACA;AACA;AACA;EACEG,eAAeA,CAACL,KAAK,EAAE;IACrB,MAAMT,KAAK,GAAGS,KAAK,CAACW,QAAQ,CAAC,CAAC;IAC9B,MAAMC,QAAQ,GAAGZ,KAAK,CAACa,OAAO,CAAC,CAAC;IAEhC,IAAIH,MAAM,GAAG,MAAM;IACnB,IAAInB,KAAK,IAAIqB,QAAQ,EAAE;MACrB,MAAME,UAAU,GAAGvB,KAAK,CAACwB,WAAW,CAAC,CAAC,CAACC,IAAI,CAAC,CAAC;MAC7C,IAAIF,UAAU,IAAIF,QAAQ,CAACG,WAAW,CAAC,CAAC,CAACE,QAAQ,CAACH,UAAU,CAAC,EAAEJ,MAAM,GAAG,KAAK;IAC/E;IAEA,MAAMF,KAAK,GAAG,IAAI,CAACU,QAAQ,CAACC,8BAAoB,EAAET,MAAM,CAAC;IAEzD,OAAO;MACLF,KAAK;MACLE;IACF,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACEU,YAAYA,CAACpB,KAAK,EAAE;IAClB,OAAO,IAAI;EACb;AACF;AAAC,IAAAqB,QAAA,GAAAC,OAAA,CAAA1C,OAAA,GAEcC,qBAAqB","ignoreList":[]}
|
|
@@ -66,15 +66,9 @@ class SingleH1Assessment extends Assessment {
|
|
|
66
66
|
const htmlString = paper.getText();
|
|
67
67
|
const desHasH1Tag = htmlString.includes('<h1>');
|
|
68
68
|
let status = '';
|
|
69
|
-
if (this._h1Count === 1)
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
if (this._h1Count === 0 && !desHasH1Tag) {
|
|
73
|
-
status = 'good';
|
|
74
|
-
}
|
|
75
|
-
if (this._h1Count > 1) {
|
|
76
|
-
status = 'bad';
|
|
77
|
-
}
|
|
69
|
+
if (this._h1Count === 1) status = 'good';
|
|
70
|
+
if (this._h1Count === 0 && !desHasH1Tag) status = 'good';
|
|
71
|
+
if (this._h1Count > 1) status = 'bad';
|
|
78
72
|
const score = this.getScore(TECHNICAL_SEO_POINTS, status);
|
|
79
73
|
return {
|
|
80
74
|
score,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SingleH1Assessment.js","names":["isUndefined","merge","Assessment","AssessmentResult","SINGLE_H1_ID","TECHNICAL_SEO_POINTS","SingleH1Assessment","constructor","config","defaultConfig","id","docUrl","fixPosition","ctaType","priority","title","content","good","improve","bad","identifier","_config","getResult","paper","researcher","_h1Count","getResearch","assessmentResult","calculatedResult","calculateResult","setScore","score","setStatus","status","htmlString","getText","desHasH1Tag","includes","getScore","isApplicable"],"sources":["../../../../../src/scoring/assessments/seo/SingleH1Assessment.js"],"sourcesContent":["import {isUndefined, merge} from 'lodash';\nimport Assessment from '../assessment.js';\nimport AssessmentResult from '../../../values/AssessmentResult.js';\nimport {SINGLE_H1_ID, TECHNICAL_SEO_POINTS} from '@axyseo/const/analysis';\n\n/**\n * Assessment to check whether the body of the text contains more than 1 H1s in the body.\n * This assessment doesn't penalize H1 that is not in the very beginning of the body.\n */\nclass SingleH1Assessment 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: SINGLE_H1_ID,\n docUrl: 'https://help.seoon.io/seo/seo-checklist',\n fixPosition: 'description',\n ctaType: 'contactUs',\n priority: 'high',\n title: 'H1 tag',\n content: {\n good: 'H1 tag is optimized.',\n improve: 'You should use only one H1 tag',\n bad: 'Missing H1 tag. Add one H1 to clearly define your page`s topic.'\n }\n };\n\n this.identifier = SINGLE_H1_ID;\n this._config = merge(defaultConfig, config);\n }\n\n /**\n * Runs the h1 research and based on this returns an assessment result with a 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 * @returns {AssessmentResult} The assessment result.\n */\n getResult({paper, researcher}) {\n this._h1Count = researcher.getResearch('h1s');\n const assessmentResult = new AssessmentResult({config: this._config});\n\n const calculatedResult = this.calculateResult(paper);\n\n if (!isUndefined(calculatedResult)) {\n assessmentResult.setScore(calculatedResult.score);\n assessmentResult.setStatus(calculatedResult.status);\n }\n\n return assessmentResult;\n }\n\n /**\n *\n * @param paper\n * @returns {{score: number, status: string}}\n */\n calculateResult(paper) {\n const htmlString = paper.getText();\n const desHasH1Tag = htmlString.includes('<h1>');\n\n let status = '';\n if (this._h1Count === 1)
|
|
1
|
+
{"version":3,"file":"SingleH1Assessment.js","names":["isUndefined","merge","Assessment","AssessmentResult","SINGLE_H1_ID","TECHNICAL_SEO_POINTS","SingleH1Assessment","constructor","config","defaultConfig","id","docUrl","fixPosition","ctaType","priority","title","content","good","improve","bad","identifier","_config","getResult","paper","researcher","_h1Count","getResearch","assessmentResult","calculatedResult","calculateResult","setScore","score","setStatus","status","htmlString","getText","desHasH1Tag","includes","getScore","isApplicable"],"sources":["../../../../../src/scoring/assessments/seo/SingleH1Assessment.js"],"sourcesContent":["import {isUndefined, merge} from 'lodash';\nimport Assessment from '../assessment.js';\nimport AssessmentResult from '../../../values/AssessmentResult.js';\nimport {SINGLE_H1_ID, TECHNICAL_SEO_POINTS} from '@axyseo/const/analysis';\n\n/**\n * Assessment to check whether the body of the text contains more than 1 H1s in the body.\n * This assessment doesn't penalize H1 that is not in the very beginning of the body.\n */\nclass SingleH1Assessment 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: SINGLE_H1_ID,\n docUrl: 'https://help.seoon.io/seo/seo-checklist',\n fixPosition: 'description',\n ctaType: 'contactUs',\n priority: 'high',\n title: 'H1 tag',\n content: {\n good: 'H1 tag is optimized.',\n improve: 'You should use only one H1 tag',\n bad: 'Missing H1 tag. Add one H1 to clearly define your page`s topic.'\n }\n };\n\n this.identifier = SINGLE_H1_ID;\n this._config = merge(defaultConfig, config);\n }\n\n /**\n * Runs the h1 research and based on this returns an assessment result with a 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 * @returns {AssessmentResult} The assessment result.\n */\n getResult({paper, researcher}) {\n this._h1Count = researcher.getResearch('h1s');\n const assessmentResult = new AssessmentResult({config: this._config});\n\n const calculatedResult = this.calculateResult(paper);\n\n if (!isUndefined(calculatedResult)) {\n assessmentResult.setScore(calculatedResult.score);\n assessmentResult.setStatus(calculatedResult.status);\n }\n\n return assessmentResult;\n }\n\n /**\n *\n * @param paper\n * @returns {{score: number, status: string}}\n */\n calculateResult(paper) {\n const htmlString = paper.getText();\n const desHasH1Tag = htmlString.includes('<h1>');\n\n let status = '';\n if (this._h1Count === 1) status = 'good';\n if (this._h1Count === 0 && !desHasH1Tag) status = 'good';\n if (this._h1Count > 1) status = 'bad';\n\n const score = this.getScore(TECHNICAL_SEO_POINTS, 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 true;\n }\n}\n\nexport default SingleH1Assessment;\n"],"mappings":"AAAA,SAAQA,WAAW,EAAEC,KAAK,QAAO,QAAQ;AACzC,OAAOC,UAAU;AACjB,OAAOC,gBAAgB;AACvB,SAAQC,YAAY,EAAEC,oBAAoB;;AAE1C;AACA;AACA;AACA;AACA,MAAMC,kBAAkB,SAASJ,UAAU,CAAC;EAC1C;AACF;AACA;AACA;AACA;AACA;AACA;EACEK,WAAWA,CAACC,MAAM,GAAG,CAAC,CAAC,EAAE;IACvB,KAAK,CAAC,CAAC;IAEP,MAAMC,aAAa,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AAQ,KAAK,CAAC,IAAI,CAACW,WAAW,EAAEH,MAAM,GAAG,MAAM;IACxD,IAAI,IAAI,CAACR,QAAQ,GAAG,CAAC,EAAEQ,MAAM,GAAG,KAAK;IAErC,MAAMF,KAAK,GAAG,IAAI,CAACO,QAAQ,CAACjC,oBAAoB,EAAE4B,MAAM,CAAC;IAEzD,OAAO;MACLF,KAAK;MACLE;IACF,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACEM,YAAYA,CAAChB,KAAK,EAAE;IAClB,OAAO,IAAI;EACb;AACF;AAEA,eAAejB,kBAAkB","ignoreList":[]}
|
|
@@ -61,10 +61,12 @@ class SingleTitleAssessment extends Assessment {
|
|
|
61
61
|
* @returns {{score: number, status: string}}
|
|
62
62
|
*/
|
|
63
63
|
calculateResult(paper) {
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
const title = paper.getTitle();
|
|
65
|
+
const bodyText = paper.getText();
|
|
66
|
+
let status = 'good';
|
|
67
|
+
if (title && bodyText) {
|
|
68
|
+
const titleLower = title.toLowerCase().trim();
|
|
69
|
+
if (titleLower && bodyText.toLowerCase().includes(titleLower)) status = 'bad';
|
|
68
70
|
}
|
|
69
71
|
const score = this.getScore(TECHNICAL_SEO_POINTS, status);
|
|
70
72
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SingleTitleAssessment.js","names":["isUndefined","merge","Assessment","AssessmentResult","SINGLE_TITLE_ID","TECHNICAL_SEO_POINTS","SingleTitleAssessment","constructor","config","defaultConfig","id","docUrl","ctaType","priority","title","content","improve","bad","good","identifier","_config","getResult","paper","researcher","assessmentResult","calculatedResult","calculateResult","setScore","score","setStatus","status","
|
|
1
|
+
{"version":3,"file":"SingleTitleAssessment.js","names":["isUndefined","merge","Assessment","AssessmentResult","SINGLE_TITLE_ID","TECHNICAL_SEO_POINTS","SingleTitleAssessment","constructor","config","defaultConfig","id","docUrl","ctaType","priority","title","content","improve","bad","good","identifier","_config","getResult","paper","researcher","assessmentResult","calculatedResult","calculateResult","setScore","score","setStatus","status","getTitle","bodyText","getText","titleLower","toLowerCase","trim","includes","getScore","isApplicable"],"sources":["../../../../../src/scoring/assessments/seo/SingleTitleAssessment.js"],"sourcesContent":["import {isUndefined, merge} from 'lodash';\nimport Assessment from '../assessment.js';\nimport AssessmentResult from '../../../values/AssessmentResult.js';\nimport {SINGLE_TITLE_ID, TECHNICAL_SEO_POINTS} from '@axyseo/const/analysis';\n\n/**\n * Assessment to check whether the body of the text contains more than 1 H1s in the body.\n * This assessment doesn't penalize H1 that is not in the very beginning of the body.\n */\nclass SingleTitleAssessment 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: SINGLE_TITLE_ID,\n docUrl: 'https://help.seoon.io/seo/seo-checklist',\n ctaType: 'contactUs',\n priority: 'high',\n title: 'Duplicate title',\n content: {\n improve: '',\n bad: 'Found duplicate titles. Check your content and create unique titles.',\n good: 'No duplicate titles found.'\n }\n };\n\n this.identifier = SINGLE_TITLE_ID;\n this._config = merge(defaultConfig, config);\n }\n\n /**\n * Runs the h1 research and based on this returns an assessment result with a 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 * @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 if (!isUndefined(calculatedResult)) {\n assessmentResult.setScore(calculatedResult.score);\n assessmentResult.setStatus(calculatedResult.status);\n }\n\n return assessmentResult;\n }\n\n /**\n *\n * @param paper\n * @returns {{score: number, status: string}}\n */\n calculateResult(paper) {\n const title = paper.getTitle();\n const bodyText = paper.getText();\n\n let status = 'good';\n if (title && bodyText) {\n const titleLower = title.toLowerCase().trim();\n if (titleLower && bodyText.toLowerCase().includes(titleLower)) status = 'bad';\n }\n\n const score = this.getScore(TECHNICAL_SEO_POINTS, 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 true;\n }\n}\n\nexport default SingleTitleAssessment;\n"],"mappings":"AAAA,SAAQA,WAAW,EAAEC,KAAK,QAAO,QAAQ;AACzC,OAAOC,UAAU;AACjB,OAAOC,gBAAgB;AACvB,SAAQC,eAAe,EAAEC,oBAAoB;;AAE7C;AACA;AACA;AACA;AACA,MAAMC,qBAAqB,SAASJ,UAAU,CAAC;EAC7C;AACF;AACA;AACA;AACA;AACA;AACA;EACEK,WAAWA,CAACC,MAAM,GAAG,CAAC,CAAC,EAAE;IACvB,KAAK,CAAC,CAAC;IAEP,MAAMC,aAAa,GAAG;MACpBC,EAAE,EAAEN,eAAe;MACnBO,MAAM,EAAE,yCAAyC;MACjDC,OAAO,EAAE,WAAW;MACpBC,QAAQ,EAAE,MAAM;MAChBC,KAAK,EAAE,iBAAiB;MACxBC,OAAO,EAAE;QACPC,OAAO,EAAE,EAAE;QACXC,GAAG,EAAE,sEAAsE;QAC3EC,IAAI,EAAE;MACR;IACF,CAAC;IAED,IAAI,CAACC,UAAU,GAAGf,eAAe;IACjC,IAAI,CAACgB,OAAO,GAAGnB,KAAK,CAACQ,aAAa,EAAED,MAAM,CAAC;EAC7C;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACEa,SAASA,CAAC;IAACC,KAAK;IAAEC;EAAU,CAAC,EAAE;IAC7B,MAAMC,gBAAgB,GAAG,IAAIrB,gBAAgB,CAAC;MAACK,MAAM,EAAE,IAAI,CAACY;IAAO,CAAC,CAAC;IAErE,MAAMK,gBAAgB,GAAG,IAAI,CAACC,eAAe,CAACJ,KAAK,CAAC;IAEpD,IAAI,CAACtB,WAAW,CAACyB,gBAAgB,CAAC,EAAE;MAClCD,gBAAgB,CAACG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