@quintype/seo 1.43.0 → 1.44.1
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 +13 -0
- package/dist/index.cjs.js +9 -0
- package/package.json +1 -1
- package/src/amp-tags.js +9 -0
- package/test/amp_tags_test.js +20 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
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.44.1](https://github.com/quintype/quintype-node-seo/compare/v1.44.0...v1.44.1) (2024-01-04)
|
|
6
|
+
|
|
7
|
+
## [1.44.0](https://github.com/quintype/quintype-node-seo/compare/v1.43.0...v1.44.0) (2024-01-04)
|
|
8
|
+
|
|
9
|
+
## [1.43.0-disable-amp-story.1](https://github.com/quintype/quintype-node-seo/compare/v1.43.0-disable-amp-story.0...v1.43.0-disable-amp-story.1) (2023-11-22)
|
|
10
|
+
|
|
11
|
+
## [1.43.0-disable-amp-story.0](https://github.com/quintype/quintype-node-seo/compare/v1.42.2...v1.43.0-disable-amp-story.0) (2023-11-22)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* disable amp for a particular story ([6b5a76d](https://github.com/quintype/quintype-node-seo/commit/6b5a76da754bf2cbabd9a8d0787095366bf18609))
|
|
17
|
+
|
|
5
18
|
## [1.43.0](https://github.com/quintype/quintype-node-seo/compare/v1.43.0-config-amp-story-path.1...v1.43.0) (2023-12-01)
|
|
6
19
|
|
|
7
20
|
### [1.42.2](https://github.com/quintype/quintype-node-seo/compare/v1.42.1...v1.42.2) (2023-07-06)
|
package/dist/index.cjs.js
CHANGED
|
@@ -62,6 +62,12 @@ function showAmpTag({ ampStoryPages = true }, pageType, story) {
|
|
|
62
62
|
return false;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
const isAmpDisabled = get__default["default"](story, ["metadata", "story-attributes", "disable-amp-for-single-story", "0"], "false");
|
|
66
|
+
|
|
67
|
+
if (isAmpDisabled === "true") {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
|
|
65
71
|
if (ampStoryPages === "public" && !isStoryPublic(story)) {
|
|
66
72
|
return false;
|
|
67
73
|
}
|
|
@@ -81,6 +87,9 @@ const getDomain = (url, domainSlug) => {
|
|
|
81
87
|
/**
|
|
82
88
|
* StoryAmpTags adds the amphref to stories which support amp.
|
|
83
89
|
*
|
|
90
|
+
* To disable adding amphref for a specific story, you need to create a story attribute in bold with the slug {disable-amp-for-single-story} and values {true} and {false}. Set its value to "true" in the story which you want to disable amp. Please make sure to name the attributes and values in the exact same way as mentioned
|
|
91
|
+
* attribute slug: "disable-amp-for-single-story" values: "true" , "false"
|
|
92
|
+
*
|
|
84
93
|
* @extends Generator
|
|
85
94
|
* @param {*} seoConfig
|
|
86
95
|
* @param {(boolean|"public")} seoConfig.ampStoryPages Should amp story pages be shown for all stories (true), not shown (false), or only be shown for public stories ("public"). Default: true
|
package/package.json
CHANGED
package/src/amp-tags.js
CHANGED
|
@@ -6,6 +6,12 @@ function showAmpTag({ ampStoryPages = true }, pageType, story) {
|
|
|
6
6
|
return false;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
const isAmpDisabled = get(story, ["metadata", "story-attributes", "disable-amp-for-single-story", "0"], "false");
|
|
10
|
+
|
|
11
|
+
if (isAmpDisabled === "true") {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
|
|
9
15
|
if (ampStoryPages === "public" && !isStoryPublic(story)) {
|
|
10
16
|
return false;
|
|
11
17
|
}
|
|
@@ -25,6 +31,9 @@ const getDomain = (url, domainSlug) => {
|
|
|
25
31
|
/**
|
|
26
32
|
* StoryAmpTags adds the amphref to stories which support amp.
|
|
27
33
|
*
|
|
34
|
+
* To disable adding amphref for a specific story, you need to create a story attribute in bold with the slug {disable-amp-for-single-story} and values {true} and {false}. Set its value to "true" in the story which you want to disable amp. Please make sure to name the attributes and values in the exact same way as mentioned
|
|
35
|
+
* attribute slug: "disable-amp-for-single-story" values: "true" , "false"
|
|
36
|
+
*
|
|
28
37
|
* @extends Generator
|
|
29
38
|
* @param {*} seoConfig
|
|
30
39
|
* @param {(boolean|"public")} seoConfig.ampStoryPages Should amp story pages be shown for all stories (true), not shown (false), or only be shown for public stories ("public"). Default: true
|
package/test/amp_tags_test.js
CHANGED
|
@@ -25,6 +25,26 @@ describe("AmpTags", function () {
|
|
|
25
25
|
assertContains('<link rel="amphtml" href="/amp/story/section%2Fslug"/>', string);
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
+
it("does not add amphtml link tag to story pages which has disableamp attribute set to true", function () {
|
|
29
|
+
const story = {
|
|
30
|
+
slug: "section/slug",
|
|
31
|
+
"is-amp-supported": true,
|
|
32
|
+
metadata: { "story-attributes": { "disable-amp-for-single-story": ["true"] } },
|
|
33
|
+
};
|
|
34
|
+
const string = getSeoMetadata(seoConfig, config, "story-page", { data: { story: story } }, {});
|
|
35
|
+
assert.equal("", string);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it("does not add amphtml link tag to story pages which has disableamp attribute set to false", function () {
|
|
39
|
+
const story = {
|
|
40
|
+
slug: "section/slug",
|
|
41
|
+
"is-amp-supported": true,
|
|
42
|
+
metadata: { "story-attributes": { "disable-amp-for-single-story": ["false"] } },
|
|
43
|
+
};
|
|
44
|
+
const string = getSeoMetadata(seoConfig, config, "story-page", { data: { story: story } }, {});
|
|
45
|
+
assert.equal('<link rel="amphtml" href="/amp/story/section%2Fslug"/>', string);
|
|
46
|
+
});
|
|
47
|
+
|
|
28
48
|
it("does not add amphtml link tag to amp story pages", function () {
|
|
29
49
|
const story = { slug: "section/slug", "is-amp-supported": true };
|
|
30
50
|
const string = getSeoMetadata(seoConfig, config, "story-page-amp", { data: { story: story } }, {});
|