@quintype/seo 1.40.12 → 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/dist/index.cjs.js +29 -0
- package/package.json +1 -1
- package/src/text-tags.js +29 -0
package/dist/index.cjs.js
CHANGED
|
@@ -982,6 +982,33 @@ 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
|
+
|
|
985
1012
|
function buildTagsFromAuthor(config, author, url = {}, data) {
|
|
986
1013
|
if (lodash.isEmpty(author)) return;
|
|
987
1014
|
|
|
@@ -1098,6 +1125,8 @@ function getSeoData(config, pageType, data, url = {}, seoConfig = {}) {
|
|
|
1098
1125
|
return buildTagsFromAuthor(config, lodash.get(data, ["data", "author"], {}), url, data) || getSeoData(config, "home-page", data, url);
|
|
1099
1126
|
case "static-page":
|
|
1100
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);
|
|
1101
1130
|
case "shell":
|
|
1102
1131
|
return getShellSeoData(config);
|
|
1103
1132
|
default:
|
package/package.json
CHANGED
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:
|