@quintype/seo 1.40.12-upgrade-R18.0 → 1.40.13-metadata-404.0

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,13 @@
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.12](https://github.com/quintype/quintype-node-seo/compare/v1.40.11...v1.40.12) (2022-10-19)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **discover-meta:** Add max image meta tag to story pages ([e96fa17](https://github.com/quintype/quintype-node-seo/commit/e96fa17637e2a625aa39601d2ace8ad2ea46d786))
11
+
5
12
  ### [1.40.11](https://github.com/quintype/quintype-node-seo/compare/v1.40.8...v1.40.11) (2022-09-06)
6
13
 
7
14
 
package/dist/index.cjs.js CHANGED
@@ -300,6 +300,10 @@ function ImageTags(seoConfig, config, pageType, data, { url = {} }) {
300
300
 
301
301
  const tags = [];
302
302
 
303
+ if (pageType == "story-page") {
304
+ tags.push({ name: "robots", content: "max-image-preview:large" });
305
+ }
306
+
303
307
  if (seoConfig.enableTwitterCards) {
304
308
  tags.push({
305
309
  name: "twitter:image",
@@ -978,6 +982,33 @@ function buildTagsFromTopic(config, tag, url = {}, data) {
978
982
  return topicMetaData;
979
983
  }
980
984
 
985
+ function buildTagsFromNotfoundPage(config, url = {}, data) {
986
+ const homeSeoData = config["seo-metadata"].find(page => page["owner-type"] === "home") || {
987
+ data: { description: "" }
988
+ };
989
+ const customSeo = lodash.get(data, ["data", "customSeo"], {});
990
+ const title = customSeo.title || "404 - Page not found ";
991
+ const pageTitle = customSeo["page-title"] || title;
992
+ const description = customSeo.description || homeSeoData.data.description || "404 - Page not found";
993
+ const tagUrl = `${config["sketches-host"]}${url.pathname}`;
994
+ const canonicalSlug = tag["canonical-slug"] || url.pathname;
995
+ const canonicalUrl = `${config["sketches-host"]}${canonicalSlug}`;
996
+ const ogTitle = customSeo.ogTitle || title;
997
+ const ogDescription = customSeo.ogDescription || description;
998
+ const topicMetaData = {
999
+ title: title,
1000
+ "page-title": pageTitle,
1001
+ description: description,
1002
+ keywords: title,
1003
+ canonicalUrl,
1004
+ ogUrl: tagUrl,
1005
+ ogTitle,
1006
+ ogDescription
1007
+ };
1008
+
1009
+ return topicMetaData;
1010
+ }
1011
+
981
1012
  function buildTagsFromAuthor(config, author, url = {}, data) {
982
1013
  if (lodash.isEmpty(author)) return;
983
1014
 
@@ -1094,6 +1125,8 @@ function getSeoData(config, pageType, data, url = {}, seoConfig = {}) {
1094
1125
  return buildTagsFromAuthor(config, lodash.get(data, ["data", "author"], {}), url, data) || getSeoData(config, "home-page", data, url);
1095
1126
  case "static-page":
1096
1127
  return buildTagsFromStaticPage(config, lodash.get(data, ["data", "page"], {}), url, data) || getSeoData(config, "home-page", data, url);
1128
+ case "not-found":
1129
+ return buildTagsFromNotfoundPage(config, url, data) || getSeoData(config, "home-page", data, url);
1097
1130
  case "shell":
1098
1131
  return getShellSeoData(config);
1099
1132
  default:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/seo",
3
- "version": "1.40.12-upgrade-R18.0",
3
+ "version": "1.40.13-metadata-404.0",
4
4
  "description": "SEO Modules for Quintype",
5
5
  "main": "dist/index.cjs.js",
6
6
  "repository": "https://github.com/quintype/quintype-node-seo",
@@ -8,8 +8,8 @@
8
8
  "license": "MIT",
9
9
  "peerDependencies": {
10
10
  "lodash": "^4.0.0",
11
- "react": "^18.2.0",
12
- "react-dom": "^18.2.0"
11
+ "react": "^16.0.0",
12
+ "react-dom": "^16.0.0"
13
13
  },
14
14
  "scripts": {
15
15
  "build": "rollup -c",
@@ -44,8 +44,8 @@
44
44
  "nyc": "^15.0.0",
45
45
  "onchange": "^7.0.2",
46
46
  "prettier": "^2.2.1",
47
- "react": "^18.2.0",
48
- "react-dom": "^18.2.0",
47
+ "react": "^17.0.1",
48
+ "react-dom": "^17.0.1",
49
49
  "rimraf": "^3.0.2",
50
50
  "rollup": "^2.0.0",
51
51
  "rollup-plugin-babel": "^3.0.2",
package/src/image-tags.js CHANGED
@@ -119,6 +119,10 @@ export function ImageTags(seoConfig, config, pageType, data, { url = {} }) {
119
119
 
120
120
  const tags = [];
121
121
 
122
+ if (pageType == "story-page") {
123
+ tags.push({ name: "robots", content: "max-image-preview:large" });
124
+ }
125
+
122
126
  if (seoConfig.enableTwitterCards) {
123
127
  tags.push({
124
128
  name: "twitter:image",
package/src/text-tags.js CHANGED
@@ -81,6 +81,33 @@ function buildTagsFromTopic(config, tag, url = {}, data) {
81
81
  return topicMetaData;
82
82
  }
83
83
 
84
+ function buildTagsFromNotfoundPage(config, url = {}, data) {
85
+ const homeSeoData = config["seo-metadata"].find((page) => page["owner-type"] === "home") || {
86
+ data: { description: "" },
87
+ };
88
+ const customSeo = get(data, ["data", "customSeo"], {});
89
+ const title = customSeo.title || "404 - Page not found ";
90
+ const pageTitle = customSeo["page-title"] || title;
91
+ const description = customSeo.description || homeSeoData.data.description || "404 - Page not found";
92
+ const tagUrl = `${config["sketches-host"]}${url.pathname}`;
93
+ const canonicalSlug = tag["canonical-slug"] || url.pathname;
94
+ const canonicalUrl = `${config["sketches-host"]}${canonicalSlug}`;
95
+ const ogTitle = customSeo.ogTitle || title;
96
+ const ogDescription = customSeo.ogDescription || description;
97
+ const topicMetaData = {
98
+ title: title,
99
+ "page-title": pageTitle,
100
+ description: description,
101
+ keywords: title,
102
+ canonicalUrl,
103
+ ogUrl: tagUrl,
104
+ ogTitle,
105
+ ogDescription,
106
+ };
107
+
108
+ return topicMetaData;
109
+ }
110
+
84
111
  function buildTagsFromAuthor(config, author, url = {}, data) {
85
112
  if (isEmpty(author)) return;
86
113
 
@@ -220,6 +247,8 @@ function getSeoData(config, pageType, data, url = {}, seoConfig = {}) {
220
247
  buildTagsFromStaticPage(config, get(data, ["data", "page"], {}), url, data) ||
221
248
  getSeoData(config, "home-page", data, url)
222
249
  );
250
+ case "not-found":
251
+ return buildTagsFromNotfoundPage(config, url, data) || getSeoData(config, "home-page", data, url);
223
252
  case "shell":
224
253
  return getShellSeoData(config);
225
254
  default:
@@ -48,6 +48,33 @@ describe("ImageTags", function () {
48
48
  );
49
49
  });
50
50
 
51
+ it("adds image max size tag for story page", function () {
52
+ const story = {
53
+ "hero-image-s3-key": "my/image.png",
54
+ alternative: {
55
+ social: {
56
+ default: {
57
+ headline: null,
58
+ "hero-image": {
59
+ "hero-image-s3-key": "my/socialimage.png",
60
+ },
61
+ },
62
+ },
63
+ home: {
64
+ default: {
65
+ headline: null,
66
+ "hero-image": {
67
+ "hero-image-s3-key": "my/homeimage.png",
68
+ },
69
+ },
70
+ },
71
+ },
72
+ };
73
+ const string = getSeoMetadata(seoConfig, config, "story-page", { data: { story: story } }, {});
74
+ const ampPageString = getSeoMetadata(seoConfig, config, "story-page-amp", { data: { story: story } }, {});
75
+ assertContains('<meta name="robots" content="max-image-preview:large"/>', string);
76
+ });
77
+
51
78
  it("has facebook tags resized correctly", function () {
52
79
  const story = {
53
80
  "hero-image-s3-key": "my/images.png",