@quintype/seo 1.41.2 → 1.41.3-gsc-errors-fix.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 +2 -1
- package/package.json +1 -1
- package/src/amp-tags.js +2 -2
- package/test/amp_tags_test.js +2 -8
package/dist/index.cjs.js
CHANGED
|
@@ -81,13 +81,14 @@ 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"];
|
|
84
85
|
const story = get__default["default"](data, ["data", "story"], {});
|
|
85
86
|
const { currentHostUrl = "", domainSlug } = data;
|
|
86
87
|
// TODO: Remove this condition and always make absolute URL if that's better for AMP discoverability.
|
|
87
88
|
const ampUrlAppend = seoConfig.appendHostToAmpUrl ? getDomain(currentHostUrl, domainSlug) || config["sketches-host"] : "";
|
|
88
89
|
const storySlug = seoConfig.decodeAmpUrl ? decodeURIComponent(story.slug) : encodeURIComponent(story.slug);
|
|
89
90
|
const ampUrl = story["story-template"] === "visual-story" ? `${ampUrlAppend}/${storySlug}` : `${ampUrlAppend}/amp/story/${storySlug}`;
|
|
90
|
-
const ignoreStoryTemplate =
|
|
91
|
+
const ignoreStoryTemplate = templatesToIgnore.includes(story["story-template"]);
|
|
91
92
|
if (showAmpTag(seoConfig, pageType, story) && !ignoreStoryTemplate) {
|
|
92
93
|
return [{
|
|
93
94
|
tag: "link",
|
package/package.json
CHANGED
package/src/amp-tags.js
CHANGED
|
@@ -33,6 +33,7 @@ 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"];
|
|
36
37
|
const story = get(data, ["data", "story"], {});
|
|
37
38
|
const { currentHostUrl = "", domainSlug } = data;
|
|
38
39
|
// TODO: Remove this condition and always make absolute URL if that's better for AMP discoverability.
|
|
@@ -44,8 +45,7 @@ export function StoryAmpTags(seoConfig, config, pageType, data = {}, opts) {
|
|
|
44
45
|
story["story-template"] === "visual-story"
|
|
45
46
|
? `${ampUrlAppend}/${storySlug}`
|
|
46
47
|
: `${ampUrlAppend}/amp/story/${storySlug}`;
|
|
47
|
-
const ignoreStoryTemplate =
|
|
48
|
-
seoConfig.ignoreAmpHtmlStoryTemplates && seoConfig.ignoreAmpHtmlStoryTemplates.includes(story["story-template"]);
|
|
48
|
+
const ignoreStoryTemplate = templatesToIgnore.includes(story["story-template"]);
|
|
49
49
|
if (showAmpTag(seoConfig, pageType, story) && !ignoreStoryTemplate) {
|
|
50
50
|
return [
|
|
51
51
|
{
|
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,12 +19,6 @@ 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
|
-
|
|
28
22
|
it("does not rely on is-amp-supported in story API", function () {
|
|
29
23
|
const story = { slug: "section/slug", "is-amp-supported": false };
|
|
30
24
|
const string = getSeoMetadata(seoConfig, config, "story-page", { data: { story: story } }, {});
|