@quintype/seo 1.40.14-gsc-errors.0 → 1.40.14-metaDescription.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/dist/index.cjs.js CHANGED
@@ -930,7 +930,7 @@ function buildTagsFromStory(config, story, url = {}, data = {}) {
930
930
  const authors = lodash.get(story, ["authors"], []).map(author => author.name);
931
931
  const title = customSeo.title || seo["meta-title"] || story.headline;
932
932
  const pageTitle = customSeo["page-title"] || seo["meta-title"] || story.headline;
933
- const description = customSeo.description || seo["meta-description"] || story.summary;
933
+ const description = customSeo.description || seo["meta-description"] || story.summary || story.subheadline;
934
934
  const keywords = (customSeo.keywords || seo["meta-keywords"] || (story.tags || []).map(tag => tag.name)).join(",");
935
935
  const ogUrl = customSeo.ogUrl || lodash.get(seo, ["og", "url"]) || storyUrl;
936
936
  const getOgTitle = customSeo.ogTitle || lodash.get(story, ["alternative", "social", "default", "headline"], story.headline) || story.headline;
@@ -1292,7 +1292,7 @@ class SEO {
1292
1292
  */
1293
1293
  constructor(seoConfig = {}) {
1294
1294
  this.seoConfig = seoConfig;
1295
- this.generators = (seoConfig.generators || [TextTags, ImageTags, AuthorTags, StaticTags, StructuredDataTags]).concat(seoConfig.extraGenerators || []);
1295
+ this.generators = (seoConfig.generators || [TextTags, ImageTags, AuthorTags, StaticTags, StructuredDataTags, StoryAmpTags]).concat(seoConfig.extraGenerators || []);
1296
1296
  }
1297
1297
 
1298
1298
  getMetaTags(config, pageType, data, params = {}) {
package/index.js CHANGED
@@ -1,35 +1,23 @@
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
- export {
13
- TextTags,
14
- StaticTags,
15
- AuthorTags,
16
- ImageTags,
17
- StructuredDataTags,
18
- StoryAmpTags,
19
- generateStaticData,
20
- generateStructuredData,
21
- };
12
+
13
+ export { TextTags, StaticTags, AuthorTags, ImageTags, StructuredDataTags, StoryAmpTags, generateStaticData, generateStructuredData };
22
14
 
23
15
  function tagToKey(tag) {
24
16
  switch (tag.tag || "meta") {
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();
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();
33
21
  }
34
22
  }
35
23
 
@@ -40,9 +28,7 @@ export class MetaTagList {
40
28
 
41
29
  toString() {
42
30
  const uniqueTags = uniqBy(this.tags.reverse(), tagToKey).reverse();
43
- return ReactDomServer.renderToStaticMarkup(
44
- uniqueTags.map((tag) => React.createElement(tag.tag || "meta", omit(tag, "tag")))
45
- );
31
+ return ReactDomServer.renderToStaticMarkup(uniqueTags.map(tag => React.createElement(tag.tag || "meta", omit(tag, "tag"))));
46
32
  }
47
33
 
48
34
  addTag() {
@@ -107,16 +93,12 @@ export class SEO {
107
93
  */
108
94
  constructor(seoConfig = {}) {
109
95
  this.seoConfig = seoConfig;
110
- this.generators = (
111
- seoConfig.generators || [TextTags, ImageTags, AuthorTags, StaticTags, StructuredDataTags]
112
- ).concat(seoConfig.extraGenerators || []);
96
+ this.generators = (seoConfig.generators || [TextTags, ImageTags, AuthorTags, StaticTags, StructuredDataTags, StoryAmpTags]).concat(seoConfig.extraGenerators || []);
113
97
  }
114
98
 
115
99
  getMetaTags(config, pageType, data, params = {}) {
116
100
  pageType = get(this.seoConfig, ["pageTypeAliases", pageType], pageType);
117
- return new MetaTagList(
118
- flatMap(this.generators, (generator) => generator(this.seoConfig, config, pageType, data, params))
119
- );
101
+ return new MetaTagList(flatMap(this.generators, generator => generator(this.seoConfig, config, pageType, data, params)));
120
102
  }
121
103
 
122
104
  getTitle(config, pageType, data, params = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/seo",
3
- "version": "1.40.14-gsc-errors.0",
3
+ "version": "1.40.14-metaDescription.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",
package/src/text-tags.js CHANGED
@@ -28,7 +28,7 @@ function buildTagsFromStory(config, story, url = {}, data = {}) {
28
28
  const authors = get(story, ["authors"], []).map((author) => author.name);
29
29
  const title = customSeo.title || seo["meta-title"] || story.headline;
30
30
  const pageTitle = customSeo["page-title"] || seo["meta-title"] || story.headline;
31
- const description = customSeo.description || seo["meta-description"] || story.summary;
31
+ const description = customSeo.description || seo["meta-description"] || story.summary || story.subheadline;
32
32
  const keywords = (customSeo.keywords || seo["meta-keywords"] || (story.tags || []).map((tag) => tag.name)).join(",");
33
33
  const ogUrl = customSeo.ogUrl || get(seo, ["og", "url"]) || storyUrl;
34
34
  const getOgTitle =