@ndlib/component-library 0.0.103 → 0.0.105
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/components/composites/Seo/SeoDataDisplay/index.js +1 -1
- package/dist/components/composites/Seo/index.js +1 -1
- package/dist/components/composites/StructuredData/StructuredData.test.js +0 -1
- package/dist/components/composites/StructuredData/StructuredDataDisplay/index.js +5 -1
- package/dist/components/composites/StructuredData/index.d.ts +8 -1
- package/dist/components/composites/StructuredData/index.js +4 -4
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import ReactDOMServer from 'react-dom/server';
|
|
|
3
3
|
import pretty from 'pretty';
|
|
4
4
|
import { Seo } from '../index';
|
|
5
5
|
export const SeoDataDisplay = () => {
|
|
6
|
-
const seoHtml = ReactDOMServer.renderToString(_jsx(Seo, {}));
|
|
6
|
+
const seoHtml = ReactDOMServer.renderToString(_jsx(Seo, { pathname: 'https://www.nd.edu/test' }));
|
|
7
7
|
return (_jsx("code", { children: _jsx("pre", { children: pretty(seoHtml) }) }));
|
|
8
8
|
};
|
|
9
9
|
export default SeoDataDisplay;
|
|
@@ -6,7 +6,7 @@ export const Seo = ({ title, description, image, nofollow, noindex, pathname, })
|
|
|
6
6
|
title: title || defaultTitle,
|
|
7
7
|
description: description || defaultDescription,
|
|
8
8
|
image: image ? image : defaultImage,
|
|
9
|
-
url:
|
|
9
|
+
url: pathname || siteUrl || '',
|
|
10
10
|
nofollow: nofollow || defaultNofollow,
|
|
11
11
|
noindex: noindex || defaultNoindex,
|
|
12
12
|
twitterUsername,
|
|
@@ -4,7 +4,6 @@ describe('getStructuredDataSchemas', () => {
|
|
|
4
4
|
const schemas = getStructuredDataSchemas({});
|
|
5
5
|
expect(schemas[0]).toContain('Hesburgh Component Library');
|
|
6
6
|
expect(schemas).toHaveLength(1);
|
|
7
|
-
console.log(schemas);
|
|
8
7
|
});
|
|
9
8
|
it('should generate structured data schemas with custom data', () => {
|
|
10
9
|
const customData = {
|
|
@@ -31,7 +31,11 @@ export const StructuredDataDisplay = () => {
|
|
|
31
31
|
publishedDate: '2023-04-30T04:00:00.000Z',
|
|
32
32
|
},
|
|
33
33
|
];
|
|
34
|
-
const schemas = getStructuredDataSchemas({
|
|
34
|
+
const schemas = getStructuredDataSchemas({
|
|
35
|
+
events: events,
|
|
36
|
+
news: news,
|
|
37
|
+
pathname: 'https://www.nd.edu/test',
|
|
38
|
+
});
|
|
35
39
|
return (_jsx(_Fragment, { children: schemas.map((schema, index) => (_jsxs("pre", { children: [_jsx("code", { children: schema }), _jsx("br", {})] }, index))) }));
|
|
36
40
|
};
|
|
37
41
|
export default StructuredDataDisplay;
|
|
@@ -24,9 +24,16 @@ export type StructuredDataProps = {
|
|
|
24
24
|
};
|
|
25
25
|
}[];
|
|
26
26
|
news?: {
|
|
27
|
+
shortDescription: any;
|
|
27
28
|
title: string;
|
|
28
29
|
author: string;
|
|
29
|
-
|
|
30
|
+
abstract?: {
|
|
31
|
+
shortDescription?: {
|
|
32
|
+
data?: {
|
|
33
|
+
shortDescription: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
};
|
|
30
37
|
image?: {
|
|
31
38
|
url: string;
|
|
32
39
|
};
|
|
@@ -11,7 +11,7 @@ export const getStructuredDataSchemas = ({ title, pathname, description, nofollo
|
|
|
11
11
|
nofollow: nofollow || defaultNofollow,
|
|
12
12
|
noindex: noindex || defaultNoindex,
|
|
13
13
|
image: image || defaultImage,
|
|
14
|
-
url:
|
|
14
|
+
url: pathname || siteUrl || '',
|
|
15
15
|
lang: 'en',
|
|
16
16
|
events: events,
|
|
17
17
|
news: news,
|
|
@@ -39,12 +39,12 @@ export const getStructuredDataSchemas = ({ title, pathname, description, nofollo
|
|
|
39
39
|
}));
|
|
40
40
|
});
|
|
41
41
|
news === null || news === void 0 ? void 0 : news.map((article) => {
|
|
42
|
-
var _a;
|
|
42
|
+
var _a, _b, _c;
|
|
43
43
|
schemas.push(stringifyNewsSchema({
|
|
44
44
|
title: article === null || article === void 0 ? void 0 : article.title,
|
|
45
|
-
abstract: article === null || article === void 0 ? void 0 : article.shortDescription,
|
|
45
|
+
abstract: (_b = (_a = article === null || article === void 0 ? void 0 : article.shortDescription) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.shortDescription,
|
|
46
46
|
author: article === null || article === void 0 ? void 0 : article.author,
|
|
47
|
-
image: (
|
|
47
|
+
image: (_c = article === null || article === void 0 ? void 0 : article.image) === null || _c === void 0 ? void 0 : _c.url,
|
|
48
48
|
url: article === null || article === void 0 ? void 0 : article.slug,
|
|
49
49
|
publishedDate: article === null || article === void 0 ? void 0 : article.publishedDate,
|
|
50
50
|
siteUrl: siteUrl,
|