@quintype/seo 1.41.3-gsc-errors-fix.0 → 1.41.3
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 +2 -0
- package/dist/index.cjs.js +3 -4
- package/package.json +1 -1
- package/src/amp-tags.js +2 -2
- package/src/author-tags.js +1 -1
- package/src/generate-common-seo.js +1 -1
- package/test/amp_tags_test.js +8 -2
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.41.3](https://github.com/quintype/quintype-node-seo/compare/v1.41.2...v1.41.3) (2022-12-02)
|
|
6
|
+
|
|
5
7
|
### [1.41.2](https://github.com/quintype/quintype-node-seo/compare/v1.41.1...v1.41.2) (2022-11-30)
|
|
6
8
|
|
|
7
9
|
### [1.41.1](https://github.com/quintype/quintype-node-seo/compare/v1.41.1-gsc-errors.0...v1.41.1) (2022-11-29)
|
package/dist/index.cjs.js
CHANGED
|
@@ -81,14 +81,13 @@ const getDomain = (url, domainSlug) => {
|
|
|
81
81
|
* @param {...*} params See {@link Generator} for other Parameters
|
|
82
82
|
*/
|
|
83
83
|
function StoryAmpTags(seoConfig, config, pageType, data = {}, opts) {
|
|
84
|
-
const templatesToIgnore = seoConfig.ignoreAmpHtmlStoryTemplates || ["visual-story"];
|
|
85
84
|
const story = get__default["default"](data, ["data", "story"], {});
|
|
86
85
|
const { currentHostUrl = "", domainSlug } = data;
|
|
87
86
|
// TODO: Remove this condition and always make absolute URL if that's better for AMP discoverability.
|
|
88
87
|
const ampUrlAppend = seoConfig.appendHostToAmpUrl ? getDomain(currentHostUrl, domainSlug) || config["sketches-host"] : "";
|
|
89
88
|
const storySlug = seoConfig.decodeAmpUrl ? decodeURIComponent(story.slug) : encodeURIComponent(story.slug);
|
|
90
89
|
const ampUrl = story["story-template"] === "visual-story" ? `${ampUrlAppend}/${storySlug}` : `${ampUrlAppend}/amp/story/${storySlug}`;
|
|
91
|
-
const ignoreStoryTemplate =
|
|
90
|
+
const ignoreStoryTemplate = seoConfig.ignoreAmpHtmlStoryTemplates && seoConfig.ignoreAmpHtmlStoryTemplates.includes(story["story-template"]);
|
|
92
91
|
if (showAmpTag(seoConfig, pageType, story) && !ignoreStoryTemplate) {
|
|
93
92
|
return [{
|
|
94
93
|
tag: "link",
|
|
@@ -119,7 +118,7 @@ function AuthorTags(seoConfig, config, pageType, data, { url }) {
|
|
|
119
118
|
}
|
|
120
119
|
|
|
121
120
|
function getTwitterCreator(storyData) {
|
|
122
|
-
const twitterData = lodash.get(storyData, ["data", "story", "authors", 0, "social", "twitter"], {});
|
|
121
|
+
const twitterData = lodash.get(storyData, ["data", "story", "authors", 0, "social", "twitter"], {}) || {};
|
|
123
122
|
const twitterUrl = twitterData.url || "";
|
|
124
123
|
const twitterHandle = twitterData.handle || "";
|
|
125
124
|
if (twitterHandle.startsWith("@")) return twitterHandle;
|
|
@@ -208,7 +207,7 @@ function generateStructuredData(config = {}) {
|
|
|
208
207
|
}
|
|
209
208
|
|
|
210
209
|
function getSiteTwitterHandle(config, fallback) {
|
|
211
|
-
const twitterUrl = get__default["default"](config, ["social-links", "twitter-url"], "");
|
|
210
|
+
const twitterUrl = get__default["default"](config, ["social-links", "twitter-url"], "") || "";
|
|
212
211
|
const twitterHandleFromUrl = twitterUrl.split("/").pop();
|
|
213
212
|
if (twitterHandleFromUrl) {
|
|
214
213
|
if (twitterHandleFromUrl.startsWith("@")) return twitterHandleFromUrl;
|
package/package.json
CHANGED
package/src/amp-tags.js
CHANGED
|
@@ -33,7 +33,6 @@ const getDomain = (url, domainSlug) => {
|
|
|
33
33
|
* @param {...*} params See {@link Generator} for other Parameters
|
|
34
34
|
*/
|
|
35
35
|
export function StoryAmpTags(seoConfig, config, pageType, data = {}, opts) {
|
|
36
|
-
const templatesToIgnore = seoConfig.ignoreAmpHtmlStoryTemplates || ["visual-story"];
|
|
37
36
|
const story = get(data, ["data", "story"], {});
|
|
38
37
|
const { currentHostUrl = "", domainSlug } = data;
|
|
39
38
|
// TODO: Remove this condition and always make absolute URL if that's better for AMP discoverability.
|
|
@@ -45,7 +44,8 @@ export function StoryAmpTags(seoConfig, config, pageType, data = {}, opts) {
|
|
|
45
44
|
story["story-template"] === "visual-story"
|
|
46
45
|
? `${ampUrlAppend}/${storySlug}`
|
|
47
46
|
: `${ampUrlAppend}/amp/story/${storySlug}`;
|
|
48
|
-
const ignoreStoryTemplate =
|
|
47
|
+
const ignoreStoryTemplate =
|
|
48
|
+
seoConfig.ignoreAmpHtmlStoryTemplates && seoConfig.ignoreAmpHtmlStoryTemplates.includes(story["story-template"]);
|
|
49
49
|
if (showAmpTag(seoConfig, pageType, story) && !ignoreStoryTemplate) {
|
|
50
50
|
return [
|
|
51
51
|
{
|
package/src/author-tags.js
CHANGED
|
@@ -21,7 +21,7 @@ export function AuthorTags(seoConfig, config, pageType, data, { url }) {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
function getTwitterCreator(storyData) {
|
|
24
|
-
const twitterData = get(storyData, ["data", "story", "authors", 0, "social", "twitter"], {});
|
|
24
|
+
const twitterData = get(storyData, ["data", "story", "authors", 0, "social", "twitter"], {}) || {};
|
|
25
25
|
const twitterUrl = twitterData.url || "";
|
|
26
26
|
const twitterHandle = twitterData.handle || "";
|
|
27
27
|
if (twitterHandle.startsWith("@")) return twitterHandle;
|
|
@@ -83,7 +83,7 @@ export function generateStructuredData(config = {}) {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
function getSiteTwitterHandle(config, fallback) {
|
|
86
|
-
const twitterUrl = get(config, ["social-links", "twitter-url"], "");
|
|
86
|
+
const twitterUrl = get(config, ["social-links", "twitter-url"], "") || "";
|
|
87
87
|
const twitterHandleFromUrl = twitterUrl.split("/").pop();
|
|
88
88
|
if (twitterHandleFromUrl) {
|
|
89
89
|
if (twitterHandleFromUrl.startsWith("@")) return twitterHandleFromUrl;
|
package/test/amp_tags_test.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const { StoryAmpTags } = require("..");
|
|
2
2
|
const { getSeoMetadata, assertContains } = require("./utils");
|
|
3
3
|
|
|
4
|
-
const assert = require(
|
|
4
|
+
const assert = require('assert');
|
|
5
5
|
|
|
6
|
-
describe(
|
|
6
|
+
describe('AmpTags', function () {
|
|
7
7
|
const seoConfig = {
|
|
8
8
|
generators: [StoryAmpTags],
|
|
9
9
|
ampStoryPages: true,
|
|
@@ -19,6 +19,12 @@ describe("AmpTags", function () {
|
|
|
19
19
|
assertContains('<link rel="amphtml" href="/amp/story/section%2Fslug"/>', string);
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
+
it("it does not append `/amp/story` to the amp tag when it's a visual story", function () {
|
|
23
|
+
const story = { slug: "section/slug", "is-amp-supported": true };
|
|
24
|
+
const string = getSeoMetadata(seoConfig, config, "story-page", { data: { story: { ...story, "story-template": "visual-story" } } }, {});
|
|
25
|
+
assertContains('<link rel="amphtml" href="/section%2Fslug"/>', string);
|
|
26
|
+
});
|
|
27
|
+
|
|
22
28
|
it("does not rely on is-amp-supported in story API", function () {
|
|
23
29
|
const story = { slug: "section/slug", "is-amp-supported": false };
|
|
24
30
|
const string = getSeoMetadata(seoConfig, config, "story-page", { data: { story: story } }, {});
|