@quintype/seo 1.40.13-metadata-404.0 → 1.40.14-gsc-errors.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,8 @@
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.13](https://github.com/quintype/quintype-node-seo/compare/v1.40.12...v1.40.13) (2022-10-27)
6
+
5
7
  ### [1.40.12](https://github.com/quintype/quintype-node-seo/compare/v1.40.11...v1.40.12) (2022-10-19)
6
8
 
7
9
 
package/dist/index.cjs.js CHANGED
@@ -478,7 +478,7 @@ function imageUrl(publisherConfig, s3Key, width, height) {
478
478
  const imageSrc = /^https?.*/.test(publisherConfig["cdn-image"]) ? publisherConfig["cdn-image"] : `https://${publisherConfig["cdn-image"]}`;
479
479
  width = width || "";
480
480
  height = height || "";
481
- return `${imageSrc}/${s3Key}?w=${width}&h=${height}&auto=format%2Ccompress&fit=max`;
481
+ return `${imageSrc}/${s3Key}?w=${width}&h=${height}&auto=format%2Ccompress&fit=max&enlarge=true`;
482
482
  }
483
483
 
484
484
  function generateCommonData(structuredData = {}, story = {}, publisherConfig = {}, timezone) {
@@ -982,33 +982,6 @@ function buildTagsFromTopic(config, tag, url = {}, data) {
982
982
  return topicMetaData;
983
983
  }
984
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
-
1012
985
  function buildTagsFromAuthor(config, author, url = {}, data) {
1013
986
  if (lodash.isEmpty(author)) return;
1014
987
 
@@ -1125,8 +1098,6 @@ function getSeoData(config, pageType, data, url = {}, seoConfig = {}) {
1125
1098
  return buildTagsFromAuthor(config, lodash.get(data, ["data", "author"], {}), url, data) || getSeoData(config, "home-page", data, url);
1126
1099
  case "static-page":
1127
1100
  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);
1130
1101
  case "shell":
1131
1102
  return getShellSeoData(config);
1132
1103
  default:
@@ -1321,7 +1292,7 @@ class SEO {
1321
1292
  */
1322
1293
  constructor(seoConfig = {}) {
1323
1294
  this.seoConfig = seoConfig;
1324
- this.generators = (seoConfig.generators || [TextTags, ImageTags, AuthorTags, StaticTags, StructuredDataTags, StoryAmpTags]).concat(seoConfig.extraGenerators || []);
1295
+ this.generators = (seoConfig.generators || [TextTags, ImageTags, AuthorTags, StaticTags, StructuredDataTags]).concat(seoConfig.extraGenerators || []);
1325
1296
  }
1326
1297
 
1327
1298
  getMetaTags(config, pageType, data, params = {}) {
package/index.js CHANGED
@@ -1,23 +1,35 @@
1
1
  import { flatMap, get, omit, uniqBy } from "lodash";
2
2
  import React from "react";
3
3
  import ReactDomServer from "react-dom/server";
4
- import { StoryAmpTags } from './src/amp-tags.js';
5
- import { AuthorTags } from './src/author-tags.js';
6
- import { generateStaticData, generateStructuredData } from './src/generate-common-seo';
7
- import { ImageTags } from './src/image-tags.js';
8
- import { StaticTags } from './src/static-tags.js';
9
- import { StructuredDataTags } from './src/structured-data/structured-data-tags.js';
10
- import { getTitle, TextTags } from './src/text-tags.js';
4
+ import { StoryAmpTags } from "./src/amp-tags.js";
5
+ import { AuthorTags } from "./src/author-tags.js";
6
+ import { generateStaticData, generateStructuredData } from "./src/generate-common-seo";
7
+ import { ImageTags } from "./src/image-tags.js";
8
+ import { StaticTags } from "./src/static-tags.js";
9
+ import { StructuredDataTags } from "./src/structured-data/structured-data-tags.js";
10
+ import { getTitle, TextTags } from "./src/text-tags.js";
11
11
 
12
-
13
- export { TextTags, StaticTags, AuthorTags, ImageTags, StructuredDataTags, StoryAmpTags, generateStaticData, generateStructuredData };
12
+ export {
13
+ TextTags,
14
+ StaticTags,
15
+ AuthorTags,
16
+ ImageTags,
17
+ StructuredDataTags,
18
+ StoryAmpTags,
19
+ generateStaticData,
20
+ generateStructuredData,
21
+ };
14
22
 
15
23
  function tagToKey(tag) {
16
24
  switch (tag.tag || "meta") {
17
- case "meta": return `meta-${tag.name || tag.itemprop || "name"}-${tag.property || "property"}`;
18
- case "link": return `link-${tag.rel}`;
19
- case "title": return `title`;
20
- default: return Math.random().toString();
25
+ case "meta":
26
+ return `meta-${tag.name || tag.itemprop || "name"}-${tag.property || "property"}`;
27
+ case "link":
28
+ return `link-${tag.rel}`;
29
+ case "title":
30
+ return `title`;
31
+ default:
32
+ return Math.random().toString();
21
33
  }
22
34
  }
23
35
 
@@ -28,7 +40,9 @@ export class MetaTagList {
28
40
 
29
41
  toString() {
30
42
  const uniqueTags = uniqBy(this.tags.reverse(), tagToKey).reverse();
31
- return ReactDomServer.renderToStaticMarkup(uniqueTags.map(tag => React.createElement(tag.tag || "meta", omit(tag, "tag"))));
43
+ return ReactDomServer.renderToStaticMarkup(
44
+ uniqueTags.map((tag) => React.createElement(tag.tag || "meta", omit(tag, "tag")))
45
+ );
32
46
  }
33
47
 
34
48
  addTag() {
@@ -93,12 +107,16 @@ export class SEO {
93
107
  */
94
108
  constructor(seoConfig = {}) {
95
109
  this.seoConfig = seoConfig;
96
- this.generators = (seoConfig.generators || [TextTags, ImageTags, AuthorTags, StaticTags, StructuredDataTags, StoryAmpTags]).concat(seoConfig.extraGenerators || []);
110
+ this.generators = (
111
+ seoConfig.generators || [TextTags, ImageTags, AuthorTags, StaticTags, StructuredDataTags]
112
+ ).concat(seoConfig.extraGenerators || []);
97
113
  }
98
114
 
99
115
  getMetaTags(config, pageType, data, params = {}) {
100
116
  pageType = get(this.seoConfig, ["pageTypeAliases", pageType], pageType);
101
- return new MetaTagList(flatMap(this.generators, generator => generator(this.seoConfig, config, pageType, data, params)));
117
+ return new MetaTagList(
118
+ flatMap(this.generators, (generator) => generator(this.seoConfig, config, pageType, data, params))
119
+ );
102
120
  }
103
121
 
104
122
  getTitle(config, pageType, data, params = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/seo",
3
- "version": "1.40.13-metadata-404.0",
3
+ "version": "1.40.14-gsc-errors.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",
@@ -34,7 +34,7 @@ function imageUrl(publisherConfig, s3Key, width, height) {
34
34
  : `https://${publisherConfig["cdn-image"]}`;
35
35
  width = width || "";
36
36
  height = height || "";
37
- return `${imageSrc}/${s3Key}?w=${width}&h=${height}&auto=format%2Ccompress&fit=max`;
37
+ return `${imageSrc}/${s3Key}?w=${width}&h=${height}&auto=format%2Ccompress&fit=max&enlarge=true`;
38
38
  }
39
39
 
40
40
  function generateCommonData(structuredData = {}, story = {}, publisherConfig = {}, timezone) {
package/src/text-tags.js CHANGED
@@ -81,33 +81,6 @@ 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
-
111
84
  function buildTagsFromAuthor(config, author, url = {}, data) {
112
85
  if (isEmpty(author)) return;
113
86
 
@@ -247,8 +220,6 @@ function getSeoData(config, pageType, data, url = {}, seoConfig = {}) {
247
220
  buildTagsFromStaticPage(config, get(data, ["data", "page"], {}), url, data) ||
248
221
  getSeoData(config, "home-page", data, url)
249
222
  );
250
- case "not-found":
251
- return buildTagsFromNotfoundPage(config, url, data) || getSeoData(config, "home-page", data, url);
252
223
  case "shell":
253
224
  return getShellSeoData(config);
254
225
  default: