react-datocms 2.0.1 → 2.2.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/README.md +143 -58
- package/dist/cjs/Seo/__tests__/index.test.js +272 -37
- package/dist/cjs/Seo/__tests__/index.test.js.map +1 -1
- package/dist/cjs/Seo/index.js +13 -60
- package/dist/cjs/Seo/index.js.map +1 -1
- package/dist/cjs/Seo/remixUtils.js +33 -0
- package/dist/cjs/Seo/remixUtils.js.map +1 -0
- package/dist/cjs/Seo/renderMetaTags.js +40 -0
- package/dist/cjs/Seo/renderMetaTags.js.map +1 -0
- package/dist/cjs/Seo/renderMetaTagsToString.js +22 -0
- package/dist/cjs/Seo/renderMetaTagsToString.js.map +1 -0
- package/dist/cjs/Seo/types.js +5 -0
- package/dist/cjs/Seo/types.js.map +1 -0
- package/dist/cjs/StructuredText/__tests__/index.test.js +77 -67
- package/dist/cjs/StructuredText/__tests__/index.test.js.map +1 -1
- package/dist/cjs/StructuredText/index.js +76 -61
- package/dist/cjs/StructuredText/index.js.map +1 -1
- package/dist/cjs/useQuerySubscription/index.js +1 -1
- package/dist/cjs/useQuerySubscription/index.js.map +1 -1
- package/dist/esm/Seo/__tests__/index.test.js +271 -36
- package/dist/esm/Seo/__tests__/index.test.js.map +1 -1
- package/dist/esm/Seo/index.d.ts +4 -12
- package/dist/esm/Seo/index.js +4 -55
- package/dist/esm/Seo/index.js.map +1 -1
- package/dist/esm/Seo/remixUtils.d.ts +6 -0
- package/dist/esm/Seo/remixUtils.js +29 -0
- package/dist/esm/Seo/remixUtils.js.map +1 -0
- package/dist/esm/Seo/renderMetaTags.d.ts +3 -0
- package/dist/esm/Seo/renderMetaTags.js +33 -0
- package/dist/esm/Seo/renderMetaTags.js.map +1 -0
- package/dist/esm/Seo/renderMetaTagsToString.d.ts +2 -0
- package/dist/esm/Seo/renderMetaTagsToString.js +18 -0
- package/dist/esm/Seo/renderMetaTagsToString.js.map +1 -0
- package/dist/esm/Seo/types.d.ts +37 -0
- package/dist/esm/Seo/types.js +4 -0
- package/dist/esm/Seo/types.js.map +1 -0
- package/dist/esm/StructuredText/__tests__/index.test.js +81 -71
- package/dist/esm/StructuredText/__tests__/index.test.js.map +1 -1
- package/dist/esm/StructuredText/index.d.ts +12 -7
- package/dist/esm/StructuredText/index.js +78 -63
- package/dist/esm/StructuredText/index.js.map +1 -1
- package/dist/esm/useQuerySubscription/index.js +1 -1
- package/dist/esm/useQuerySubscription/index.js.map +1 -1
- package/dist/types/Seo/index.d.ts +4 -12
- package/dist/types/Seo/remixUtils.d.ts +6 -0
- package/dist/types/Seo/renderMetaTags.d.ts +3 -0
- package/dist/types/Seo/renderMetaTagsToString.d.ts +2 -0
- package/dist/types/Seo/types.d.ts +37 -0
- package/dist/types/StructuredText/index.d.ts +12 -7
- package/package.json +2 -2
|
@@ -18,10 +18,17 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
18
18
|
__setModuleDefault(result, mod);
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
21
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
22
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
23
|
+
to[j] = from[i];
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
21
26
|
exports.__esModule = true;
|
|
22
|
-
exports.StructuredText = exports.appendKeyToValidElement = exports.defaultAdapter = exports.RenderError = exports.
|
|
27
|
+
exports.StructuredText = exports.appendKeyToValidElement = exports.defaultAdapter = exports.renderRule = exports.RenderError = exports.renderMarkRule = exports.renderNodeRule = void 0;
|
|
23
28
|
var datocms_structured_text_generic_html_renderer_1 = require("datocms-structured-text-generic-html-renderer");
|
|
24
|
-
exports.
|
|
29
|
+
exports.renderNodeRule = datocms_structured_text_generic_html_renderer_1.renderNodeRule;
|
|
30
|
+
exports.renderRule = datocms_structured_text_generic_html_renderer_1.renderNodeRule;
|
|
31
|
+
exports.renderMarkRule = datocms_structured_text_generic_html_renderer_1.renderMarkRule;
|
|
25
32
|
var datocms_structured_text_utils_1 = require("datocms-structured-text-utils");
|
|
26
33
|
exports.RenderError = datocms_structured_text_utils_1.RenderError;
|
|
27
34
|
var react_1 = __importStar(require("react"));
|
|
@@ -38,65 +45,73 @@ function appendKeyToValidElement(element, key) {
|
|
|
38
45
|
}
|
|
39
46
|
exports.appendKeyToValidElement = appendKeyToValidElement;
|
|
40
47
|
function StructuredText(_a) {
|
|
41
|
-
var data = _a.data, renderInlineRecord = _a.renderInlineRecord, renderLinkToRecord = _a.renderLinkToRecord, renderBlock = _a.renderBlock, renderText = _a.renderText, renderNode = _a.renderNode, renderFragment = _a.renderFragment, customRules = _a.customRules, metaTransformer = _a.metaTransformer;
|
|
42
|
-
var result = datocms_structured_text_generic_html_renderer_1.render({
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
48
|
+
var data = _a.data, renderInlineRecord = _a.renderInlineRecord, renderLinkToRecord = _a.renderLinkToRecord, renderBlock = _a.renderBlock, renderText = _a.renderText, renderNode = _a.renderNode, renderFragment = _a.renderFragment, customMarkRules = _a.customMarkRules, customRules = _a.customRules, customNodeRules = _a.customNodeRules, metaTransformer = _a.metaTransformer;
|
|
49
|
+
var result = datocms_structured_text_generic_html_renderer_1.render(data, {
|
|
50
|
+
adapter: {
|
|
51
|
+
renderText: renderText || exports.defaultAdapter.renderText,
|
|
52
|
+
renderNode: renderNode || exports.defaultAdapter.renderNode,
|
|
53
|
+
renderFragment: renderFragment || exports.defaultAdapter.renderFragment
|
|
54
|
+
},
|
|
55
|
+
metaTransformer: metaTransformer,
|
|
56
|
+
customMarkRules: customMarkRules,
|
|
57
|
+
customNodeRules: __spreadArray([
|
|
58
|
+
datocms_structured_text_generic_html_renderer_1.renderNodeRule(datocms_structured_text_utils_1.isInlineItem, function (_a) {
|
|
59
|
+
var node = _a.node, key = _a.key;
|
|
60
|
+
if (!renderInlineRecord) {
|
|
61
|
+
throw new datocms_structured_text_utils_1.RenderError("The Structured Text document contains an 'inlineItem' node, but no 'renderInlineRecord' prop is specified!", node);
|
|
62
|
+
}
|
|
63
|
+
if (!datocms_structured_text_utils_1.isStructuredText(data) || !data.links) {
|
|
64
|
+
throw new datocms_structured_text_utils_1.RenderError("The document contains an 'itemLink' node, but the passed data prop is not a Structured Text GraphQL response, or data.links is not present!", node);
|
|
65
|
+
}
|
|
66
|
+
var item = data.links.find(function (item) { return item.id === node.item; });
|
|
67
|
+
if (!item) {
|
|
68
|
+
throw new datocms_structured_text_utils_1.RenderError("The Structured Text document contains an 'inlineItem' node, but cannot find a record with ID " + node.item + " inside data.links!", node);
|
|
69
|
+
}
|
|
70
|
+
return appendKeyToValidElement(renderInlineRecord({ record: item }), key);
|
|
71
|
+
}),
|
|
72
|
+
datocms_structured_text_generic_html_renderer_1.renderNodeRule(datocms_structured_text_utils_1.isItemLink, function (_a) {
|
|
73
|
+
var node = _a.node, key = _a.key, children = _a.children;
|
|
74
|
+
if (!renderLinkToRecord) {
|
|
75
|
+
throw new datocms_structured_text_utils_1.RenderError("The Structured Text document contains an 'itemLink' node, but no 'renderLinkToRecord' prop is specified!", node);
|
|
76
|
+
}
|
|
77
|
+
if (!datocms_structured_text_utils_1.isStructuredText(data) || !data.links) {
|
|
78
|
+
throw new datocms_structured_text_utils_1.RenderError("The document contains an 'itemLink' node, but the passed data prop is not a Structured Text GraphQL response, or data.links is not present!", node);
|
|
79
|
+
}
|
|
80
|
+
var item = data.links.find(function (item) { return item.id === node.item; });
|
|
81
|
+
if (!item) {
|
|
82
|
+
throw new datocms_structured_text_utils_1.RenderError("The Structured Text document contains an 'itemLink' node, but cannot find a record with ID " + node.item + " inside data.links!", node);
|
|
83
|
+
}
|
|
84
|
+
return appendKeyToValidElement(renderLinkToRecord({
|
|
85
|
+
record: item,
|
|
86
|
+
children: children,
|
|
87
|
+
transformedMeta: node.meta
|
|
88
|
+
? (metaTransformer || datocms_structured_text_generic_html_renderer_1.defaultMetaTransformer)({
|
|
89
|
+
node: node,
|
|
90
|
+
meta: node.meta
|
|
91
|
+
})
|
|
92
|
+
: null
|
|
93
|
+
}), key);
|
|
94
|
+
}),
|
|
95
|
+
datocms_structured_text_generic_html_renderer_1.renderNodeRule(datocms_structured_text_utils_1.isBlock, function (_a) {
|
|
96
|
+
var node = _a.node, key = _a.key;
|
|
97
|
+
if (!renderBlock) {
|
|
98
|
+
throw new datocms_structured_text_utils_1.RenderError("The Structured Text document contains a 'block' node, but no 'renderBlock' prop is specified!", node);
|
|
99
|
+
}
|
|
100
|
+
if (!datocms_structured_text_utils_1.isStructuredText(data) || !data.blocks) {
|
|
101
|
+
throw new datocms_structured_text_utils_1.RenderError("The document contains an 'block' node, but the passed data prop is not a Structured Text GraphQL response, or data.blocks is not present!", node);
|
|
102
|
+
}
|
|
103
|
+
var item = data.blocks.find(function (item) { return item.id === node.item; });
|
|
104
|
+
if (!item) {
|
|
105
|
+
throw new datocms_structured_text_utils_1.RenderError("The Structured Text document contains a 'block' node, but cannot find a record with ID " + node.item + " inside data.blocks!", node);
|
|
106
|
+
}
|
|
107
|
+
return appendKeyToValidElement(renderBlock({ record: item }), key);
|
|
108
|
+
})
|
|
109
|
+
], (customNodeRules || customRules || []))
|
|
110
|
+
});
|
|
111
|
+
if (typeof result === 'string') {
|
|
112
|
+
return react_1["default"].createElement(react_1["default"].Fragment, null, result);
|
|
113
|
+
}
|
|
114
|
+
return result || null;
|
|
100
115
|
}
|
|
101
116
|
exports.StructuredText = StructuredText;
|
|
102
117
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/StructuredText/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/StructuredText/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+GAQuD;AAgB9C,yBArBP,8DAAc,CAqBO;AAGI,qBAxBzB,8DAAc,CAwBqB;AAHZ,yBApBvB,8DAAc,CAoBuB;AAfvC,+EAYuC;AAGE,sBATvC,2CAAW,CASuC;AAFpD,6CAA0E;AAe7D,QAAA,cAAc,GAAG;IAC5B,UAAU,EAAE,kBAAK,CAAC,aAAgD;IAClE,cAAc,EAAE,UACd,QAA+B,EAC/B,GAAW,IACO,OAAA,iCAAC,kBAAK,CAAC,QAAQ,IAAC,GAAG,EAAE,GAAG,IAAG,QAAQ,CAAkB,EAArD,CAAqD;IACzE,UAAU,EAAE,UAAC,IAAY,EAAE,GAAW,IAAoB,OAAA,IAAI,EAAJ,CAAI;CAC/D,CAAC;AAEF,SAAgB,uBAAuB,CACrC,OAA4B,EAC5B,GAAW;IAEX,IAAI,sBAAc,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,GAAG,KAAK,IAAI,EAAE;QACnD,OAAO,oBAAY,CAAC,OAAO,EAAE,EAAE,GAAG,KAAA,EAAE,CAAC,CAAC;K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;gBAED,IAAI,CAAC,gDAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;oBAC3C,MAAM,IAAI,2CAAW,CACnB,2IAA2I,EAC3I,IAAI,CACL,CAAC;iBACH;gBAED,IAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,IAAI,EAArB,CAAqB,CAAC,CAAC;gBAE/D,IAAI,CAAC,IAAI,EAAE;oBACT,MAAM,IAAI,2CAAW,CACnB,4FAA0F,IAAI,CAAC,IAAI,yBAAsB,EACzH,IAAI,CACL,CAAC;iBACH;gBAED,OAAO,uBAAuB,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;YACrE,CAAC,CAAC;WACC,CAAC,eAAe,IAAI,WAAW,IAAI,EAAE,CAAC,CAC1C;KACF,CAAC,CAAC;IAEH,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;QAC9B,OAAO,oEAAG,MAAM,CAAI,CAAC;KACtB;IAED,OAAO,MAAM,IAAI,IAAI,CAAC;AACxB,CAAC;AA5HD,wCA4HC"}
|
|
@@ -102,7 +102,7 @@ function useQuerySubscription(options) {
|
|
|
102
102
|
unsubscribe();
|
|
103
103
|
}
|
|
104
104
|
};
|
|
105
|
-
},
|
|
105
|
+
}, [subscribeToQueryOptions]);
|
|
106
106
|
return { error: error, status: status, data: data || initialData };
|
|
107
107
|
}
|
|
108
108
|
exports.useQuerySubscription = useQuerySubscription;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/useQuerySubscription/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAiC;AACjC,iDAMwB;AACxB,mEAA8F;AAyB9F,SA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C,SAAS;oCACxB,OAAO,CAAC,IAAI,CAAC,CAAC;oCACd,QAAQ,CAAC,SAAS,CAAC,CAAC;gCACtB,CAAC,IACD,EAAA;;4BAbF,WAAW,GAAG,SAaZ,CAAC;;;;;SACJ;QAED,SAAS,EAAE,CAAC;QAEZ,OAAO;YACL,IAAI,WAAW,EAAE;gBACf,WAAW,EAAE,CAAC;aACf;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,uBAAuB,CAAC,CAAC,CAAC;IAE9B,OAAO,EAAE,KAAK,OAAA,EAAE,MAAM,QAAA,EAAE,IAAI,EAAE,IAAI,IAAI,WAAW,EAAE,CAAC;AACtD,CAAC;AAvDD,oDAuDC"}
|
|
@@ -1,47 +1,284 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { shallow } from "enzyme";
|
|
3
|
-
import { renderMetaTags, renderMetaTagsToString } from "
|
|
3
|
+
import { renderMetaTags, renderMetaTagsToString, toRemixMeta } from "..";
|
|
4
4
|
var metaTags = [
|
|
5
5
|
{
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
tag: "title"
|
|
6
|
+
"content": "Remix CMS - The easiest way to manage content with Remix",
|
|
7
|
+
"attributes": null,
|
|
8
|
+
"tag": "title"
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
"content": null,
|
|
12
|
+
"attributes": {
|
|
13
|
+
"property": "og:title",
|
|
14
|
+
"content": "Remix CMS - The easiest way to manage content with Remix"
|
|
14
15
|
},
|
|
15
|
-
|
|
16
|
-
tag: "meta"
|
|
16
|
+
"tag": "meta"
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
"content": null,
|
|
20
|
+
"attributes": {
|
|
21
|
+
"name": "twitter:title",
|
|
22
|
+
"content": "Remix CMS - The easiest way to manage content with Remix"
|
|
22
23
|
},
|
|
23
|
-
|
|
24
|
-
tag: "meta"
|
|
24
|
+
"tag": "meta"
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
href: "https://example.org/favicon.png?h=16&w=16"
|
|
27
|
+
"content": null,
|
|
28
|
+
"attributes": {
|
|
29
|
+
"name": "description",
|
|
30
|
+
"content": "Remix makes building scalable and fast React apps simple, pair it with a CMS that shares the same intuitiveness. Start a new Remix + Dato project now."
|
|
32
31
|
},
|
|
33
|
-
|
|
34
|
-
tag: "link"
|
|
32
|
+
"tag": "meta"
|
|
35
33
|
},
|
|
36
34
|
{
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
href: "https://example.org/favicon.png?h=32&w=32"
|
|
35
|
+
"content": null,
|
|
36
|
+
"attributes": {
|
|
37
|
+
"property": "og:description",
|
|
38
|
+
"content": "Remix makes building scalable and fast React apps simple, pair it with a CMS that shares the same intuitiveness. Start a new Remix + Dato project now."
|
|
42
39
|
},
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
"tag": "meta"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"content": null,
|
|
44
|
+
"attributes": {
|
|
45
|
+
"name": "twitter:description",
|
|
46
|
+
"content": "Remix makes building scalable and fast React apps simple, pair it with a CMS that shares the same intuitiveness. Start a new Remix + Dato project now."
|
|
47
|
+
},
|
|
48
|
+
"tag": "meta"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"content": null,
|
|
52
|
+
"attributes": {
|
|
53
|
+
"property": "og:image",
|
|
54
|
+
"content": "https://www.datocms-assets.com/205/1642515293-full-logo.svg?fit=max&fm=jpg&w=1000"
|
|
55
|
+
},
|
|
56
|
+
"tag": "meta"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"content": null,
|
|
60
|
+
"attributes": {
|
|
61
|
+
"property": "og:image:width",
|
|
62
|
+
"content": "746"
|
|
63
|
+
},
|
|
64
|
+
"tag": "meta"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"content": null,
|
|
68
|
+
"attributes": {
|
|
69
|
+
"property": "og:image:height",
|
|
70
|
+
"content": "186"
|
|
71
|
+
},
|
|
72
|
+
"tag": "meta"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"content": null,
|
|
76
|
+
"attributes": {
|
|
77
|
+
"name": "twitter:image",
|
|
78
|
+
"content": "https://www.datocms-assets.com/205/1642515293-full-logo.svg?fit=max&fm=jpg&w=1000"
|
|
79
|
+
},
|
|
80
|
+
"tag": "meta"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"content": null,
|
|
84
|
+
"attributes": {
|
|
85
|
+
"property": "og:locale",
|
|
86
|
+
"content": "en"
|
|
87
|
+
},
|
|
88
|
+
"tag": "meta"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"content": null,
|
|
92
|
+
"attributes": {
|
|
93
|
+
"property": "og:type",
|
|
94
|
+
"content": "article"
|
|
95
|
+
},
|
|
96
|
+
"tag": "meta"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"content": null,
|
|
100
|
+
"attributes": {
|
|
101
|
+
"property": "og:site_name",
|
|
102
|
+
"content": "DatoCMS"
|
|
103
|
+
},
|
|
104
|
+
"tag": "meta"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"content": null,
|
|
108
|
+
"attributes": {
|
|
109
|
+
"property": "article:modified_time",
|
|
110
|
+
"content": "2022-01-18T14:02:47Z"
|
|
111
|
+
},
|
|
112
|
+
"tag": "meta"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"content": null,
|
|
116
|
+
"attributes": {
|
|
117
|
+
"name": "twitter:card",
|
|
118
|
+
"content": "summary_large_image"
|
|
119
|
+
},
|
|
120
|
+
"tag": "meta"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"content": null,
|
|
124
|
+
"attributes": {
|
|
125
|
+
"name": "twitter:site",
|
|
126
|
+
"content": "@datocms"
|
|
127
|
+
},
|
|
128
|
+
"tag": "meta"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"attributes": {
|
|
132
|
+
"sizes": "16x16",
|
|
133
|
+
"type": "image/png",
|
|
134
|
+
"rel": "icon",
|
|
135
|
+
"href": "https://www.datocms-assets.com/205/1525789775-dato.png?h=16&w=16"
|
|
136
|
+
},
|
|
137
|
+
"content": null,
|
|
138
|
+
"tag": "link"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"attributes": {
|
|
142
|
+
"sizes": "32x32",
|
|
143
|
+
"type": "image/png",
|
|
144
|
+
"rel": "icon",
|
|
145
|
+
"href": "https://www.datocms-assets.com/205/1525789775-dato.png?h=32&w=32"
|
|
146
|
+
},
|
|
147
|
+
"content": null,
|
|
148
|
+
"tag": "link"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"attributes": {
|
|
152
|
+
"sizes": "96x96",
|
|
153
|
+
"type": "image/png",
|
|
154
|
+
"rel": "icon",
|
|
155
|
+
"href": "https://www.datocms-assets.com/205/1525789775-dato.png?h=96&w=96"
|
|
156
|
+
},
|
|
157
|
+
"content": null,
|
|
158
|
+
"tag": "link"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"attributes": {
|
|
162
|
+
"sizes": "192x192",
|
|
163
|
+
"type": "image/png",
|
|
164
|
+
"rel": "icon",
|
|
165
|
+
"href": "https://www.datocms-assets.com/205/1525789775-dato.png?h=192&w=192"
|
|
166
|
+
},
|
|
167
|
+
"content": null,
|
|
168
|
+
"tag": "link"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"attributes": {
|
|
172
|
+
"sizes": "57x57",
|
|
173
|
+
"rel": "apple-touch-icon",
|
|
174
|
+
"href": "https://www.datocms-assets.com/205/1525789775-dato.png?h=57&w=57"
|
|
175
|
+
},
|
|
176
|
+
"content": null,
|
|
177
|
+
"tag": "link"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"attributes": {
|
|
181
|
+
"sizes": "60x60",
|
|
182
|
+
"rel": "apple-touch-icon",
|
|
183
|
+
"href": "https://www.datocms-assets.com/205/1525789775-dato.png?h=60&w=60"
|
|
184
|
+
},
|
|
185
|
+
"content": null,
|
|
186
|
+
"tag": "link"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"attributes": {
|
|
190
|
+
"sizes": "72x72",
|
|
191
|
+
"rel": "apple-touch-icon",
|
|
192
|
+
"href": "https://www.datocms-assets.com/205/1525789775-dato.png?h=72&w=72"
|
|
193
|
+
},
|
|
194
|
+
"content": null,
|
|
195
|
+
"tag": "link"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"attributes": {
|
|
199
|
+
"sizes": "76x76",
|
|
200
|
+
"rel": "apple-touch-icon",
|
|
201
|
+
"href": "https://www.datocms-assets.com/205/1525789775-dato.png?h=76&w=76"
|
|
202
|
+
},
|
|
203
|
+
"content": null,
|
|
204
|
+
"tag": "link"
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"attributes": {
|
|
208
|
+
"sizes": "114x114",
|
|
209
|
+
"rel": "apple-touch-icon",
|
|
210
|
+
"href": "https://www.datocms-assets.com/205/1525789775-dato.png?h=114&w=114"
|
|
211
|
+
},
|
|
212
|
+
"content": null,
|
|
213
|
+
"tag": "link"
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
"attributes": {
|
|
217
|
+
"sizes": "120x120",
|
|
218
|
+
"rel": "apple-touch-icon",
|
|
219
|
+
"href": "https://www.datocms-assets.com/205/1525789775-dato.png?h=120&w=120"
|
|
220
|
+
},
|
|
221
|
+
"content": null,
|
|
222
|
+
"tag": "link"
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"attributes": {
|
|
226
|
+
"sizes": "144x144",
|
|
227
|
+
"rel": "apple-touch-icon",
|
|
228
|
+
"href": "https://www.datocms-assets.com/205/1525789775-dato.png?h=144&w=144"
|
|
229
|
+
},
|
|
230
|
+
"content": null,
|
|
231
|
+
"tag": "link"
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"attributes": {
|
|
235
|
+
"sizes": "152x152",
|
|
236
|
+
"rel": "apple-touch-icon",
|
|
237
|
+
"href": "https://www.datocms-assets.com/205/1525789775-dato.png?h=152&w=152"
|
|
238
|
+
},
|
|
239
|
+
"content": null,
|
|
240
|
+
"tag": "link"
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
"attributes": {
|
|
244
|
+
"sizes": "180x180",
|
|
245
|
+
"rel": "apple-touch-icon",
|
|
246
|
+
"href": "https://www.datocms-assets.com/205/1525789775-dato.png?h=180&w=180"
|
|
247
|
+
},
|
|
248
|
+
"content": null,
|
|
249
|
+
"tag": "link"
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
"attributes": {
|
|
253
|
+
"name": "msapplication-square70x70logo",
|
|
254
|
+
"content": "https://www.datocms-assets.com/205/1525789775-dato.png?h=70&w=70"
|
|
255
|
+
},
|
|
256
|
+
"content": null,
|
|
257
|
+
"tag": "meta"
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"attributes": {
|
|
261
|
+
"name": "msapplication-square150x150logo",
|
|
262
|
+
"content": "https://www.datocms-assets.com/205/1525789775-dato.png?h=150&w=150"
|
|
263
|
+
},
|
|
264
|
+
"content": null,
|
|
265
|
+
"tag": "meta"
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
"attributes": {
|
|
269
|
+
"name": "msapplication-square310x310logo",
|
|
270
|
+
"content": "https://www.datocms-assets.com/205/1525789775-dato.png?h=310&w=310"
|
|
271
|
+
},
|
|
272
|
+
"content": null,
|
|
273
|
+
"tag": "meta"
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
"attributes": {
|
|
277
|
+
"name": "msapplication-square310x150logo",
|
|
278
|
+
"content": "https://www.datocms-assets.com/205/1525789775-dato.png?h=150&w=310"
|
|
279
|
+
},
|
|
280
|
+
"content": null,
|
|
281
|
+
"tag": "meta"
|
|
45
282
|
}
|
|
46
283
|
];
|
|
47
284
|
describe("renderMetaTags", function () {
|
|
@@ -52,14 +289,12 @@ describe("renderMetaTags", function () {
|
|
|
52
289
|
});
|
|
53
290
|
describe("renderMetaTagsToString", function () {
|
|
54
291
|
it("generates an array of meta tags", function () {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
'<link sizes="32x32" type="image/png" rel="icon" href="https://example.org/favicon.png?h=32&w=32" />'
|
|
62
|
-
].join("\n"));
|
|
292
|
+
expect(renderMetaTagsToString(metaTags)).toMatchSnapshot();
|
|
293
|
+
});
|
|
294
|
+
});
|
|
295
|
+
describe("toRemixMeta", function () {
|
|
296
|
+
it("generates a meta descriptor", function () {
|
|
297
|
+
expect(toRemixMeta(metaTags)).toMatchSnapshot();
|
|
63
298
|
});
|
|
64
299
|
});
|
|
65
300
|
//# sourceMappingURL=index.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../../src/Seo/__tests__/index.test.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,sBAAsB,
|
|
1
|
+
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../../src/Seo/__tests__/index.test.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,WAAW,EAAmB,MAAM,IAAI,CAAC;AAE1F,IAAM,QAAQ,GAAsB;IAClC;QACE,SAAS,EAAE,0DAA0D;QACrE,YAAY,EAAE,IAAI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AAiC,EAAE;QACpC,MAAM,CAAC,sBAAsB,CAAC,QAAQ,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC;IAC7D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,aAAa,EAAE;IACtB,EAAE,CAAC,6BAA6B,EAAE;QAChC,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC;IAClD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/esm/Seo/index.d.ts
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
/** the inner content of the meta tag */
|
|
6
|
-
content: string | null;
|
|
7
|
-
/** the HTML attributes to attach to the meta tag */
|
|
8
|
-
attributes: Record<string, string> | null;
|
|
9
|
-
};
|
|
10
|
-
export declare type ToMetaTagsType = SeoMetaTagType[];
|
|
11
|
-
export declare const renderMetaTags: (data: SeoMetaTagType[]) => JSX.Element[];
|
|
12
|
-
export declare const renderMetaTagsToString: (data: SeoMetaTagType[]) => string;
|
|
1
|
+
export * from './types';
|
|
2
|
+
export * from './remixUtils';
|
|
3
|
+
export * from './renderMetaTags';
|
|
4
|
+
export * from './renderMetaTagsToString';
|
package/dist/esm/Seo/index.js
CHANGED
|
@@ -1,56 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import React from "react";
|
|
13
|
-
export var renderMetaTags = function (data) {
|
|
14
|
-
return data.map(function (_a) {
|
|
15
|
-
var tag = _a.tag, attributes = _a.attributes, content = _a.content;
|
|
16
|
-
var key = [tag];
|
|
17
|
-
if (attributes && "property" in attributes) {
|
|
18
|
-
key.push(attributes.property);
|
|
19
|
-
}
|
|
20
|
-
if (attributes && "name" in attributes) {
|
|
21
|
-
key.push(attributes.name);
|
|
22
|
-
}
|
|
23
|
-
if (attributes && "rel" in attributes) {
|
|
24
|
-
key.push(attributes.rel);
|
|
25
|
-
}
|
|
26
|
-
if (attributes && "sizes" in attributes) {
|
|
27
|
-
key.push(attributes.sizes);
|
|
28
|
-
}
|
|
29
|
-
var Tag = tag;
|
|
30
|
-
return (React.createElement(Tag, __assign({ key: key.join("-") }, attributes), content));
|
|
31
|
-
});
|
|
32
|
-
};
|
|
33
|
-
var serializeAttributes = function (attributes) {
|
|
34
|
-
if (!attributes) {
|
|
35
|
-
return "";
|
|
36
|
-
}
|
|
37
|
-
var serializedAttrs = [];
|
|
38
|
-
for (var key in attributes) {
|
|
39
|
-
if (Object.prototype.hasOwnProperty.call(attributes, key)) {
|
|
40
|
-
serializedAttrs.push(key + "=\"" + attributes[key] + "\"");
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return " " + serializedAttrs.join(" ");
|
|
44
|
-
};
|
|
45
|
-
export var renderMetaTagsToString = function (data) {
|
|
46
|
-
return data
|
|
47
|
-
.map(function (_a) {
|
|
48
|
-
var tag = _a.tag, attributes = _a.attributes, content = _a.content;
|
|
49
|
-
if (content) {
|
|
50
|
-
return "<" + tag + serializeAttributes(attributes) + ">" + content + "</" + tag + ">";
|
|
51
|
-
}
|
|
52
|
-
return "<" + tag + serializeAttributes(attributes) + " />";
|
|
53
|
-
})
|
|
54
|
-
.join("\n");
|
|
55
|
-
};
|
|
1
|
+
export * from './types';
|
|
2
|
+
export * from './remixUtils';
|
|
3
|
+
export * from './renderMetaTags';
|
|
4
|
+
export * from './renderMetaTagsToString';
|
|
56
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Seo/index.
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Seo/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC"}
|