From 9f3b84468e5dbb5d76abfc5501c1435b5825bfe3 Mon Sep 17 00:00:00 2001 From: Igor Date: Fri, 2 Nov 2018 16:01:54 +0100 Subject: [PATCH 01/72] Remove ts-loader --- examples/webpack/package.json | 5 +---- examples/webpack/yarn.lock | 17 +++-------------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/examples/webpack/package.json b/examples/webpack/package.json index c09cedcc7..add97a42e 100644 --- a/examples/webpack/package.json +++ b/examples/webpack/package.json @@ -49,7 +49,6 @@ "style-loader": "0.19.0", "styled-components": "^3.4.5", "sw-precache-webpack-plugin": "0.11.4", - "ts-loader": "^3.5.0", "url-loader": "0.6.2", "webpack": "3.8.1", "webpack-dev-server": "2.9.4", @@ -103,7 +102,5 @@ "react-app" ] }, - "devDependencies": { - "ts-loader": "^3.5.0" - } + "devDependencies": {} } diff --git a/examples/webpack/yarn.lock b/examples/webpack/yarn.lock index 1d5e62f65..ba36bd540 100644 --- a/examples/webpack/yarn.lock +++ b/examples/webpack/yarn.lock @@ -1640,7 +1640,7 @@ chalk@1.1.3, chalk@^1.1.1, chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" -chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.0, chalk@^2.4.1: +chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.4.1: version "2.4.1" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e" integrity sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ== @@ -2709,7 +2709,7 @@ encoding@^0.1.11, encoding@^0.1.12: dependencies: iconv-lite "~0.4.13" -enhanced-resolve@^3.0.0, enhanced-resolve@^3.4.0: +enhanced-resolve@^3.4.0: version "3.4.1" resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-3.4.1.tgz#0421e339fd71419b3da13d129b3979040230476e" integrity sha1-BCHjOf1xQZs9oT0Smzl5BAIwR24= @@ -7684,7 +7684,7 @@ semver-diff@^2.0.0: dependencies: semver "^5.0.3" -"semver@2 || 3 || 4 || 5", semver@^5.0.1, semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, semver@^5.4.1: +"semver@2 || 3 || 4 || 5", semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, semver@^5.4.1: version "5.5.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab" integrity sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA== @@ -8475,17 +8475,6 @@ trim-right@^1.0.1: resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" integrity sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM= -ts-loader@^3.5.0: - version "3.5.0" - resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-3.5.0.tgz#151d004dcddb4cf8e381a3bf9d6b74c2d957a9c0" - integrity sha512-JTia3kObhTk36wPFgy0RnkZReiusYx7Le9IhcUWRrCTcFcr6Dy1zGsFd3x8DG4gevlbN65knI8W50FfoykXcng== - dependencies: - chalk "^2.3.0" - enhanced-resolve "^3.0.0" - loader-utils "^1.0.2" - micromatch "^3.1.4" - semver "^5.0.1" - tty-browserify@0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6" From ab8ae310906fc843c529ebb41817caba1a2be9db Mon Sep 17 00:00:00 2001 From: Natalia Date: Fri, 2 Nov 2018 16:10:08 +0100 Subject: [PATCH 02/72] Recalibrate text images --- spec/assessments/textImagesSpec.js | 417 ++++++++++++++++++-- spec/researches/imageAltTagsSpec.js | 26 +- src/assessments/seo/TextImagesAssessment.js | 264 ++++++++++++- src/researches/imageAltTags.js | 2 +- 4 files changed, 655 insertions(+), 54 deletions(-) diff --git a/spec/assessments/textImagesSpec.js b/spec/assessments/textImagesSpec.js index 6094094a0..45f9d0ed7 100644 --- a/spec/assessments/textImagesSpec.js +++ b/spec/assessments/textImagesSpec.js @@ -5,11 +5,23 @@ var i18n = Factory.buildJed(); const imageCountAssessment = new ImageCountAssessment(); -describe( "An image count assessment", function() { +describe( "An image count assessment for regular analysis", function() { + beforeEach( () => { + process.env.YOAST_RECALIBRATION = "disabled"; + } ); + it( "assesses no images", function() { var mockPaper = new Paper( "sample" ); - var assessment = imageCountAssessment.getResult( mockPaper, Factory.buildMockResearcher( 0 ), i18n ); + var assessment = imageCountAssessment.getResult( mockPaper, Factory.buildMockResearcher( { + imageCount: 0, + altTagCount: { + noAlt: 0, + withAlt: 0, + withAltKeyword: 0, + withAltNonKeyword: 0, + } + }, true ), i18n ); expect( assessment.getScore() ).toEqual( 3 ); expect( assessment.getText() ).toEqual( "Image alt attributes: No images appear on this page. Add some!" ); @@ -19,11 +31,14 @@ describe( "An image count assessment", function() { var mockPaper = new Paper( "These are just five words " ); var assessment = imageCountAssessment.getResult( mockPaper, Factory.buildMockResearcher( { - noAlt: 1, - withAlt: 0, - withAltKeyword: 0, - withAltNonKeyword: 0, - } ), i18n ); + imageCount: 1, + altTagCount: { + noAlt: 1, + withAlt: 0, + withAltKeyword: 0, + withAltNonKeyword: 0, + } + }, true ), i18n ); expect( assessment.getScore() ).toEqual( 6 ); expect( assessment.getText() ).toEqual( "Image alt attributes: Images on this page do not have alt attributes with words from your keyphrase. Fix that!" ); @@ -33,11 +48,31 @@ describe( "An image count assessment", function() { var mockPaper = new Paper( "These are just five words image" ); var assessment = imageCountAssessment.getResult( mockPaper, Factory.buildMockResearcher( { - noAlt: 0, - withAlt: 1, - withAltKeyword: 0, - withAltNonKeyword: 0, - } ), i18n ); + imageCount: 1, + altTagCount: { + noAlt: 0, + withAlt: 1, + withAltKeyword: 0, + withAltNonKeyword: 0, + } + }, true ), i18n ); + + expect( assessment.getScore() ).toEqual( 6 ); + expect( assessment.getText() ).toEqual( "Image alt attributes: Images on this page do not have alt attributes with words from your keyphrase. Fix that!" ); + } ); + + it( "assesses 4 images, without a keyword, but with an alt-tag set", function() { + var mockPaper = new Paper( "These are just five words image image2 image3 image4" ); + + var assessment = imageCountAssessment.getResult( mockPaper, Factory.buildMockResearcher( { + imageCount: 4, + altTagCount: { + noAlt: 0, + withAlt: 4, + withAltKeyword: 0, + withAltNonKeyword: 0, + } + }, true ), i18n ); expect( assessment.getScore() ).toEqual( 6 ); expect( assessment.getText() ).toEqual( "Image alt attributes: Images on this page do not have alt attributes with words from your keyphrase. Fix that!" ); @@ -49,11 +84,33 @@ describe( "An image count assessment", function() { } ); var assessment = imageCountAssessment.getResult( mockPaper, Factory.buildMockResearcher( { - noAlt: 0, - withAlt: 0, - withAltKeyword: 0, - withAltNonKeyword: 1, - } ), i18n ); + imageCount: 1, + altTagCount: { + noAlt: 0, + withAlt: 0, + withAltKeyword: 0, + withAltNonKeyword: 1, + } + }, true ), i18n ); + + expect( assessment.getScore() ).toEqual( 6 ); + expect( assessment.getText() ).toEqual( "Image alt attributes: Images on this page do not have alt attributes with words from your keyphrase. Fix that!" ); + } ); + + it( "assesses four images, with a keyword and alt-tag set, but with a non-keyword alt-tag", function() { + var mockPaper = new Paper( "These are just five words image image2 image3 image4", { + keyword: "Sample", + } ); + + var assessment = imageCountAssessment.getResult( mockPaper, Factory.buildMockResearcher( { + imageCount: 4, + altTagCount: { + noAlt: 0, + withAlt: 0, + withAltKeyword: 0, + withAltNonKeyword: 4, + } + }, true ), i18n ); expect( assessment.getScore() ).toEqual( 6 ); expect( assessment.getText() ).toEqual( "Image alt attributes: Images on this page do not have alt attributes with words from your keyphrase. Fix that!" ); @@ -65,45 +122,337 @@ describe( "An image count assessment", function() { } ); var assessment = imageCountAssessment.getResult( mockPaper, Factory.buildMockResearcher( { - noAlt: 0, - withAlt: 0, - withAltKeyword: 1, - withAltNonKeyword: 0, - } ), i18n ); + imageCount: 1, + altTagCount: { + noAlt: 0, + withAlt: 0, + withAltKeyword: 1, + withAltNonKeyword: 0, + } + }, true ), i18n ); expect( assessment.getScore() ).toEqual( 9 ); expect( assessment.getText() ).toEqual( "Image alt attributes: Some images on this page contain alt attributes with words from your keyphrase! Good job!" ); } ); - it( "assesses a single image, with a keyword and alt-tag set to keyword for 1 of 2 images", function() { + it( "assesses two image, with a keyword and alt-tag set to keyword for 1 of 2 images", function() { var mockPaper = new Paper( "These are just five words sample", { keyword: "Sample", } ); var assessment = imageCountAssessment.getResult( mockPaper, Factory.buildMockResearcher( { - noAlt: 0, - withAlt: 0, - withAltKeyword: 1, - withAltNonKeyword: 1, - } ), i18n ); + imageCount: 2, + altTagCount: { + noAlt: 0, + withAlt: 0, + withAltKeyword: 1, + withAltNonKeyword: 1, + } + }, true ), i18n ); expect( assessment.getScore() ).toEqual( 9 ); expect( assessment.getText() ).toEqual( "Image alt attributes: Some images on this page contain alt attributes with words from your keyphrase! Good job!" ); } ); - it( "assesses a single image, with a keyword and alt-tag set to keyword for 1 of 2 images", function() { + it( "assesses 6 images, with a keyword and alt-tag set to keyword for 1 image, alt-tag set to non-keyword for 1 image and 4 images without alt tags", function() { var mockPaper = new Paper( "These are just five words sample", { keyword: "Sample", } ); var assessment = imageCountAssessment.getResult( mockPaper, Factory.buildMockResearcher( { - noAlt: 4, - withAlt: 0, - withAltKeyword: 1, - withAltNonKeyword: 1, - } ), i18n ); + imageCount: 6, + altTagCount: { + noAlt: 4, + withAlt: 0, + withAltKeyword: 1, + withAltNonKeyword: 1, + } + }, true ), i18n ); expect( assessment.getScore() ).toEqual( 9 ); expect( assessment.getText() ).toEqual( "Image alt attributes: Some images on this page contain alt attributes with words from your keyphrase! Good job!" ); } ); } ); + +describe( "An image count assessment for Recalibration analysis", function() { + beforeEach( () => { + process.env.YOAST_RECALIBRATION = "enabled"; + } ); + + it( "assesses no images", function() { + var mockPaper = new Paper( "sample" ); + + var assessment = imageCountAssessment.getResult( mockPaper, Factory.buildMockResearcher( { + imageCount: 0, + altTagCount: { + noAlt: 0, + withAlt: 0, + withAltKeyword: 0, + withAltNonKeyword: 0, + } + }, true ), i18n ); + + expect( assessment.getScore() ).toEqual( 3 ); + expect( assessment.getText() ).toEqual( "Image alt attributes: No images appear on this page. Add some!" ); + } ); + + it( "assesses a single image, without a keyword and alt-tag set", function() { + var mockPaper = new Paper( "These are just five words " ); + + var assessment = imageCountAssessment.getResult( mockPaper, Factory.buildMockResearcher( { + imageCount: 1, + altTagCount: { + noAlt: 1, + withAlt: 0, + withAltKeyword: 0, + withAltNonKeyword: 0, + } + }, true ), i18n ); + + expect( assessment.getScore() ).toEqual( 6 ); + expect( assessment.getText() ).toEqual( "Image alt attributes: Images on this page do not have alt attributes with words from your keyphrase. Fix that!" ); + } ); + + it( "assesses a single image, without a keyword, but with an alt-tag set", function() { + var mockPaper = new Paper( "These are just five words image" ); + + var assessment = imageCountAssessment.getResult( mockPaper, Factory.buildMockResearcher( { + imageCount: 1, + altTagCount: { + noAlt: 0, + withAlt: 1, + withAltKeyword: 0, + withAltNonKeyword: 0, + } + }, true ), i18n ); + + expect( assessment.getScore() ).toEqual( 6 ); + expect( assessment.getText() ).toEqual( "Image alt attributes: Images on this page have alt attributes, but you have not set your keyphrase. Fix that!" ); + } ); + + it( "assesses 4 images, without a keyword, but with an alt-tag set", function() { + var mockPaper = new Paper( "These are just five words image image2 image3 image4" ); + + var assessment = imageCountAssessment.getResult( mockPaper, Factory.buildMockResearcher( { + imageCount: 4, + altTagCount: { + noAlt: 0, + withAlt: 4, + withAltKeyword: 0, + withAltNonKeyword: 0, + } + }, true ), i18n ); + + expect( assessment.getScore() ).toEqual( 6 ); + expect( assessment.getText() ).toEqual( "Image alt attributes: Images on this page have alt attributes, but you have not set your keyphrase. Fix that!" ); + } ); + + it( "assesses a single image, with a keyword and alt-tag set, but with a non-keyword alt-tag", function() { + var mockPaper = new Paper( "These are just five words keyword", { + keyword: "Sample", + } ); + + var assessment = imageCountAssessment.getResult( mockPaper, Factory.buildMockResearcher( { + imageCount: 1, + altTagCount: { + noAlt: 0, + withAlt: 0, + withAltKeyword: 0, + withAltNonKeyword: 1, + } + }, true ), i18n ); + + expect( assessment.getScore() ).toEqual( 6 ); + expect( assessment.getText() ).toEqual( "Image alt attributes: Images on this page do not have alt attributes with at least half of the words from your keyphrase. Fix that!" ); + } ); + + it( "assesses four images, with a keyword and alt-tag set, but with a non-keyword alt-tag", function() { + var mockPaper = new Paper( "These are just five words image image2 image3 image4", { + keyword: "Sample", + } ); + + var assessment = imageCountAssessment.getResult( mockPaper, Factory.buildMockResearcher( { + imageCount: 4, + altTagCount: { + noAlt: 0, + withAlt: 0, + withAltKeyword: 0, + withAltNonKeyword: 4, + } + }, true ), i18n ); + + expect( assessment.getScore() ).toEqual( 6 ); + expect( assessment.getText() ).toEqual( "Image alt attributes: Images on this page do not have alt attributes with at least half of the words from your keyphrase. Fix that!" ); + } ); + + it( "assesses a single image, with a keyword and alt-tag set to keyword", function() { + var mockPaper = new Paper( "These are just five words sample", { + keyword: "Sample", + } ); + + var assessment = imageCountAssessment.getResult( mockPaper, Factory.buildMockResearcher( { + imageCount: 1, + altTagCount: { + noAlt: 0, + withAlt: 0, + withAltKeyword: 1, + withAltNonKeyword: 0, + } + }, true ), i18n ); + + expect( assessment.getScore() ).toEqual( 9 ); + expect( assessment.getText() ).toEqual( "Image alt attributes: The image on this page contains an alt attribute with at least half of the words from the keyphrase. Good job!" ); + } ); + + it( "assesses two images, with a keyword and alt-tag set to keyword for 1 of 2 images", function() { + var mockPaper = new Paper( "These are just five words sample", { + keyword: "Sample", + } ); + + var assessment = imageCountAssessment.getResult( mockPaper, Factory.buildMockResearcher( { + imageCount: 2, + altTagCount: { + noAlt: 0, + withAlt: 0, + withAltKeyword: 1, + withAltNonKeyword: 1, + } + }, true ), i18n ); + + expect( assessment.getScore() ).toEqual( 9 ); + expect( assessment.getText() ).toEqual( "Image alt attributes: Out of 2 images on this page, 1 has an alt attribute with at least half of the words from the keyphrase. Good job!" ); + } ); + + it( "assesses 6 images, with a keyword and alt-tag set to keyword for 2 images, alt-tag set to non-keyword for 1 image and 3 images without alt tags", function() { + var mockPaper = new Paper( "These are just five words sample", { + keyword: "Sample", + } ); + + var assessment = imageCountAssessment.getResult( mockPaper, Factory.buildMockResearcher( { + imageCount: 6, + altTagCount: { + noAlt: 3, + withAlt: 0, + withAltKeyword: 2, + withAltNonKeyword: 1, + } + }, true ), i18n ); + + expect( assessment.getScore() ).toEqual( 9 ); + expect( assessment.getText() ).toEqual( "Image alt attributes: Out of 6 images on this page, 2 have alt attributes with at least half of the words from the keyphrase. Good job!" ); + } ); + + it( "assesses 6 images, with a keyword and alt-tag set to keyword for all 6 images", function() { + var mockPaper = new Paper( "These are just five words sample", { + keyword: "Sample", + } ); + + var assessment = imageCountAssessment.getResult( mockPaper, Factory.buildMockResearcher( { + imageCount: 6, + altTagCount: { + noAlt: 0, + withAlt: 0, + withAltKeyword: 6, + withAltNonKeyword: 0, + } + }, true ), i18n ); + + expect( assessment.getScore() ).toEqual( 6 ); + expect( assessment.getText() ).toEqual( "Image alt attributes: Out of 6 images on this page, 6 have alt attributes with at least half of the words from the keyphrase. That's a bit much. Only include the focus keyphrase when it really fits the image." ); + } ); + + it( "assesses 6 images, with a keyword and alt-tag set to keyword for only 1 image", function() { + var mockPaper = new Paper( "These are just five words sample", { + keyword: "Sample", + } ); + + var assessment = imageCountAssessment.getResult( mockPaper, Factory.buildMockResearcher( { + imageCount: 6, + altTagCount: { + noAlt: 1, + withAlt: 0, + withAltKeyword: 1, + withAltNonKeyword: 4, + } + }, true ), i18n ); + + expect( assessment.getScore() ).toEqual( 6 ); + expect( assessment.getText() ).toEqual( "Image alt attributes: Out of 6 images on this page, only 1 has an alt attribute with at least half of the words from your keyphrase. Fix that!" ); + } ); + + it( "assesses 5 images, with a keyword and alt-tag set to keyword for 2 images, alt-tag set to non-keyword for 1 image and 2 images without alt tags", function() { + var mockPaper = new Paper( "These are just five words sample", { + keyword: "Sample", + } ); + + var assessment = imageCountAssessment.getResult( mockPaper, Factory.buildMockResearcher( { + imageCount: 5, + altTagCount: { + noAlt: 2, + withAlt: 0, + withAltKeyword: 2, + withAltNonKeyword: 1, + } + }, true ), i18n ); + + expect( assessment.getScore() ).toEqual( 9 ); + expect( assessment.getText() ).toEqual( "Image alt attributes: Out of 5 images on this page, 2 have alt attributes with at least half of the words from the keyphrase. Good job!" ); + } ); + + it( "assesses 5 images, with a keyword and alt-tag set to keyword for 4 images", function() { + var mockPaper = new Paper( "These are just five words sample", { + keyword: "Sample", + } ); + + var assessment = imageCountAssessment.getResult( mockPaper, Factory.buildMockResearcher( { + imageCount: 5, + altTagCount: { + noAlt: 1, + withAlt: 0, + withAltKeyword: 4, + withAltNonKeyword: 0, + } + }, true ), i18n ); + + expect( assessment.getScore() ).toEqual( 9 ); + expect( assessment.getText() ).toEqual( "Image alt attributes: Out of 5 images on this page, 4 have alt attributes with at least half of the words from the keyphrase. Good job!" ); + } ); + + it( "assesses 5 images, with a keyword and alt-tag set to keyword for all 5 images", function() { + var mockPaper = new Paper( "These are just five words sample", { + keyword: "Sample", + } ); + + var assessment = imageCountAssessment.getResult( mockPaper, Factory.buildMockResearcher( { + imageCount: 5, + altTagCount: { + noAlt: 0, + withAlt: 0, + withAltKeyword: 5, + withAltNonKeyword: 0, + } + }, true ), i18n ); + + expect( assessment.getScore() ).toEqual( 6 ); + expect( assessment.getText() ).toEqual( "Image alt attributes: Out of 5 images on this page, 5 have alt attributes with at least half of the words from the keyphrase. That's a bit much. Only include the focus keyphrase when it really fits the image." ); + } ); + + it( "assesses 5 images, with a keyword and alt-tag set to keyword for only 1 image", function() { + var mockPaper = new Paper( "These are just five words sample", { + keyword: "Sample", + } ); + + var assessment = imageCountAssessment.getResult( mockPaper, Factory.buildMockResearcher( { + imageCount: 5, + altTagCount: { + noAlt: 1, + withAlt: 0, + withAltKeyword: 1, + withAltNonKeyword: 3, + } + }, true ), i18n ); + + expect( assessment.getScore() ).toEqual( 6 ); + expect( assessment.getText() ).toEqual( "Image alt attributes: Out of 5 images on this page, only 1 has an alt attribute with at least half of the words from your keyphrase. Fix that!" ); + } ); +} ); diff --git a/spec/researches/imageAltTagsSpec.js b/spec/researches/imageAltTagsSpec.js index 9d34441cd..0bac621f6 100644 --- a/spec/researches/imageAltTagsSpec.js +++ b/spec/researches/imageAltTagsSpec.js @@ -16,7 +16,7 @@ describe( "Counts images in an text", function() { expect( stringToCheck.withAltNonKeyword ).toBe( 0 ); } ); - it( "returns object with the withAltKeyword as 1 when the keyword is set and present", function() { + it( "returns object with the withAltKeyword as 1 when the keyword is set and present (1-word keyword)", function() { const paper = new Paper( "string keyword", { keyword: "keyword", synonyms: "synonym, another synonym" } ); const researcher = new Researcher( paper ); researcher.addResearchData( "morphology", morphologyData ); @@ -28,6 +28,30 @@ describe( "Counts images in an text", function() { expect( stringToCheck.withAltNonKeyword ).toBe( 0 ); } ); + it( "returns object with the withAltKeyword as 1 when the keyword is set and present by 50% (2-word keyword)", function() { + const paper = new Paper( "string keyword", { keyword: "keyword keyphrase", synonyms: "synonym, another synonym" } ); + const researcher = new Researcher( paper ); + researcher.addResearchData( "morphology", morphologyData ); + const stringToCheck = altTagCountFunction( paper, researcher ); + + expect( stringToCheck.noAlt ).toBe( 0 ); + expect( stringToCheck.withAlt ).toBe( 0 ); + expect( stringToCheck.withAltKeyword ).toBe( 1 ); + expect( stringToCheck.withAltNonKeyword ).toBe( 0 ); + } ); + + it( "returns object with the withAltKeyword as 0 when the keyword is set and present by 33% (3-word keyword)", function() { + const paper = new Paper( "string keyword", { keyword: "keyword keyphrase synonym", synonyms: "synonym, another synonym" } ); + const researcher = new Researcher( paper ); + researcher.addResearchData( "morphology", morphologyData ); + const stringToCheck = altTagCountFunction( paper, researcher ); + + expect( stringToCheck.noAlt ).toBe( 0 ); + expect( stringToCheck.withAlt ).toBe( 0 ); + expect( stringToCheck.withAltKeyword ).toBe( 0 ); + expect( stringToCheck.withAltNonKeyword ).toBe( 1 ); + } ); + it( "returns object with the withAlt as 1 when there's an alt-tag, but no keyword is set", function() { const paper = new Paper( "string keyword", { keyword: "" } ); const researcher = new Researcher( paper ); diff --git a/src/assessments/seo/TextImagesAssessment.js b/src/assessments/seo/TextImagesAssessment.js index a751c86e4..ae8a4a560 100644 --- a/src/assessments/seo/TextImagesAssessment.js +++ b/src/assessments/seo/TextImagesAssessment.js @@ -1,6 +1,7 @@ import { merge } from "lodash-es"; import Assessment from "../../assessment"; +import { inRangeStartEndInclusive } from "../../helpers/inRange.js"; import { createAnchorOpeningTag } from "../../helpers/shortlinker"; import AssessmentResult from "../../values/AssessmentResult"; @@ -19,13 +20,26 @@ export default class TextImagesAssessment extends Assessment { super(); const defaultConfig = { - scores: { + parametersRecalibration: { + lowerBoundary: 0.3, + upperBoundary: 0.75, + }, + scoresRegular: { noImages: 3, withAltKeyword: 9, withAltNonKeyword: 6, withAlt: 6, noAlt: 6, }, + scoresRecalibration: { + noImages: 3, + withAltGoodNumberOfKeywordMatches: 9, + withAltTooFewKeywordMatches: 6, + withAltTooManyKeywordMatches: 6, + withAltNonKeyword: 6, + withAlt: 6, + noAlt: 6, + }, urlTitle: createAnchorOpeningTag( "https://yoa.st/33c" ), urlCallToAction: createAnchorOpeningTag( "https://yoa.st/33d" ), }; @@ -44,12 +58,20 @@ export default class TextImagesAssessment extends Assessment { * @returns {AssessmentResult} The result of the assessment, containing both a score and a descriptive text. */ getResult( paper, researcher, i18n ) { - const assessmentResult = new AssessmentResult(); - const imageCount = researcher.getResearch( "imageCount" ); - const altProperties = researcher.getResearch( "altTagCount" ); + this.imageCount = researcher.getResearch( "imageCount" ); + this.altProperties = researcher.getResearch( "altTagCount" ); - const calculatedScore = this.calculateResult( imageCount, altProperties, i18n ); + let calculatedScore; + if ( process.env.YOAST_RECALIBRATION === "enabled" ) { + this._minNumberOfKeywordMatches = Math.ceil( this.imageCount * this._config.parametersRecalibration.lowerBoundary ); + this._maxNumberOfKeywordMatches = Math.floor( this.imageCount * this._config.parametersRecalibration.upperBoundary ); + calculatedScore = this.calculateResultRecalibration( i18n ); + } else { + calculatedScore = this.calculateResultRegular( i18n ); + } + + const assessmentResult = new AssessmentResult(); assessmentResult.setScore( calculatedScore.score ); assessmentResult.setText( calculatedScore.resultText ); @@ -70,16 +92,14 @@ export default class TextImagesAssessment extends Assessment { /** * Calculate the score and the feedback string based on the current image count and current image alt-tag count. * - * @param {number} imageCount The amount of images to be checked against. - * @param {Object} altProperties An object containing the various alt-tags. * @param {Jed} i18n The object used for translations. * * @returns {Object} The calculated score and the feedback string. */ - calculateResult( imageCount, altProperties, i18n ) { - if ( imageCount === 0 ) { + calculateResultRegular( i18n ) { + if ( this.imageCount === 0 ) { return { - score: this._config.scores.noImages, + score: this._config.scoresRegular.noImages, resultText: i18n.sprintf( /* Translators: %1$s and %2$s expand to links on yoast.com, %3$s expands to the anchor end tag */ i18n.dgettext( "js-text-analysis", "%1$sImage alt attributes%3$s: No images appear on this page. %2$sAdd some%3$s!" ), @@ -91,9 +111,9 @@ export default class TextImagesAssessment extends Assessment { } // Has alt-tag and keywords - if ( altProperties.withAltKeyword > 0 ) { + if ( this.altProperties.withAltKeyword > 0 ) { return { - score: this._config.scores.withAltKeyword, + score: this._config.scoresRegular.withAltKeyword, resultText: i18n.sprintf( /* Translators: %1$s expands to a link on yoast.com, %2$s expands to the anchor end tag */ i18n.dgettext( "js-text-analysis", "%1$sImage alt attributes%2$s: " + @@ -105,9 +125,9 @@ export default class TextImagesAssessment extends Assessment { } // Has alt-tag, but no keywords and it's not okay - if ( altProperties.withAltNonKeyword > 0 ) { + if ( this.altProperties.withAltNonKeyword > 0 ) { return { - score: this._config.scores.withAltNonKeyword, + score: this._config.scoresRegular.withAltNonKeyword, resultText: i18n.sprintf( /* Translators: %1$s and %2$s expand to links on yoast.com, %3$s expands to the anchor end tag */ i18n.dgettext( "js-text-analysis", "%1$sImage alt attributes%3$s: " + @@ -120,9 +140,9 @@ export default class TextImagesAssessment extends Assessment { } // Has alt-tag, but no keyword is set - if ( altProperties.withAlt > 0 ) { + if ( this.altProperties.withAlt > 0 ) { return { - score: this._config.scores.withAlt, + score: this._config.scoresRegular.withAlt, resultText: i18n.sprintf( /* Translators: %1$s and %2$s expand to links on yoast.com, %3$s expands to the anchor end tag */ i18n.dgettext( "js-text-analysis", "%1$sImage alt attributes%3$s: " + @@ -135,9 +155,9 @@ export default class TextImagesAssessment extends Assessment { } // Has no alt-tag - if ( altProperties.noAlt > 0 ) { + if ( this.altProperties.noAlt > 0 ) { return { - score: this._config.scores.noAlt, + score: this._config.scoresRegular.noAlt, resultText: i18n.sprintf( /* Translators: %1$s and %2$s expand to links on yoast.com, %3$s expands to the anchor end tag */ i18n.dgettext( "js-text-analysis", "%1$sImage alt attributes%3$s: " + @@ -150,4 +170,212 @@ export default class TextImagesAssessment extends Assessment { } return null; } + + /** + * Checks whether there are too few alt tags with keywords. This check is applicable when there are + * 5 or more images. + * + * @returns {boolean} Returns true if there are at least 5 images and the number of alt tags + * with keywords is under the specified recommended minimum. + */ + hasTooFewMatches() { + return this.imageCount > 4 && this.altProperties.withAltKeyword > 0 && + this.altProperties.withAltKeyword < this._minNumberOfKeywordMatches; + } + + /** + * Checks whether there is a sufficient number of alt tags with keywords. There are different recommended + * ranges for less than 5 keywords, exactly 5 keywords, and more than 5 keywords. + * + * @returns {boolean} Returns true if the number of alt tags with keywords is within the recommended range. + */ + hasGoodNumberOfMatches() { + return ( ( this.imageCount < 5 && this.altProperties.withAltKeyword > 0 ) || + ( this.imageCount === 5 && inRangeStartEndInclusive( this.altProperties.withAltKeyword, 2, 4 ) ) || + ( this.imageCount > 4 && + inRangeStartEndInclusive( this.altProperties.withAltKeyword, this._minNumberOfKeywordMatches, this._maxNumberOfKeywordMatches ) ) ); + } + + /** + * Checks whether the only image has an alt-tag with the keyphrase (needed to return a nice feedback). + * + * @returns {boolean} Returns true if the number of alt tags with keywords is within the recommended range. + */ + hasOneImageWithKeyword() { + return ( this.imageCount === 1 && this.altProperties.withAltKeyword === 1 ); + } + + /** + * Checks whether there is a sufficient number of alt tags with keywords. This check is applicable when there are + * 5 or more images. + * + * @returns {boolean} Returns true if there are at least 5 images and the number of alt tags with keywords + * is within the recommended range. + */ + hasTooManyMatches() { + return this.imageCount > 4 && this.altProperties.withAltKeyword > this._maxNumberOfKeywordMatches; + } + + + /** + * Calculate the result based on the current image count and current image alt-tag count. + * + * @param {Object} i18n The object used for translations. + * + * @returns {Object} The calculated result. + */ + calculateResultRecalibration( i18n ) { + // No images. + if ( this.imageCount === 0 ) { + return { + score: this._config.scoresRecalibration.noImages, + resultText: i18n.sprintf( + /* Translators: %1$s and %2$s expand to links on yoast.com, %3$s expands to the anchor end tag */ + i18n.dgettext( + "js-text-analysis", + "%1$sImage alt attributes%3$s: No images appear on this page. %2$sAdd some%3$s!" + ), + this._config.urlTitle, + this._config.urlCallToAction, + "" + ), + }; + } + + // Has alt-tags, but no keyword is set. + if ( this.altProperties.withAlt > 0 ) { + return { + score: this._config.scoresRecalibration.withAlt, + resultText: i18n.sprintf( + /* Translators: %1$s and %2$s expand to links on yoast.com, %3$s expands to the anchor end tag */ + i18n.dgettext( + "js-text-analysis", + "%1$sImage alt attributes%3$s: " + + "Images on this page have alt attributes, but you have not set your keyphrase. %2$sFix that%3$s!" + ), + this._config.urlTitle, + this._config.urlCallToAction, + "" + ), + }; + } + + // Has alt-tags, but no keywords while a keyword is set. + if ( this.altProperties.withAltNonKeyword > 0 && this.altProperties.withAltKeyword === 0 ) { + return { + score: this._config.scoresRecalibration.withAltNonKeyword, + resultText: i18n.sprintf( + /* Translators: %1$s and %2$s expand to links on yoast.com, %3$s expands to the anchor end tag */ + i18n.dgettext( + "js-text-analysis", + "%1$sImage alt attributes%3$s: " + + "Images on this page do not have alt attributes with at least half of the words from your keyphrase. %2$sFix that%3$s!" + ), + this._config.urlTitle, + this._config.urlCallToAction, + "" + ), + }; + } + + // Image count ≥5, has alt-tags with too few keywords. + if ( this.hasTooFewMatches() ) { + return { + score: this._config.scoresRecalibration.withAltTooFewKeywordMatches, + resultText: i18n.sprintf( + /* Translators: %1$d expands to the number of images containing an alt attribute with the keyword, + * %2$d expands to the total number of images, %3$s and %4$s expand to links on yoast.com, + * %5$s expands to the anchor end tag. */ + i18n.dngettext( + "js-text-analysis", + "%3$sImage alt attributes%5$s: Out of %2$d images on this page, only %1$d has an alt attribute with at least half of the words from your keyphrase. " + + "%4$sFix that%5$s!", + "%3$sImage alt attributes%5$s: Out of %2$d images on this page, only %1$d have alt attributes with at least half of the words from your keyphrase. " + + "%4$sFix that%5$s!", + this.altProperties.withAltKeyword, + ), + this.altProperties.withAltKeyword, + this.imageCount, + this._config.urlTitle, + this._config.urlCallToAction, + "" + ), + }; + } + + if ( this.hasOneImageWithKeyword() ) { + return { + score: this._config.scoresRecalibration.withAltGoodNumberOfKeywordMatches, + resultText: i18n.sprintf( + /* Translators: %1$s expands to a link on yoast.com, + * %2$s expands to the anchor end tag. */ + i18n.dgettext( + "js-text-analysis", + "%1$sImage alt attributes%2$s: The image on this page contains an alt attribute with at least half of the words from the keyphrase. Good job!", + ), + this._config.urlTitle, + "" + ), + }; + } + + /* + * This check needs to be made before the check for too many matches because of the special rule for + * exactly 5 matches. + */ + if ( this.hasGoodNumberOfMatches() ) { + return { + score: this._config.scoresRecalibration.withAltGoodNumberOfKeywordMatches, + resultText: i18n.sprintf( + /* Translators: %1$d expands to the number of images containing an alt attribute with the keyword, + * %2$d expands to the total number of images, %3$s expands to a link on yoast.com, + * %4$s expands to the anchor end tag. */ + i18n.dngettext( + "js-text-analysis", + "%3$sImage alt attributes%4$s: Out of %2$d images on this page, %1$d has an alt attribute with at least half of the words from the keyphrase. Good job!", + "%3$sImage alt attributes%4$s: Out of %2$d images on this page, %1$d have alt attributes with at least half of the words from the keyphrase. Good job!", + this.altProperties.withAltKeyword + ), + this.altProperties.withAltKeyword, + this.imageCount, + this._config.urlTitle, + "" + ), + }; + } + + if ( this.hasTooManyMatches() ) { + return { + score: this._config.scoresRecalibration.withAltTooManyKeywordMatches, + resultText: i18n.sprintf( + /* Translators: %1$d expands to the number of images containing an alt attribute with the keyword, + * %2$d expands to the total number of images, %3$s and %4$s expand to a link on yoast.com, + * %5$s expands to the anchor end tag. */ + i18n.dgettext( + "js-text-analysis", + "%3$sImage alt attributes%5$s: Out of %2$d images on this page, %1$d have alt attributes with at least half of the words from the keyphrase. " + + "That's a bit much. %4$sOnly include the focus keyphrase when it really fits the image%5$s.", + ), + this.altProperties.withAltKeyword, + this.imageCount, + this._config.urlTitle, + this._config.urlCallToAction, + "" + ), + }; + } + + // Images, but no alt tags. + return { + score: this._config.scoresRecalibration.noAlt, + resultText: i18n.sprintf( + /* Translators: %1$s and %2$s expand to links on yoast.com, %3$s expands to the anchor end tag */ + i18n.dgettext( "js-text-analysis", "%1$sImage alt attributes%3$s: " + + "Images on this page do not have alt attributes with words from your keyphrase. %2$sFix that%3$s!" ), + this._config.urlTitle, + this._config.urlCallToAction, + "" + ), + }; + } } diff --git a/src/researches/imageAltTags.js b/src/researches/imageAltTags.js index f75a3a0c8..95aa2dae3 100644 --- a/src/researches/imageAltTags.js +++ b/src/researches/imageAltTags.js @@ -40,7 +40,7 @@ const matchAltProperties = function( imageMatches, topicForms, locale ) { const keywordMatchedInAltTag = findTopicFormsInString( topicForms, alttag, true, locale ); - if ( keywordMatchedInAltTag.countWordMatches === 0 && alttag !== "" ) { + if ( keywordMatchedInAltTag.percentWordMatches < 50 && alttag !== "" ) { // Match for keywords? altProperties.withAltNonKeyword++; continue; From cb3b4499be6aa5ebc0358e6f89694b26fc1a4b9e Mon Sep 17 00:00:00 2001 From: Natalia Date: Fri, 2 Nov 2018 16:16:19 +0100 Subject: [PATCH 03/72] sorry eslint --- spec/assessments/textImagesSpec.js | 48 ++++++++++----------- src/assessments/seo/TextImagesAssessment.js | 18 +++++--- 2 files changed, 36 insertions(+), 30 deletions(-) diff --git a/spec/assessments/textImagesSpec.js b/spec/assessments/textImagesSpec.js index 45f9d0ed7..ec5971269 100644 --- a/spec/assessments/textImagesSpec.js +++ b/spec/assessments/textImagesSpec.js @@ -20,7 +20,7 @@ describe( "An image count assessment for regular analysis", function() { withAlt: 0, withAltKeyword: 0, withAltNonKeyword: 0, - } + }, }, true ), i18n ); expect( assessment.getScore() ).toEqual( 3 ); @@ -37,7 +37,7 @@ describe( "An image count assessment for regular analysis", function() { withAlt: 0, withAltKeyword: 0, withAltNonKeyword: 0, - } + }, }, true ), i18n ); expect( assessment.getScore() ).toEqual( 6 ); @@ -54,7 +54,7 @@ describe( "An image count assessment for regular analysis", function() { withAlt: 1, withAltKeyword: 0, withAltNonKeyword: 0, - } + }, }, true ), i18n ); expect( assessment.getScore() ).toEqual( 6 ); @@ -71,7 +71,7 @@ describe( "An image count assessment for regular analysis", function() { withAlt: 4, withAltKeyword: 0, withAltNonKeyword: 0, - } + }, }, true ), i18n ); expect( assessment.getScore() ).toEqual( 6 ); @@ -90,7 +90,7 @@ describe( "An image count assessment for regular analysis", function() { withAlt: 0, withAltKeyword: 0, withAltNonKeyword: 1, - } + }, }, true ), i18n ); expect( assessment.getScore() ).toEqual( 6 ); @@ -109,7 +109,7 @@ describe( "An image count assessment for regular analysis", function() { withAlt: 0, withAltKeyword: 0, withAltNonKeyword: 4, - } + }, }, true ), i18n ); expect( assessment.getScore() ).toEqual( 6 ); @@ -128,7 +128,7 @@ describe( "An image count assessment for regular analysis", function() { withAlt: 0, withAltKeyword: 1, withAltNonKeyword: 0, - } + }, }, true ), i18n ); expect( assessment.getScore() ).toEqual( 9 ); @@ -147,7 +147,7 @@ describe( "An image count assessment for regular analysis", function() { withAlt: 0, withAltKeyword: 1, withAltNonKeyword: 1, - } + }, }, true ), i18n ); expect( assessment.getScore() ).toEqual( 9 ); @@ -166,7 +166,7 @@ describe( "An image count assessment for regular analysis", function() { withAlt: 0, withAltKeyword: 1, withAltNonKeyword: 1, - } + }, }, true ), i18n ); expect( assessment.getScore() ).toEqual( 9 ); @@ -189,7 +189,7 @@ describe( "An image count assessment for Recalibration analysis", function() { withAlt: 0, withAltKeyword: 0, withAltNonKeyword: 0, - } + }, }, true ), i18n ); expect( assessment.getScore() ).toEqual( 3 ); @@ -206,7 +206,7 @@ describe( "An image count assessment for Recalibration analysis", function() { withAlt: 0, withAltKeyword: 0, withAltNonKeyword: 0, - } + }, }, true ), i18n ); expect( assessment.getScore() ).toEqual( 6 ); @@ -223,7 +223,7 @@ describe( "An image count assessment for Recalibration analysis", function() { withAlt: 1, withAltKeyword: 0, withAltNonKeyword: 0, - } + }, }, true ), i18n ); expect( assessment.getScore() ).toEqual( 6 ); @@ -240,7 +240,7 @@ describe( "An image count assessment for Recalibration analysis", function() { withAlt: 4, withAltKeyword: 0, withAltNonKeyword: 0, - } + }, }, true ), i18n ); expect( assessment.getScore() ).toEqual( 6 ); @@ -259,7 +259,7 @@ describe( "An image count assessment for Recalibration analysis", function() { withAlt: 0, withAltKeyword: 0, withAltNonKeyword: 1, - } + }, }, true ), i18n ); expect( assessment.getScore() ).toEqual( 6 ); @@ -278,7 +278,7 @@ describe( "An image count assessment for Recalibration analysis", function() { withAlt: 0, withAltKeyword: 0, withAltNonKeyword: 4, - } + }, }, true ), i18n ); expect( assessment.getScore() ).toEqual( 6 ); @@ -297,7 +297,7 @@ describe( "An image count assessment for Recalibration analysis", function() { withAlt: 0, withAltKeyword: 1, withAltNonKeyword: 0, - } + }, }, true ), i18n ); expect( assessment.getScore() ).toEqual( 9 ); @@ -316,7 +316,7 @@ describe( "An image count assessment for Recalibration analysis", function() { withAlt: 0, withAltKeyword: 1, withAltNonKeyword: 1, - } + }, }, true ), i18n ); expect( assessment.getScore() ).toEqual( 9 ); @@ -335,7 +335,7 @@ describe( "An image count assessment for Recalibration analysis", function() { withAlt: 0, withAltKeyword: 2, withAltNonKeyword: 1, - } + }, }, true ), i18n ); expect( assessment.getScore() ).toEqual( 9 ); @@ -354,7 +354,7 @@ describe( "An image count assessment for Recalibration analysis", function() { withAlt: 0, withAltKeyword: 6, withAltNonKeyword: 0, - } + }, }, true ), i18n ); expect( assessment.getScore() ).toEqual( 6 ); @@ -373,7 +373,7 @@ describe( "An image count assessment for Recalibration analysis", function() { withAlt: 0, withAltKeyword: 1, withAltNonKeyword: 4, - } + }, }, true ), i18n ); expect( assessment.getScore() ).toEqual( 6 ); @@ -392,7 +392,7 @@ describe( "An image count assessment for Recalibration analysis", function() { withAlt: 0, withAltKeyword: 2, withAltNonKeyword: 1, - } + }, }, true ), i18n ); expect( assessment.getScore() ).toEqual( 9 ); @@ -411,7 +411,7 @@ describe( "An image count assessment for Recalibration analysis", function() { withAlt: 0, withAltKeyword: 4, withAltNonKeyword: 0, - } + }, }, true ), i18n ); expect( assessment.getScore() ).toEqual( 9 ); @@ -430,7 +430,7 @@ describe( "An image count assessment for Recalibration analysis", function() { withAlt: 0, withAltKeyword: 5, withAltNonKeyword: 0, - } + }, }, true ), i18n ); expect( assessment.getScore() ).toEqual( 6 ); @@ -449,7 +449,7 @@ describe( "An image count assessment for Recalibration analysis", function() { withAlt: 0, withAltKeyword: 1, withAltNonKeyword: 3, - } + }, }, true ), i18n ); expect( assessment.getScore() ).toEqual( 6 ); diff --git a/src/assessments/seo/TextImagesAssessment.js b/src/assessments/seo/TextImagesAssessment.js index ae8a4a560..f20773648 100644 --- a/src/assessments/seo/TextImagesAssessment.js +++ b/src/assessments/seo/TextImagesAssessment.js @@ -288,9 +288,11 @@ export default class TextImagesAssessment extends Assessment { * %5$s expands to the anchor end tag. */ i18n.dngettext( "js-text-analysis", - "%3$sImage alt attributes%5$s: Out of %2$d images on this page, only %1$d has an alt attribute with at least half of the words from your keyphrase. " + + "%3$sImage alt attributes%5$s: Out of %2$d images on this page, only %1$d has an alt attribute with " + + "at least half of the words from your keyphrase. " + "%4$sFix that%5$s!", - "%3$sImage alt attributes%5$s: Out of %2$d images on this page, only %1$d have alt attributes with at least half of the words from your keyphrase. " + + "%3$sImage alt attributes%5$s: Out of %2$d images on this page, only %1$d have alt attributes with " + + "at least half of the words from your keyphrase. " + "%4$sFix that%5$s!", this.altProperties.withAltKeyword, ), @@ -311,7 +313,8 @@ export default class TextImagesAssessment extends Assessment { * %2$s expands to the anchor end tag. */ i18n.dgettext( "js-text-analysis", - "%1$sImage alt attributes%2$s: The image on this page contains an alt attribute with at least half of the words from the keyphrase. Good job!", + "%1$sImage alt attributes%2$s: The image on this page contains an alt attribute with at least half " + + "of the words from the keyphrase. Good job!", ), this._config.urlTitle, "" @@ -332,8 +335,10 @@ export default class TextImagesAssessment extends Assessment { * %4$s expands to the anchor end tag. */ i18n.dngettext( "js-text-analysis", - "%3$sImage alt attributes%4$s: Out of %2$d images on this page, %1$d has an alt attribute with at least half of the words from the keyphrase. Good job!", - "%3$sImage alt attributes%4$s: Out of %2$d images on this page, %1$d have alt attributes with at least half of the words from the keyphrase. Good job!", + "%3$sImage alt attributes%4$s: Out of %2$d images on this page, %1$d has an alt attribute with at " + + "least half of the words from the keyphrase. Good job!", + "%3$sImage alt attributes%4$s: Out of %2$d images on this page, %1$d have alt attributes with at " + + "least half of the words from the keyphrase. Good job!", this.altProperties.withAltKeyword ), this.altProperties.withAltKeyword, @@ -353,7 +358,8 @@ export default class TextImagesAssessment extends Assessment { * %5$s expands to the anchor end tag. */ i18n.dgettext( "js-text-analysis", - "%3$sImage alt attributes%5$s: Out of %2$d images on this page, %1$d have alt attributes with at least half of the words from the keyphrase. " + + "%3$sImage alt attributes%5$s: Out of %2$d images on this page, %1$d have alt attributes with at " + + "least half of the words from the keyphrase. " + "That's a bit much. %4$sOnly include the focus keyphrase when it really fits the image%5$s.", ), this.altProperties.withAltKeyword, From 3a99972ae7d805d6d5e4dae1ceda4bf3b18410fc Mon Sep 17 00:00:00 2001 From: Igor Date: Fri, 2 Nov 2018 16:48:00 +0100 Subject: [PATCH 04/72] Add webpack alias and fix spacing --- examples/webpack/config/webpack.config.dev.js | 3 +- examples/webpack/public/index.html | 2 +- examples/webpack/src/App.js | 124 +++++++++--------- examples/webpack/src/analysis.worker.js | 2 +- .../webpack/src/components/Collapsible.js | 14 +- examples/webpack/src/components/Columns.js | 4 +- examples/webpack/src/components/Container.js | 22 ++++ examples/webpack/src/components/Controls.js | 29 ++-- examples/webpack/src/components/Input.js | 1 + examples/webpack/src/components/Inputs.js | 70 ++++++---- examples/webpack/src/components/Markings.js | 17 ++- examples/webpack/src/components/TextArea.js | 2 +- examples/webpack/src/components/headings.js | 24 +++- examples/webpack/src/index.css | 6 +- examples/webpack/src/index.js | 15 ++- .../src/redux/utils/StoreSubscriber.js | 10 +- .../webpack/src/utils/formatAnalyzeResult.js | 2 +- 17 files changed, 204 insertions(+), 143 deletions(-) diff --git a/examples/webpack/config/webpack.config.dev.js b/examples/webpack/config/webpack.config.dev.js index 0ebf2ead3..c4adc782a 100644 --- a/examples/webpack/config/webpack.config.dev.js +++ b/examples/webpack/config/webpack.config.dev.js @@ -88,8 +88,7 @@ module.exports = { // https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/ 'react-native': 'react-native-web', - // Disabled for now because it doesn't work with yoast-components: - // 'yoastseo': paths.yoastSrc, + 'yoastsrc': paths.yoastSrc, 'yoastspec': paths.yoastSpec, }, plugins: [], diff --git a/examples/webpack/public/index.html b/examples/webpack/public/index.html index 29d9a0b2c..04d81a2a3 100644 --- a/examples/webpack/public/index.html +++ b/examples/webpack/public/index.html @@ -19,7 +19,7 @@ work correctly both with client-side routing and a non-root public URL. Learn how to configure a non-root public URL by running `npm run build`. --> - Yoast SEO Content Analysis + YoastSEO.js development tool