@quintype/seo 1.40.3-update-image-schema.0 → 1.40.4

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/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.40.4](https://github.com/quintype/quintype-node-seo/compare/v1.40.4-amptag.0...v1.40.4) (2022-03-22)
6
+
7
+ ### [1.40.3](https://github.com/quintype/quintype-node-seo/compare/v1.40.2...v1.40.3) (2022-02-23)
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * Update image schema ([#522](https://github.com/quintype/quintype-node-seo/issues/522)) ([5e42cdc](https://github.com/quintype/quintype-node-seo/commit/5e42cdcbb14d587251b7a3f932a4f98dd358f188))
13
+
5
14
  ### [1.40.2](https://github.com/quintype/quintype-node-seo/compare/v1.40.2-ogImgFix.0...v1.40.2) (2022-02-11)
6
15
 
7
16
  ### [1.40.1](https://github.com/quintype/quintype-node-seo/compare/v1.40.0...v1.40.1) (2022-01-06)
package/dist/index.cjs.js CHANGED
@@ -627,8 +627,8 @@ function generateCommonData(structuredData = {}, story = {}, publisherConfig = {
627
627
  const storyUrl = story.url || `${publisherConfig["sketches-host"]}/${story.slug}`;
628
628
  const orgUrl = get__default["default"](structuredData, ["organization", "url"], "");
629
629
  const mainEntityUrl = Object.keys(story).length > 0 && structuredData.storyUrlAsMainEntityUrl ? storyUrl : get__default["default"](structuredData, ["organization", "url"], "");
630
- const imageWidth = 1200; // This value is updated based on latest google requirement
631
- const imageHeight = 675; // This value is updated based on latest google requirement
630
+ const imageWidth = 1200;
631
+ const imageHeight = 675;
632
632
  return Object.assign({}, {
633
633
  headline: story.headline,
634
634
  image: [imageUrl(publisherConfig, story["hero-image-s3-key"], imageWidth, imageHeight)],
@@ -679,8 +679,8 @@ function generateArticleData(structuredData = {}, story = {}, publisherConfig =
679
679
  const metaKeywords = story.seo && story.seo["meta-keywords"] || [];
680
680
  const authors = story.authors && story.authors.length !== 0 ? story.authors : [{ name: story["author-name"] || "" }];
681
681
  const storyKeysPresence = Object.keys(story).length > 0;
682
- const imageWidth = 1200; // This value is updated based on latest google requirement
683
- const imageHeight = 675; // This value is updated based on latest google requirement
682
+ const imageWidth = 1200;
683
+ const imageHeight = 675;
684
684
  const storyAccessType = storyAccess(story["access"]);
685
685
  const authorSchema = structuredData.authorSchema && structuredData.authorSchema(story) || [];
686
686
 
@@ -699,8 +699,8 @@ function generateArticleData(structuredData = {}, story = {}, publisherConfig =
699
699
  }
700
700
 
701
701
  function generateArticleImageData(image, publisherConfig = {}) {
702
- const imageWidth = 1200; // This value is updated based on latest google requirement
703
- const imageHeight = 675; // This value is updated based on latest google requirement
702
+ const imageWidth = 1200;
703
+ const imageHeight = 675;
704
704
  const articleImage = imageUrl(publisherConfig, image, imageWidth, imageHeight);
705
705
 
706
706
  return Object.assign({}, {
@@ -777,8 +777,8 @@ function findStoryElementField(card, type, field, defaultValue) {
777
777
  }
778
778
 
779
779
  function generateLiveBlogPostingData(structuredData = {}, story = {}, publisherConfig = {}, timezone) {
780
- const imageWidth = 1200; // This value is updated based on latest google requirement
781
- const imageHeight = 675; // This value is updated based on latest google requirement
780
+ const imageWidth = 1200;
781
+ const imageHeight = 675;
782
782
  const authorSchema = structuredData.authorSchema && structuredData.authorSchema(story) || [];
783
783
  return {
784
784
  headline: story.headline,
@@ -798,8 +798,8 @@ function generateVideoArticleData(structuredData = {}, story = {}, publisherConf
798
798
  const metaDescription = get__default["default"](story, ["seo", "meta-description"], "");
799
799
  const subHeadline = get__default["default"](story, ["subheadline"], "");
800
800
  const headline = get__default["default"](story, ["headline"], "");
801
- const imageWidth = 1200; // This value is updated based on latest google requirement
802
- const imageHeight = 675; // This value is updated based on latest google requirement
801
+ const imageWidth = 1200;
802
+ const imageHeight = 675;
803
803
  const authorSchema = structuredData.authorSchema && structuredData.authorSchema(story) || [];
804
804
  return Object.assign({}, generateCommonData(structuredData, story, publisherConfig, timezone), {
805
805
  author: authorData(story.authors, authorSchema, publisherConfig),
@@ -1026,10 +1026,6 @@ function showAmpTag({ ampStoryPages = true }, pageType, story) {
1026
1026
  return false;
1027
1027
  }
1028
1028
 
1029
- if (!get__default["default"](story, ["is-amp-supported"])) {
1030
- return false;
1031
- }
1032
-
1033
1029
  if (ampStoryPages === 'public' && !isStoryPublic(story)) {
1034
1030
  return false;
1035
1031
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/seo",
3
- "version": "1.40.3-update-image-schema.0",
3
+ "version": "1.40.4",
4
4
  "description": "SEO Modules for Quintype",
5
5
  "main": "dist/index.cjs.js",
6
6
  "repository": "https://github.com/quintype/quintype-node-seo",
package/src/amp-tags.js CHANGED
@@ -6,10 +6,6 @@ function showAmpTag({ ampStoryPages = true }, pageType, story) {
6
6
  return false;
7
7
  }
8
8
 
9
- if (!get(story, ["is-amp-supported"])) {
10
- return false;
11
- }
12
-
13
9
  if (ampStoryPages === 'public' && !isStoryPublic(story)) {
14
10
  return false;
15
11
  }
@@ -44,8 +44,8 @@ function generateCommonData(structuredData = {}, story = {}, publisherConfig = {
44
44
  Object.keys(story).length > 0 && structuredData.storyUrlAsMainEntityUrl
45
45
  ? storyUrl
46
46
  : get(structuredData, ["organization", "url"], "");
47
- const imageWidth = 1200; // This value is updated based on latest google requirement
48
- const imageHeight = 675; // This value is updated based on latest google requirement
47
+ const imageWidth = 1200;
48
+ const imageHeight = 675;
49
49
  return Object.assign(
50
50
  {},
51
51
  {
@@ -101,8 +101,8 @@ function generateArticleData(structuredData = {}, story = {}, publisherConfig =
101
101
  const metaKeywords = (story.seo && story.seo["meta-keywords"]) || [];
102
102
  const authors = story.authors && story.authors.length !== 0 ? story.authors : [{ name: story["author-name"] || "" }];
103
103
  const storyKeysPresence = Object.keys(story).length > 0;
104
- const imageWidth = 1200; // This value is updated based on latest google requirement
105
- const imageHeight = 675; // This value is updated based on latest google requirement
104
+ const imageWidth = 1200;
105
+ const imageHeight = 675;
106
106
  const storyAccessType = storyAccess(story["access"]);
107
107
  const authorSchema = (structuredData.authorSchema && structuredData.authorSchema(story)) || [];
108
108
 
@@ -126,8 +126,8 @@ function generateArticleData(structuredData = {}, story = {}, publisherConfig =
126
126
  }
127
127
 
128
128
  function generateArticleImageData(image, publisherConfig = {}) {
129
- const imageWidth = 1200; // This value is updated based on latest google requirement
130
- const imageHeight = 675; // This value is updated based on latest google requirement
129
+ const imageWidth = 1200;
130
+ const imageHeight = 675;
131
131
  const articleImage = imageUrl(publisherConfig, image, imageWidth, imageHeight);
132
132
 
133
133
  return Object.assign(
@@ -225,8 +225,8 @@ function findStoryElementField(card, type, field, defaultValue) {
225
225
  }
226
226
 
227
227
  function generateLiveBlogPostingData(structuredData = {}, story = {}, publisherConfig = {}, timezone) {
228
- const imageWidth = 1200; // This value is updated based on latest google requirement
229
- const imageHeight = 675; // This value is updated based on latest google requirement
228
+ const imageWidth = 1200;
229
+ const imageHeight = 675;
230
230
  const authorSchema = (structuredData.authorSchema && structuredData.authorSchema(story)) || [];
231
231
  return {
232
232
  headline: story.headline,
@@ -261,8 +261,8 @@ function generateVideoArticleData(structuredData = {}, story = {}, publisherConf
261
261
  const metaDescription = get(story, ["seo", "meta-description"], "");
262
262
  const subHeadline = get(story, ["subheadline"], "");
263
263
  const headline = get(story, ["headline"], "");
264
- const imageWidth = 1200; // This value is updated based on latest google requirement
265
- const imageHeight = 675; // This value is updated based on latest google requirement
264
+ const imageWidth = 1200;
265
+ const imageHeight = 675;
266
266
  const authorSchema = (structuredData.authorSchema && structuredData.authorSchema(story)) || [];
267
267
  return Object.assign({}, generateCommonData(structuredData, story, publisherConfig, timezone), {
268
268
  author: authorData(story.authors, authorSchema, publisherConfig),
@@ -6,60 +6,83 @@ const assert = require('assert');
6
6
  describe('AmpTags', function () {
7
7
  const seoConfig = {
8
8
  generators: [StoryAmpTags],
9
- ampStoryPages: true
10
- }
9
+ ampStoryPages: true,
10
+ };
11
11
 
12
12
  const config = {
13
- 'sketches-host': 'https://madrid.quintype.io'
14
- }
13
+ "sketches-host": "https://madrid.quintype.io",
14
+ };
15
15
 
16
- it("gets amp tags for supported stories", function() {
17
- const story = {"slug": "section/slug", "is-amp-supported": true}
18
- const string = getSeoMetadata(seoConfig, config, 'story-page', {data: {story: story}}, {})
16
+ it("gets amp tags for supported stories", function () {
17
+ const story = { slug: "section/slug", "is-amp-supported": true };
18
+ const string = getSeoMetadata(seoConfig, config, "story-page", { data: { story: story } }, {});
19
19
  assertContains('<link rel="amphtml" href="/amp/story/section%2Fslug"/>', string);
20
20
  });
21
21
 
22
- it("does not ampify any non supported stories", function () {
23
- const story = { "slug": "section/slug", "is-amp-supported": false }
24
- const string = getSeoMetadata(seoConfig, config, 'story-page', { data: { story: story } }, {})
25
- assert.equal('', string);
22
+ it("does not rely on is-amp-supported in story API", function () {
23
+ const story = { slug: "section/slug", "is-amp-supported": false };
24
+ const string = getSeoMetadata(seoConfig, config, "story-page", { data: { story: story } }, {});
25
+ assertContains('<link rel="amphtml" href="/amp/story/section%2Fslug"/>', string);
26
26
  });
27
27
 
28
28
  it("does not add amphtml link tag to amp story pages", function () {
29
- const story = { "slug": "section/slug", "is-amp-supported": true }
30
- const string = getSeoMetadata(seoConfig, config, 'story-page-amp', { data: { story: story } }, {})
31
- assert.equal('', string);
29
+ const story = { slug: "section/slug", "is-amp-supported": true };
30
+ const string = getSeoMetadata(seoConfig, config, "story-page-amp", { data: { story: story } }, {});
31
+ assert.equal("", string);
32
32
  });
33
33
 
34
34
  it("does not ampify other pages", function () {
35
- const string = getSeoMetadata(seoConfig, config, 'home-page', { data: {} }, {})
36
- assert.equal('', string);
35
+ const string = getSeoMetadata(seoConfig, config, "home-page", { data: {} }, {});
36
+ assert.equal("", string);
37
37
  });
38
38
 
39
39
  it("does allows you to only ampify free story pages", function () {
40
- const story = { "slug": "section/slug", "is-amp-supported": true }
41
- const publicStoryResults = getSeoMetadata({...seoConfig, ampStoryPages: "public"}, config, 'story-page', { data: { story: story } }, {})
40
+ const story = { slug: "section/slug", "is-amp-supported": true };
41
+ const publicStoryResults = getSeoMetadata(
42
+ { ...seoConfig, ampStoryPages: "public" },
43
+ config,
44
+ "story-page",
45
+ { data: { story: story } },
46
+ {}
47
+ );
42
48
  assert.equal('<link rel="amphtml" href="/amp/story/section%2Fslug"/>', publicStoryResults);
43
- const privateStoryResults = getSeoMetadata({ ...seoConfig, ampStoryPages: "public" }, config, 'story-page', { data: { story: {...story, access: "subscription"} } }, {})
44
- assert.equal('', privateStoryResults);
45
- })
49
+ const privateStoryResults = getSeoMetadata(
50
+ { ...seoConfig, ampStoryPages: "public" },
51
+ config,
52
+ "story-page",
53
+ { data: { story: { ...story, access: "subscription" } } },
54
+ {}
55
+ );
56
+ assert.equal("", privateStoryResults);
57
+ });
46
58
 
47
59
  it("does not append domain to amp stories if appendHostToAmpUrl not present", function () {
48
- const story = {"slug": "section/slug", "is-amp-supported": true}
49
- const string = getSeoMetadata(seoConfig, config, 'story-page', {data: {story: story}}, {})
60
+ const story = { slug: "section/slug", "is-amp-supported": true };
61
+ const string = getSeoMetadata(seoConfig, config, "story-page", { data: { story: story } }, {});
50
62
  assertContains('<link rel="amphtml" href="/amp/story/section%2Fslug"/>', string);
51
- })
63
+ });
52
64
 
53
65
  it("does append domain to amp stories if appendHostToAmpUrl present", function () {
54
- const story = {"slug": "section/slug", "is-amp-supported": true}
55
- const string = getSeoMetadata({...seoConfig, appendHostToAmpUrl: true}, config, 'story-page', {currentHostUrl: "https://madrid.quintype.io/section/slug", data: {story}}, {})
66
+ const story = { slug: "section/slug", "is-amp-supported": true };
67
+ const string = getSeoMetadata(
68
+ { ...seoConfig, appendHostToAmpUrl: true },
69
+ config,
70
+ "story-page",
71
+ { currentHostUrl: "https://madrid.quintype.io/section/slug", data: { story } },
72
+ {}
73
+ );
56
74
  assertContains('<link rel="amphtml" href="https://madrid.quintype.io/amp/story/section%2Fslug"/>', string);
57
- })
75
+ });
58
76
 
59
77
  it("does encode the url if encodeAmpUrl is set to false in seoConfig", function () {
60
- const story = {"slug": "section%2Fslug", "is-amp-supported": true}
61
- const string = getSeoMetadata({...seoConfig, appendHostToAmpUrl: true, decodeAmpUrl: true}, config, 'story-page', {currentHostUrl: "https://madrid.quintype.io/section%2Fslug", data: {story}}, {})
78
+ const story = { slug: "section%2Fslug", "is-amp-supported": true };
79
+ const string = getSeoMetadata(
80
+ { ...seoConfig, appendHostToAmpUrl: true, decodeAmpUrl: true },
81
+ config,
82
+ "story-page",
83
+ { currentHostUrl: "https://madrid.quintype.io/section%2Fslug", data: { story } },
84
+ {}
85
+ );
62
86
  assertContains('<link rel="amphtml" href="https://madrid.quintype.io/amp/story/section/slug"/>', string);
63
- })
64
-
87
+ });
65
88
  });