@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 CHANGED
@@ -1,4 +1,4 @@
1
- # mjh-framework v. 1.0.1001
1
+ # mjh-framework v. 1.0.1002
2
2
 
3
3
  [![NPM](https://img.shields.io/npm/v/mjh-framework.svg)](https://www.npmjs.com/package/mjh-framework) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
4
4
 
@@ -39,63 +39,65 @@ function toPlainText() {
39
39
  }
40
40
 
41
41
  function generateSchema(props) {
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;
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
- 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;
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
- 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;
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
- return React__default["default"].createElement('script', { type: 'application/ld+json', dangerouslySetInnerHTML: { __html: stringify._JSON$stringify(generateSchema(props)) } });
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;
@@ -33,63 +33,65 @@ function toPlainText() {
33
33
  }
34
34
 
35
35
  function generateSchema(props) {
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;
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
- 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;
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
- 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;
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
- return React__default.createElement('script', { type: 'application/ld+json', dangerouslySetInnerHTML: { __html: _JSON$stringify(generateSchema(props)) } });
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mjhls/mjh-framework",
3
- "version": "1.0.1001",
3
+ "version": "1.0.1002",
4
4
  "description": "Foundation Framework",
5
5
  "author": "mjh-framework",
6
6
  "license": "MIT",