@quintype/seo 1.40.15 → 1.41.0-canonical-toggle.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
@@ -936,12 +936,13 @@ function buildTagsFromStory(config, story, url = {}, data = {}) {
936
936
  const ogUrl = customSeo.ogUrl || lodash.get(seo, ["og", "url"]) || storyUrl;
937
937
  const getOgTitle = customSeo.ogTitle || lodash.get(story, ["alternative", "social", "default", "headline"], story.headline) || story.headline;
938
938
  const ogDescription = customSeo.ogDescription || story.summary;
939
+ const canonicalUrl = customSeo.canonicalUrl || story["canonical-url"] || storyUrl;
939
940
  const storyMetaData = {
940
941
  title,
941
942
  "page-title": pageTitle,
942
943
  description,
943
944
  keywords,
944
- canonicalUrl: story["canonical-url"] || storyUrl,
945
+ canonicalUrl,
945
946
  ogUrl,
946
947
  ogTitle: getOgTitle,
947
948
  ogDescription,
@@ -966,7 +967,7 @@ function buildTagsFromTopic(config, tag, url = {}, data) {
966
967
  const description = `Read stories listed under on ${tag.name}`;
967
968
  const tagUrl = `${config["sketches-host"]}${url.pathname}`;
968
969
  const canonicalSlug = tag["canonical-slug"] || url.pathname;
969
- const canonicalUrl = `${config["sketches-host"]}${canonicalSlug}`;
970
+ const canonicalUrl = customSeo.canonicalUrl || `${config["sketches-host"]}${canonicalSlug}`;
970
971
  const ogTitle = customSeo.ogTitle || tagName;
971
972
  const ogDescription = customSeo.ogDescription || description;
972
973
  const topicMetaData = {
@@ -993,7 +994,7 @@ function buildTagsFromNotfoundPage(config, url = {}, data) {
993
994
  const description = customSeo.description || homeSeoData.data.description || "404 - Page not found";
994
995
  const pageUrl = `${config["sketches-host"]}${url.pathname}`;
995
996
  const canonicalSlug = url.pathname;
996
- const canonicalUrl = `${config["sketches-host"]}${canonicalSlug}`;
997
+ const canonicalUrl = customSeo.canonicalUrl || `${config["sketches-host"]}${canonicalSlug}`;
997
998
  const ogTitle = customSeo.ogTitle || title;
998
999
  const ogDescription = customSeo.ogDescription || description;
999
1000
  const notFoundMetaData = {
@@ -1020,13 +1021,14 @@ function buildTagsFromAuthor(config, author, url = {}, data) {
1020
1021
  const ogTitle = customSeo.ogTitle || author.name;
1021
1022
  const authorUrl = `${config["sketches-host"]}${url.pathname}`;
1022
1023
  const ogDescription = customSeo.ogDescription || description;
1024
+ const canonicalUrl = customSeo.canonicalUrl || authorUrl;
1023
1025
 
1024
1026
  return {
1025
1027
  title,
1026
1028
  "page-title": pageTitle,
1027
1029
  description,
1028
1030
  keywords: `${title},${config["publisher-name"]}`,
1029
- canonicalUrl: authorUrl,
1031
+ canonicalUrl,
1030
1032
  ogUrl: authorUrl,
1031
1033
  ogTitle,
1032
1034
  ogDescription
@@ -1054,13 +1056,14 @@ function buildTagsFromStaticPage(config, page, url = {}, data) {
1054
1056
  const ogTitle = customSeo.ogTitle || title;
1055
1057
  const staticPageUrl = `${config["sketches-host"]}${url.pathname}`;
1056
1058
  const ogDescription = customSeo.ogDescription || description;
1059
+ const canonicalUrl = customSeo.canonicalUrl || staticPageUrl;
1057
1060
 
1058
1061
  return {
1059
1062
  title,
1060
1063
  "page-title": pageTitle,
1061
1064
  description,
1062
1065
  keywords: `${title},${config["publisher-name"]}`,
1063
- canonicalUrl: staticPageUrl,
1066
+ canonicalUrl,
1064
1067
  ogUrl: staticPageUrl,
1065
1068
  ogTitle,
1066
1069
  ogDescription,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/seo",
3
- "version": "1.40.15",
3
+ "version": "1.41.0-canonical-toggle.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
@@ -34,12 +34,13 @@ function buildTagsFromStory(config, story, url = {}, data = {}) {
34
34
  const getOgTitle =
35
35
  customSeo.ogTitle || get(story, ["alternative", "social", "default", "headline"], story.headline) || story.headline;
36
36
  const ogDescription = customSeo.ogDescription || story.summary;
37
+ const canonicalUrl = customSeo.canonicalUrl || story["canonical-url"] || storyUrl;
37
38
  const storyMetaData = {
38
39
  title,
39
40
  "page-title": pageTitle,
40
41
  description,
41
42
  keywords,
42
- canonicalUrl: story["canonical-url"] || storyUrl,
43
+ canonicalUrl,
43
44
  ogUrl,
44
45
  ogTitle: getOgTitle,
45
46
  ogDescription,
@@ -64,7 +65,7 @@ function buildTagsFromTopic(config, tag, url = {}, data) {
64
65
  const description = `Read stories listed under on ${tag.name}`;
65
66
  const tagUrl = `${config["sketches-host"]}${url.pathname}`;
66
67
  const canonicalSlug = tag["canonical-slug"] || url.pathname;
67
- const canonicalUrl = `${config["sketches-host"]}${canonicalSlug}`;
68
+ const canonicalUrl = customSeo.canonicalUrl || `${config["sketches-host"]}${canonicalSlug}`;
68
69
  const ogTitle = customSeo.ogTitle || tagName;
69
70
  const ogDescription = customSeo.ogDescription || description;
70
71
  const topicMetaData = {
@@ -91,7 +92,7 @@ function buildTagsFromNotfoundPage(config, url = {}, data) {
91
92
  const description = customSeo.description || homeSeoData.data.description || "404 - Page not found";
92
93
  const pageUrl = `${config["sketches-host"]}${url.pathname}`;
93
94
  const canonicalSlug = url.pathname;
94
- const canonicalUrl = `${config["sketches-host"]}${canonicalSlug}`;
95
+ const canonicalUrl = customSeo.canonicalUrl || `${config["sketches-host"]}${canonicalSlug}`;
95
96
  const ogTitle = customSeo.ogTitle || title;
96
97
  const ogDescription = customSeo.ogDescription || description;
97
98
  const notFoundMetaData = {
@@ -118,13 +119,14 @@ function buildTagsFromAuthor(config, author, url = {}, data) {
118
119
  const ogTitle = customSeo.ogTitle || author.name;
119
120
  const authorUrl = `${config["sketches-host"]}${url.pathname}`;
120
121
  const ogDescription = customSeo.ogDescription || description;
122
+ const canonicalUrl = customSeo.canonicalUrl || authorUrl;
121
123
 
122
124
  return {
123
125
  title,
124
126
  "page-title": pageTitle,
125
127
  description,
126
128
  keywords: `${title},${config["publisher-name"]}`,
127
- canonicalUrl: authorUrl,
129
+ canonicalUrl,
128
130
  ogUrl: authorUrl,
129
131
  ogTitle,
130
132
  ogDescription,
@@ -152,13 +154,14 @@ function buildTagsFromStaticPage(config, page, url = {}, data) {
152
154
  const ogTitle = customSeo.ogTitle || title;
153
155
  const staticPageUrl = `${config["sketches-host"]}${url.pathname}`;
154
156
  const ogDescription = customSeo.ogDescription || description;
157
+ const canonicalUrl = customSeo.canonicalUrl || staticPageUrl;
155
158
 
156
159
  return {
157
160
  title,
158
161
  "page-title": pageTitle,
159
162
  description,
160
163
  keywords: `${title},${config["publisher-name"]}`,
161
- canonicalUrl: staticPageUrl,
164
+ canonicalUrl,
162
165
  ogUrl: staticPageUrl,
163
166
  ogTitle,
164
167
  ogDescription,