@mjhls/mjh-framework 1.0.1001 → 1.0.1002
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 +1 -1
- package/dist/cjs/Schema.js +54 -52
- package/dist/esm/Schema.js +54 -52
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# mjh-framework v. 1.0.
|
|
1
|
+
# mjh-framework v. 1.0.1002
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/mjh-framework) [](https://standardjs.com)
|
|
4
4
|
|
package/dist/cjs/Schema.js
CHANGED
|
@@ -39,63 +39,65 @@ function toPlainText() {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
function generateSchema(props) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
42
|
+
var _props$article = props.article,
|
|
43
|
+
title = _props$article.title,
|
|
44
|
+
body = _props$article.body,
|
|
45
|
+
summary = _props$article.summary,
|
|
46
|
+
url = _props$article.url,
|
|
47
|
+
content_placement = _props$article.content_placement,
|
|
48
|
+
authorDetails = _props$article.authorDetails,
|
|
49
|
+
thumbnail = _props$article.thumbnail,
|
|
50
|
+
published = _props$article.published,
|
|
51
|
+
_updatedAt = _props$article._updatedAt,
|
|
52
|
+
seoTag = _props$article.seoTag,
|
|
53
|
+
_props$Website = props.Website,
|
|
54
|
+
liveDomain = _props$Website.liveDomain,
|
|
55
|
+
websiteTitle = _props$Website.title,
|
|
56
|
+
logo = _props$Website.logo,
|
|
57
|
+
client = props.client;
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
59
|
+
var authors = authorDetails && authorDetails.length > 0 && authorDetails.reduce(function (result, author) {
|
|
60
|
+
if (author.displayName) return [].concat(toConsumableArray._toConsumableArray(result), [{
|
|
61
|
+
'@type': 'Person',
|
|
62
|
+
name: author.displayName
|
|
63
|
+
}]);else return result;
|
|
64
|
+
}, []);
|
|
65
|
+
var articleSection = content_placement && content_placement.map(function (cp) {
|
|
66
|
+
return cp.name;
|
|
67
|
+
});
|
|
68
|
+
var image = thumbnail && thumbnail.asset && client ? urlFor({ source: thumbnail, client: client }) : liveDomain && logo && 'https://' + liveDomain + logo;
|
|
69
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
|
-
|
|
70
|
+
if (title && published && _updatedAt) {
|
|
71
|
+
return _extends._extends({
|
|
72
|
+
'@context': 'https://schema.org',
|
|
73
|
+
'@type': 'NewsArticle',
|
|
74
|
+
headline: title,
|
|
75
|
+
datePublished: published,
|
|
76
|
+
dateModified: _updatedAt,
|
|
77
|
+
inLanguage: 'en-US'
|
|
78
|
+
}, image && { image: image }, liveDomain && url && url.current && {
|
|
79
|
+
mainEntityOfPage: {
|
|
80
|
+
'@type': 'WebPage',
|
|
81
|
+
'@id': 'https://' + liveDomain + '/view/' + url.current
|
|
82
|
+
}
|
|
83
|
+
}, websiteTitle && liveDomain && logo && {
|
|
84
|
+
publisher: {
|
|
85
|
+
'@type': 'Organization',
|
|
86
|
+
name: websiteTitle,
|
|
87
|
+
logo: {
|
|
88
|
+
'@type': 'ImageObject',
|
|
89
|
+
url: 'https://' + liveDomain + logo
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}, articleSection && { articleSection: articleSection }, seoTag && seoTag.length > 0 && { keywords: seoTag.join() }, body && body.length > 0 && { articleBody: toPlainText(body) }, summary && { description: summary }, authors && authors.length > 0 && { author: authors });
|
|
93
|
+
}
|
|
94
|
+
return null;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
var Schema = function Schema(props) {
|
|
98
|
-
|
|
98
|
+
return generateSchema(props) !== null && React__default["default"].createElement('script', { type: 'application/ld+json',
|
|
99
|
+
dangerouslySetInnerHTML: { __html: stringify._JSON$stringify(generateSchema(props)) }
|
|
100
|
+
});
|
|
99
101
|
};
|
|
100
102
|
|
|
101
103
|
module.exports = Schema;
|
package/dist/esm/Schema.js
CHANGED
|
@@ -33,63 +33,65 @@ function toPlainText() {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
function generateSchema(props) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
36
|
+
var _props$article = props.article,
|
|
37
|
+
title = _props$article.title,
|
|
38
|
+
body = _props$article.body,
|
|
39
|
+
summary = _props$article.summary,
|
|
40
|
+
url = _props$article.url,
|
|
41
|
+
content_placement = _props$article.content_placement,
|
|
42
|
+
authorDetails = _props$article.authorDetails,
|
|
43
|
+
thumbnail = _props$article.thumbnail,
|
|
44
|
+
published = _props$article.published,
|
|
45
|
+
_updatedAt = _props$article._updatedAt,
|
|
46
|
+
seoTag = _props$article.seoTag,
|
|
47
|
+
_props$Website = props.Website,
|
|
48
|
+
liveDomain = _props$Website.liveDomain,
|
|
49
|
+
websiteTitle = _props$Website.title,
|
|
50
|
+
logo = _props$Website.logo,
|
|
51
|
+
client = props.client;
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
53
|
+
var authors = authorDetails && authorDetails.length > 0 && authorDetails.reduce(function (result, author) {
|
|
54
|
+
if (author.displayName) return [].concat(_toConsumableArray(result), [{
|
|
55
|
+
'@type': 'Person',
|
|
56
|
+
name: author.displayName
|
|
57
|
+
}]);else return result;
|
|
58
|
+
}, []);
|
|
59
|
+
var articleSection = content_placement && content_placement.map(function (cp) {
|
|
60
|
+
return cp.name;
|
|
61
|
+
});
|
|
62
|
+
var image = thumbnail && thumbnail.asset && client ? urlFor({ source: thumbnail, client: client }) : liveDomain && logo && 'https://' + liveDomain + logo;
|
|
63
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
|
-
|
|
64
|
+
if (title && published && _updatedAt) {
|
|
65
|
+
return _extends({
|
|
66
|
+
'@context': 'https://schema.org',
|
|
67
|
+
'@type': 'NewsArticle',
|
|
68
|
+
headline: title,
|
|
69
|
+
datePublished: published,
|
|
70
|
+
dateModified: _updatedAt,
|
|
71
|
+
inLanguage: 'en-US'
|
|
72
|
+
}, image && { image: image }, liveDomain && url && url.current && {
|
|
73
|
+
mainEntityOfPage: {
|
|
74
|
+
'@type': 'WebPage',
|
|
75
|
+
'@id': 'https://' + liveDomain + '/view/' + url.current
|
|
76
|
+
}
|
|
77
|
+
}, websiteTitle && liveDomain && logo && {
|
|
78
|
+
publisher: {
|
|
79
|
+
'@type': 'Organization',
|
|
80
|
+
name: websiteTitle,
|
|
81
|
+
logo: {
|
|
82
|
+
'@type': 'ImageObject',
|
|
83
|
+
url: 'https://' + liveDomain + logo
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}, articleSection && { articleSection: articleSection }, seoTag && seoTag.length > 0 && { keywords: seoTag.join() }, body && body.length > 0 && { articleBody: toPlainText(body) }, summary && { description: summary }, authors && authors.length > 0 && { author: authors });
|
|
87
|
+
}
|
|
88
|
+
return null;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
var Schema = function Schema(props) {
|
|
92
|
-
|
|
92
|
+
return generateSchema(props) !== null && React__default.createElement('script', { type: 'application/ld+json',
|
|
93
|
+
dangerouslySetInnerHTML: { __html: _JSON$stringify(generateSchema(props)) }
|
|
94
|
+
});
|
|
93
95
|
};
|
|
94
96
|
|
|
95
97
|
export { Schema as default };
|