gatsby-core-theme 12.0.0 → 12.0.2
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/CHANGELOG.md +31 -0
- package/gatsby-node.esm.js +19 -4
- package/package.json +1 -1
- package/src/components/organisms/head/index.js +3 -2
- package/src/constants/pick-keys.js +1 -1
- package/src/helpers/schema.js +376 -188
- package/src/helpers/schema.test.js +151 -358
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,34 @@
|
|
|
1
|
+
## [12.0.2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v12.0.1...v12.0.2) (2022-10-05)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add transaltions ([b1917f4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b1917f404ce311b472caa064cbac09f7f60e28a7))
|
|
7
|
+
* add translation key for description ([56b7c73](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/56b7c732249f3903beeadd48fea696f9935f6914))
|
|
8
|
+
* generate meta title ([afb477d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/afb477de9d0be11dcc971a0c8cd1732f2af03b68))
|
|
9
|
+
* new schema bible ([1ad952a](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/1ad952a8149604a5402191e4c1a53d683d3ae46e))
|
|
10
|
+
* update jest test ([82b8d88](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/82b8d8868f21c1a8dd689a7bce6e88c82607cf3a))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
* Merge branch 'tm-3058-meta-title' into 'master' ([81f56d7](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/81f56d7fe0e45c5e0ce925908e9db93b0935e17b))
|
|
14
|
+
* Merge branch 'tm-2833-schema-bible-core' into 'master' ([8e3563e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/8e3563e8a678f2136265f6dea55a3bf28725e5eb))
|
|
15
|
+
|
|
16
|
+
## [12.0.1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v12.0.0...v12.0.1) (2022-09-29)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* add rating fro payment method ([0382efa](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0382efa08b331f535fa7a3298edc35d7528ef708))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Code Refactoring
|
|
25
|
+
|
|
26
|
+
* add react helmet to head component ([7d8526f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/7d8526ff335f52cdbb6b9a9e2120928b939236d9))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
* Merge branch 'tm-3004-cards-v2' into 'master' ([8ea7d31](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/8ea7d313e7ae1ca788094c43cc5ebd86075d58e1))
|
|
30
|
+
* Merge branch 'tm-3026-add-react-helmet' into 'master' ([0375240](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0375240e870658cb5029359f10cae6c2ac66bd0a))
|
|
31
|
+
|
|
1
32
|
# [12.0.0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v11.0.9...v12.0.0) (2022-09-28)
|
|
2
33
|
|
|
3
34
|
|
package/gatsby-node.esm.js
CHANGED
|
@@ -9,6 +9,7 @@ import { getData, getLocalData } from './src/helpers/api';
|
|
|
9
9
|
import { generateTrackerLink } from './src/helpers/generators';
|
|
10
10
|
import processor, { processSitemapPages } from './src/helpers/processor';
|
|
11
11
|
import { pickAuthorsPageKeys } from './src/constants/pick-keys';
|
|
12
|
+
import { translate } from './src/helpers/getters';
|
|
12
13
|
|
|
13
14
|
const fs = require('fs');
|
|
14
15
|
|
|
@@ -69,10 +70,24 @@ function createArchivePage(pageObject, marketSections, prefilledModules, createP
|
|
|
69
70
|
archive.rootPath =
|
|
70
71
|
pageObject.path.charAt(0) !== '/' ? `/${pageObject.path}` : pageObject.path;
|
|
71
72
|
archive.items = value.map((item) => processor.clonePage(item));
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
switch (archive.currentPage) {
|
|
74
|
+
case 1:
|
|
75
|
+
page.path = pageObject.path;
|
|
76
|
+
break;
|
|
77
|
+
default:
|
|
78
|
+
page.path = `${pageObject.path}/page/${archive.currentPage}`;
|
|
79
|
+
page.meta_title += translate(
|
|
80
|
+
translations,
|
|
81
|
+
'archive_title_suffix',
|
|
82
|
+
'- Page [number]'
|
|
83
|
+
).replace('[number]', archive.currentPage);
|
|
84
|
+
page.meta_description += translate(
|
|
85
|
+
translations,
|
|
86
|
+
'archive_description_suffix',
|
|
87
|
+
'- Page [number]'
|
|
88
|
+
).replace('[number]', archive.currentPage);
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
76
91
|
page.sections.main.modules[archiveModuleIndex] = archive;
|
|
77
92
|
|
|
78
93
|
createPage({
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
import { Helmet } from 'react-helmet';
|
|
3
4
|
|
|
4
5
|
import { schemaGenerator } from '~helpers/schema';
|
|
5
6
|
import { getUrl, getPageImage, imagePrettyUrl } from '~helpers/getters';
|
|
@@ -40,7 +41,7 @@ const Head = ({ page = {}, siteInfo }) => {
|
|
|
40
41
|
const pageImage = getPageImage(page) ? getPageImage(page) : imagePrettyUrl(siteInfo?.site_logo);
|
|
41
42
|
// When google re-indexes dev NSA and IRL, remove lines 28, 41, 42, 43 and process.env.GATSBY_ACTIVE_ENV !== 'development' from lines 24, 25, 27, 29, 43
|
|
42
43
|
return (
|
|
43
|
-
|
|
44
|
+
<Helmet>
|
|
44
45
|
<title>{page.meta_title}</title>
|
|
45
46
|
<html lang={getLanguage(page.language)} />
|
|
46
47
|
<meta name="description" content={page.meta_description} />
|
|
@@ -75,7 +76,7 @@ const Head = ({ page = {}, siteInfo }) => {
|
|
|
75
76
|
</script>
|
|
76
77
|
)
|
|
77
78
|
)}
|
|
78
|
-
|
|
79
|
+
</Helmet>
|
|
79
80
|
);
|
|
80
81
|
};
|
|
81
82
|
|
|
@@ -67,7 +67,7 @@ export const pickRelationKeys = {
|
|
|
67
67
|
'thumbnail_filename_object',
|
|
68
68
|
],
|
|
69
69
|
software_provider: ['logo_object', 'logo', 'games_count', 'name'],
|
|
70
|
-
payment_method: ['logo_object', 'logo', 'name'],
|
|
70
|
+
payment_method: ['logo_object', 'logo', 'name', 'rating'],
|
|
71
71
|
};
|
|
72
72
|
|
|
73
73
|
export const pickHTMLSitemapPageKeys = ['title', 'path', 'template_id'];
|
package/src/helpers/schema.js
CHANGED
|
@@ -1,27 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getUrl, getLanguage, imagePrettyUrl } from './getters';
|
|
2
2
|
import { cleanHTML } from './strings';
|
|
3
3
|
|
|
4
|
-
/* HardCoded Start */
|
|
5
|
-
const customSchema = {
|
|
6
|
-
// Matrix
|
|
7
|
-
'playcasino.co.za': 'Playcasino',
|
|
8
|
-
'norskespilleautomater.com': 'Norske Spilleautomater',
|
|
9
|
-
'irishluck.ie': 'Irish Luck',
|
|
10
|
-
// Rage PPC
|
|
11
|
-
'bekijksport.nl': 'Bekijk Sport',
|
|
12
|
-
'bestsports.gr': 'Best Sports',
|
|
13
|
-
'sesport.dk': 'Se Sport',
|
|
14
|
-
'watchfooty.co.uk': 'WatchFooty',
|
|
15
|
-
// Rage SEO
|
|
16
|
-
'fotballstreams.com': 'Fotball Streams',
|
|
17
|
-
'fussballstreams.com': 'Fussball Streams',
|
|
18
|
-
'livefotbollonline.se': 'Live Fotboll Online',
|
|
19
|
-
'livestreamsvoetbal.nl': 'Live Streams Voetbal',
|
|
20
|
-
'sefodbold.dk': 'Se Fodbold',
|
|
21
|
-
'verfutbolonline.net': 'Ver Futbol Online',
|
|
22
|
-
'watchsport.gr': 'Watch Sport',
|
|
23
|
-
};
|
|
24
|
-
|
|
25
4
|
const socialLinks = [
|
|
26
5
|
'facebook',
|
|
27
6
|
'instagram',
|
|
@@ -31,6 +10,13 @@ const socialLinks = [
|
|
|
31
10
|
'wikipedia',
|
|
32
11
|
'youtube',
|
|
33
12
|
];
|
|
13
|
+
|
|
14
|
+
const socialAuthorLinks = [
|
|
15
|
+
'facebook_profile',
|
|
16
|
+
'twitter_profile',
|
|
17
|
+
'instagram_profile',
|
|
18
|
+
'linkedin_profile',
|
|
19
|
+
];
|
|
34
20
|
/* HardCoded End */
|
|
35
21
|
|
|
36
22
|
function checkSchemaProp(prop) {
|
|
@@ -42,6 +28,106 @@ function checkSchemaProp(prop) {
|
|
|
42
28
|
);
|
|
43
29
|
}
|
|
44
30
|
|
|
31
|
+
const authorObj = (page) => ({
|
|
32
|
+
'@type': 'Person',
|
|
33
|
+
name: page?.author?.name || '',
|
|
34
|
+
url: getUrl(page?.author?.profile_page_path),
|
|
35
|
+
image: page?.author?.image ? imagePrettyUrl(page?.author?.image) : '',
|
|
36
|
+
sameAs: socialAuthorLinks
|
|
37
|
+
.map((socialLink) => page?.author?.[socialLink])
|
|
38
|
+
.filter((socialLink) => socialLink),
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const webSiteAndWebPageAuthor = (page) => ({
|
|
42
|
+
'@type': 'Organization',
|
|
43
|
+
name: page?.siteSchema?.site_name,
|
|
44
|
+
alternateName: page?.siteSchema?.alias_site_name,
|
|
45
|
+
sameAs: socialLinks
|
|
46
|
+
.map((socialLink) => page.siteSchema?.[socialLink])
|
|
47
|
+
.filter((socialLink) => socialLink),
|
|
48
|
+
parentOrganization: {
|
|
49
|
+
'@type': 'Organization',
|
|
50
|
+
logo: {
|
|
51
|
+
'@type': 'imageObject',
|
|
52
|
+
url: 'https://www.gig.com/wp-content/themes/gig.com-child/assets/images/logo.svg',
|
|
53
|
+
},
|
|
54
|
+
name: 'Gaming Innovation Group',
|
|
55
|
+
alternateName: 'GIG',
|
|
56
|
+
address: {
|
|
57
|
+
'@type': 'PostalAddress',
|
|
58
|
+
streetAddress: '@GiG Beach, Triq Id-Dragunara',
|
|
59
|
+
addressLocality: "Saint Julian's",
|
|
60
|
+
postalCode: 'STJ 3148',
|
|
61
|
+
addressCountry: 'Malta',
|
|
62
|
+
},
|
|
63
|
+
knowsAbout: {
|
|
64
|
+
'@type': 'Thing',
|
|
65
|
+
name: 'IGaming Business',
|
|
66
|
+
sameAs: [
|
|
67
|
+
'https://en.wikipedia.org/wiki/IGaming_Business',
|
|
68
|
+
'https://www.google.com/search?q=igaming+business',
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
sameAs: [
|
|
72
|
+
'https://www.facebook.com/GamingInnovationGroup/',
|
|
73
|
+
'https://twitter.com/GIG_online/',
|
|
74
|
+
'https://www.linkedin.com/company/gig-gaming-innovation-group/',
|
|
75
|
+
'https://www.instagram.com/gig_online/',
|
|
76
|
+
'https://en.wikipedia.org/wiki/Gaming_Innovation_Group',
|
|
77
|
+
'https://medium.com/@Gaminginnovationgroup',
|
|
78
|
+
'https://www.gig.com',
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
contactPoint: page?.authors?.map((author) => ({
|
|
82
|
+
'@type': 'ContactPoint',
|
|
83
|
+
email: author?.email_address || '',
|
|
84
|
+
contactType: 'author',
|
|
85
|
+
url: getUrl(author?.profile_page_path),
|
|
86
|
+
})),
|
|
87
|
+
logo: {
|
|
88
|
+
'@type': 'imageObject',
|
|
89
|
+
url:
|
|
90
|
+
(page.siteInfo?.site_logo && `${process.env.IMAGE_CDN_URL}/${page.siteInfo.site_logo}`) ||
|
|
91
|
+
page.featured_image_object?.url,
|
|
92
|
+
},
|
|
93
|
+
publishingPrinciples: page?.siteSchema?.publishing_principles,
|
|
94
|
+
foundingDate: page?.siteSchema?.organization_founding_date,
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
const about = (url) => ({
|
|
98
|
+
'@type': 'Thing',
|
|
99
|
+
name: 'game',
|
|
100
|
+
sameAs: url,
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
const prosAndConsData = (pageObj) => {
|
|
104
|
+
const prosAndConstObj =
|
|
105
|
+
pageObj?.sections?.main?.modules?.find((elm) => elm?.name === 'pros_and_cons') || {};
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
Object.keys(prosAndConstObj).length > 0 && {
|
|
109
|
+
positiveNotes: {
|
|
110
|
+
'@type': 'ItemList',
|
|
111
|
+
itemListElement:
|
|
112
|
+
prosAndConstObj?.pros?.map((elm, index) => ({
|
|
113
|
+
'@type': 'ListItem',
|
|
114
|
+
position: index + 1,
|
|
115
|
+
name: elm,
|
|
116
|
+
})) || [],
|
|
117
|
+
},
|
|
118
|
+
negativeNotes: {
|
|
119
|
+
'@type': 'ItemList',
|
|
120
|
+
itemListElement:
|
|
121
|
+
prosAndConstObj?.cons?.map((elm, index) => ({
|
|
122
|
+
'@type': 'ListItem',
|
|
123
|
+
position: index + 1,
|
|
124
|
+
name: elm,
|
|
125
|
+
})) || [],
|
|
126
|
+
},
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
};
|
|
130
|
+
|
|
45
131
|
export function generateSchemaObject(schema) {
|
|
46
132
|
return Object.keys(schema).reduce((obj, key) => {
|
|
47
133
|
if (
|
|
@@ -59,89 +145,50 @@ export function generateSchemaObject(schema) {
|
|
|
59
145
|
}, {});
|
|
60
146
|
}
|
|
61
147
|
|
|
62
|
-
|
|
148
|
+
// completed
|
|
149
|
+
export function breadcrumbsSchema({
|
|
150
|
+
path,
|
|
151
|
+
title,
|
|
152
|
+
breadcrumbs = [],
|
|
153
|
+
siteSchema: { site_name: siteName } = {},
|
|
154
|
+
}) {
|
|
63
155
|
const schema = {
|
|
64
156
|
'@context': 'https://schema.org',
|
|
65
157
|
'@type': 'BreadcrumbList',
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
'@id': `${getUrl(breadcrumb.path)}#webpage`,
|
|
73
|
-
},
|
|
74
|
-
})),
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
return JSON.stringify(generateSchemaObject(schema));
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export function webPageSchema(page, pageImage) {
|
|
81
|
-
const schema = {
|
|
82
|
-
'@context': 'https://schema.org',
|
|
83
|
-
'@type': 'WebPage',
|
|
84
|
-
'@id': `${getUrl(page.path)}#webpage`,
|
|
85
|
-
url: getUrl(page.path),
|
|
86
|
-
name: page.meta_title || '',
|
|
87
|
-
description: page.meta_description || '',
|
|
88
|
-
inLanguage: getLanguage(page.language),
|
|
89
|
-
datePublished: page.created_at,
|
|
90
|
-
dateModified: page.updated_at,
|
|
91
|
-
isPartOf: {
|
|
92
|
-
'@type': 'WebSite',
|
|
93
|
-
'@id': `${process.env.GATSBY_SITE_URL}#website`,
|
|
94
|
-
url: `${process.env.GATSBY_SITE_URL}`,
|
|
95
|
-
inLanguage: getLanguage(page.language),
|
|
96
|
-
},
|
|
97
|
-
author: {
|
|
98
|
-
'@type': 'Organization',
|
|
99
|
-
name: page.siteSchema?.site_name || '',
|
|
100
|
-
alternateName: page.siteSchema?.alias_site_name || '',
|
|
101
|
-
foundingDate: page.siteSchema?.organization_founding_date || '',
|
|
102
|
-
publishingPrinciples: page.siteSchema?.publishing_principles,
|
|
103
|
-
logo: {
|
|
104
|
-
'@type': 'ImageObject',
|
|
105
|
-
url: pageImage,
|
|
158
|
+
itemListElement: [
|
|
159
|
+
{
|
|
160
|
+
'@type': 'ListItem',
|
|
161
|
+
position: 1,
|
|
162
|
+
name: siteName,
|
|
163
|
+
item: getUrl('/'),
|
|
106
164
|
},
|
|
107
|
-
|
|
108
|
-
'@type': '
|
|
109
|
-
|
|
110
|
-
name:
|
|
111
|
-
|
|
112
|
-
url: getUrl(author.profile_page_path || '/'),
|
|
165
|
+
...breadcrumbs.map((breadcrumb, index) => ({
|
|
166
|
+
'@type': 'ListItem',
|
|
167
|
+
position: index + 2,
|
|
168
|
+
name: breadcrumb?.label,
|
|
169
|
+
item: getUrl(breadcrumb?.path),
|
|
113
170
|
})),
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
171
|
+
{
|
|
172
|
+
'@type': 'ListItem',
|
|
173
|
+
name: title,
|
|
174
|
+
position: breadcrumbs.length + 2,
|
|
175
|
+
item: getUrl(path),
|
|
176
|
+
},
|
|
177
|
+
],
|
|
119
178
|
};
|
|
120
179
|
|
|
121
|
-
if (pageImage) {
|
|
122
|
-
schema.primaryImageOfPage = {
|
|
123
|
-
'@type': 'ImageObject',
|
|
124
|
-
'@id': `${getUrl(page.path)}#primaryimage`,
|
|
125
|
-
url: pageImage,
|
|
126
|
-
inLanguage: getLanguage(page.language),
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if (page.seo_keywords) {
|
|
131
|
-
schema.keywords = page.seo_keywords;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
180
|
return JSON.stringify(generateSchemaObject(schema));
|
|
135
181
|
}
|
|
136
182
|
|
|
137
|
-
|
|
183
|
+
// completed
|
|
184
|
+
export function organizationSchema(page, pageImage, webSiteImage) {
|
|
138
185
|
const schema = {
|
|
139
186
|
'@context': 'https://schema.org',
|
|
140
187
|
'@type': 'Organization',
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
logo:
|
|
188
|
+
name: page?.siteSchema?.site_name || '',
|
|
189
|
+
alternateName: page?.siteSchema?.alias_site_name || '',
|
|
190
|
+
url: getUrl('/'),
|
|
191
|
+
logo: webSiteImage,
|
|
145
192
|
sameAs: socialLinks
|
|
146
193
|
.map((socialLink) => page.siteSchema?.[socialLink])
|
|
147
194
|
.filter((socialLink) => socialLink),
|
|
@@ -150,72 +197,29 @@ export function organizationSchema(page, pageImage) {
|
|
|
150
197
|
return JSON.stringify(generateSchemaObject(schema));
|
|
151
198
|
}
|
|
152
199
|
|
|
153
|
-
export function
|
|
154
|
-
const schema = modules.map((module, index) => {
|
|
155
|
-
switch (module.name) {
|
|
156
|
-
case 'faq': {
|
|
157
|
-
const moduleSchema = {
|
|
158
|
-
'@context': 'https://schema.org',
|
|
159
|
-
'@type': 'FAQPage',
|
|
160
|
-
'@id': `${getUrl(path)}#faqpage${index === 0 ? '' : index}`,
|
|
161
|
-
mainEntity: module.items?.map((item) => ({
|
|
162
|
-
'@type': 'Question',
|
|
163
|
-
acceptedAnswer: {
|
|
164
|
-
'@type': 'Answer',
|
|
165
|
-
text: cleanHTML(item.answer),
|
|
166
|
-
},
|
|
167
|
-
name: cleanHTML(item.question),
|
|
168
|
-
})),
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
return JSON.stringify(generateSchemaObject(moduleSchema));
|
|
172
|
-
}
|
|
173
|
-
default: {
|
|
174
|
-
return null;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
const filteredSchema = schema.filter((item) => item !== null);
|
|
180
|
-
|
|
181
|
-
return filteredSchema;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
export function templateSchemas(page, pageImage) {
|
|
185
|
-
const sharedProps = {
|
|
186
|
-
author: {
|
|
187
|
-
'@type': 'Person',
|
|
188
|
-
name: page.author?.name?.substring(0, 100),
|
|
189
|
-
url: getUrl(page.author?.profile_page_path || '/'),
|
|
190
|
-
},
|
|
191
|
-
publisher: {
|
|
192
|
-
'@type': 'Organization',
|
|
193
|
-
name:
|
|
194
|
-
page.siteSchema?.owned_by ||
|
|
195
|
-
customSchema[process.env.GATSBY_SITE_NAME] ||
|
|
196
|
-
page.siteInfo?.site_name ||
|
|
197
|
-
process.env.GATSBY_SITE_NAME,
|
|
198
|
-
logo:
|
|
199
|
-
(page.siteInfo?.site_logo && `${process.env.IMAGE_CDN_URL}/${page.siteInfo.site_logo}`) ||
|
|
200
|
-
page.featured_image_object?.url ||
|
|
201
|
-
pageImage,
|
|
202
|
-
},
|
|
203
|
-
};
|
|
200
|
+
export function templateSchemas(page, pageImage, webSiteImage) {
|
|
204
201
|
switch (page.type) {
|
|
205
202
|
case 'article': {
|
|
206
203
|
const schema = {
|
|
207
204
|
'@context': 'https://schema.org',
|
|
208
|
-
'@type': '
|
|
209
|
-
'@id': `${getUrl(page.path)}#article`,
|
|
210
|
-
url: getUrl(page.path),
|
|
211
|
-
headline: page.title,
|
|
212
|
-
datePublished: page.created_at,
|
|
213
|
-
dateModified: page.updated_at,
|
|
205
|
+
'@type': 'NewsArticle',
|
|
214
206
|
mainEntityOfPage: {
|
|
215
207
|
'@type': 'WebPage',
|
|
216
|
-
|
|
208
|
+
'@id': getUrl(page?.path),
|
|
209
|
+
},
|
|
210
|
+
headline: page?.title,
|
|
211
|
+
image: pageImage,
|
|
212
|
+
author: page?.author_id ? authorObj(page) : '',
|
|
213
|
+
publisher: {
|
|
214
|
+
'@type': 'Organization',
|
|
215
|
+
name: page?.siteSchema?.site_name,
|
|
216
|
+
logo: {
|
|
217
|
+
'@type': 'imageObject',
|
|
218
|
+
url: webSiteImage,
|
|
219
|
+
},
|
|
217
220
|
},
|
|
218
|
-
|
|
221
|
+
datePublished: page?.created_at?.split(' ')[0],
|
|
222
|
+
dateModified: page?.updated_at,
|
|
219
223
|
};
|
|
220
224
|
|
|
221
225
|
return JSON.stringify(generateSchemaObject(schema));
|
|
@@ -224,52 +228,65 @@ export function templateSchemas(page, pageImage) {
|
|
|
224
228
|
const schema = {
|
|
225
229
|
'@context': 'https://schema.org',
|
|
226
230
|
'@type': 'Review',
|
|
227
|
-
|
|
228
|
-
name: page.relation?.name || '',
|
|
229
|
-
reviewBody: page.extra_fields?.operator_summary || '',
|
|
231
|
+
...prosAndConsData(page),
|
|
230
232
|
itemReviewed: {
|
|
231
233
|
'@type': 'Organization',
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
image: page.relation?.logo_url_object?.url,
|
|
234
|
+
name: page?.title || '',
|
|
235
|
+
image: page?.relation?.logo_url_object?.url,
|
|
235
236
|
},
|
|
237
|
+
description: page?.meta_description,
|
|
236
238
|
reviewRating: {
|
|
237
239
|
'@type': 'Rating',
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
ratingValue: page
|
|
240
|
+
worstRating: Number('0'),
|
|
241
|
+
bestRating: Number('5'),
|
|
242
|
+
ratingValue: Number(page?.relation?.rating) || '',
|
|
243
|
+
},
|
|
244
|
+
author: {
|
|
245
|
+
'@type': 'Person',
|
|
246
|
+
name: page?.author?.name || '',
|
|
247
|
+
url: getUrl(page?.author?.profile_page_path),
|
|
248
|
+
image: imagePrettyUrl(page?.author?.image),
|
|
249
|
+
sameAs: socialAuthorLinks
|
|
250
|
+
.map((socialLink) => page?.author?.[socialLink])
|
|
251
|
+
.filter((socialLink) => socialLink),
|
|
252
|
+
jobTitle: 'igaming expert',
|
|
253
|
+
worksFor: {
|
|
254
|
+
'@type': 'Organization',
|
|
255
|
+
name: page?.siteSchema?.site_name,
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
publisher: {
|
|
259
|
+
'@type': 'Organization',
|
|
260
|
+
name: page?.siteSchema?.site_name,
|
|
261
|
+
url: getUrl('/'),
|
|
241
262
|
},
|
|
242
|
-
...sharedProps,
|
|
243
263
|
};
|
|
244
264
|
|
|
245
265
|
return JSON.stringify(generateSchemaObject(schema));
|
|
246
266
|
}
|
|
247
267
|
case 'game': {
|
|
248
|
-
const rating = Math.floor(getGameRating(page.relation) * 2);
|
|
268
|
+
// const rating = Math.floor(getGameRating(page.relation) * 2);
|
|
249
269
|
const schema = {
|
|
250
270
|
'@context': 'https://schema.org',
|
|
251
|
-
'@type': '
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
271
|
+
'@type': 'Review',
|
|
272
|
+
...prosAndConsData(page),
|
|
273
|
+
name: page?.relation?.name || '',
|
|
274
|
+
description: page?.meta_description,
|
|
275
|
+
about: [
|
|
276
|
+
about('https://en.wikipedia.org/wiki/Video_game'),
|
|
277
|
+
about('https://en.wikipedia.org/wiki/Slot_machine'),
|
|
278
|
+
about('https://www.wikidata.org/wiki/Q33972'),
|
|
279
|
+
],
|
|
280
|
+
itemReviewed: {
|
|
281
|
+
'@type': 'game',
|
|
282
|
+
name: page?.relation?.name || '',
|
|
262
283
|
},
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
worstRating: '0',
|
|
270
|
-
ratingValue: rating?.toString() || '',
|
|
271
|
-
},
|
|
272
|
-
...sharedProps,
|
|
284
|
+
author: page?.author_id ? authorObj(page) : '',
|
|
285
|
+
reviewRating: {
|
|
286
|
+
'@type': 'Rating',
|
|
287
|
+
worstRating: Number(0),
|
|
288
|
+
bestRating: Number(5),
|
|
289
|
+
ratingValue: Number(page?.relation?.rating) || '',
|
|
273
290
|
},
|
|
274
291
|
};
|
|
275
292
|
|
|
@@ -280,16 +297,187 @@ export function templateSchemas(page, pageImage) {
|
|
|
280
297
|
}
|
|
281
298
|
}
|
|
282
299
|
|
|
300
|
+
export function personSchema(page, webSiteImage) {
|
|
301
|
+
const schema = {
|
|
302
|
+
'@context': 'https://schema.org',
|
|
303
|
+
'@type': 'Person',
|
|
304
|
+
name: page?.author?.name || '',
|
|
305
|
+
image: page?.author?.image ? imagePrettyUrl(page?.author?.image) : '',
|
|
306
|
+
url: getUrl(page?.author?.profile_page_path),
|
|
307
|
+
jobTitle: 'author',
|
|
308
|
+
email: page?.author?.email_address,
|
|
309
|
+
description: page?.meta_description,
|
|
310
|
+
sameAs: socialAuthorLinks
|
|
311
|
+
.map((socialLink) => page?.author?.[socialLink])
|
|
312
|
+
.filter((socialLink) => socialLink),
|
|
313
|
+
knowsLanguage: getLanguage(page?.language),
|
|
314
|
+
nationality: {
|
|
315
|
+
'@type': 'Country',
|
|
316
|
+
name: page?.siteSchema?.address,
|
|
317
|
+
},
|
|
318
|
+
worksFor: {
|
|
319
|
+
'@type': 'Organization',
|
|
320
|
+
name: page?.siteSchema?.site_name,
|
|
321
|
+
logo: webSiteImage,
|
|
322
|
+
url: getUrl('/'),
|
|
323
|
+
sameAs: socialLinks
|
|
324
|
+
.map((socialLink) => page.siteSchema?.[socialLink])
|
|
325
|
+
.filter((socialLink) => socialLink),
|
|
326
|
+
},
|
|
327
|
+
knowsAbout: page?.siteSchema?.knows_about?.map((elm, index) => ({
|
|
328
|
+
'@type': index === 0 ? 'Country' : 'Thing',
|
|
329
|
+
name: elm?.name,
|
|
330
|
+
sameAs: elm?.links,
|
|
331
|
+
})),
|
|
332
|
+
};
|
|
333
|
+
return JSON.stringify(generateSchemaObject(schema));
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
export function webPageSchema(page, pageImage) {
|
|
337
|
+
const webPageschema = {
|
|
338
|
+
'@context': 'https://schema.org',
|
|
339
|
+
'@type': 'WebPage',
|
|
340
|
+
'@id': `${getUrl(page?.path)}#webpage`,
|
|
341
|
+
name: page?.meta_title || '',
|
|
342
|
+
description: page.meta_description || '',
|
|
343
|
+
datePublished: page?.created_at,
|
|
344
|
+
dateModified: page?.updated_at,
|
|
345
|
+
inLanguage: getLanguage(page.language),
|
|
346
|
+
author: page?.author_id ? authorObj(page) : '',
|
|
347
|
+
reviewedBy: page?.author_id ? authorObj(page) : '',
|
|
348
|
+
image: {
|
|
349
|
+
'@type': 'imageObject',
|
|
350
|
+
'@id': pageImage,
|
|
351
|
+
description: page?.meta_title,
|
|
352
|
+
},
|
|
353
|
+
publisher: {
|
|
354
|
+
'@type': 'Organization',
|
|
355
|
+
url: getUrl('/'),
|
|
356
|
+
name: page?.meta_title,
|
|
357
|
+
publisher: {
|
|
358
|
+
'@id': `${getUrl('/')}#organization`,
|
|
359
|
+
},
|
|
360
|
+
potentialAction: {
|
|
361
|
+
'@type': 'SearchAction',
|
|
362
|
+
target: `${typeof window !== 'undefined' ? window.location.href : ''}`,
|
|
363
|
+
query: 'required name=search_term_string',
|
|
364
|
+
},
|
|
365
|
+
author: webSiteAndWebPageAuthor(page),
|
|
366
|
+
about: page?.siteSchema?.knows_about?.map((elm, index) => ({
|
|
367
|
+
'@type': index === 0 ? 'Country' : 'Thing',
|
|
368
|
+
name: elm?.name,
|
|
369
|
+
sameAs: elm?.links,
|
|
370
|
+
})),
|
|
371
|
+
},
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
return JSON.stringify(generateSchemaObject(webPageschema));
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
export function webSiteSchema(page) {
|
|
378
|
+
const schema = {
|
|
379
|
+
'@context': 'https://schema.org',
|
|
380
|
+
'@type': 'WebSite',
|
|
381
|
+
url: getUrl('/'),
|
|
382
|
+
name: page?.meta_title,
|
|
383
|
+
publisher: {
|
|
384
|
+
'@id': `${getUrl('/')}#organization`,
|
|
385
|
+
},
|
|
386
|
+
inLanguage: getLanguage(page?.language),
|
|
387
|
+
potentialAction: {
|
|
388
|
+
'@type': 'SearchAction',
|
|
389
|
+
target: `${typeof window !== 'undefined' ? window.location.href : ''}`,
|
|
390
|
+
'query-input': 'required name=search_term_string',
|
|
391
|
+
},
|
|
392
|
+
author: webSiteAndWebPageAuthor(page),
|
|
393
|
+
about: page?.siteSchema?.knows_about?.map((elm, index) => ({
|
|
394
|
+
'@type': index === 0 ? 'Country' : 'Thing',
|
|
395
|
+
name: elm?.name,
|
|
396
|
+
sameAs: elm?.links,
|
|
397
|
+
})),
|
|
398
|
+
};
|
|
399
|
+
return JSON.stringify(generateSchemaObject(schema));
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
// export function videoObject(data = {}) {
|
|
403
|
+
// const videoItem = data?.items[0];
|
|
404
|
+
|
|
405
|
+
// const VideoSchema = {
|
|
406
|
+
// '@context': 'https://schema.org',
|
|
407
|
+
// '@type': 'VideoObject',
|
|
408
|
+
// name: videoItem?.snippet?.title || '',
|
|
409
|
+
// duration: videoItem?.contentDetails?.duration || '',
|
|
410
|
+
// uploadDate: videoItem?.snippet?.publishedAt || '',
|
|
411
|
+
// thumbnailUrl: videoItem?.snippet?.thumbnails?.default?.url || '',
|
|
412
|
+
// description: videoItem?.snippet?.description || '',
|
|
413
|
+
// contentUrl: `https://youtu.be/${videoItem?.id}`,
|
|
414
|
+
// embedUrl: `https://www.youtube.com/embed/${videoItem?.id}`,
|
|
415
|
+
// interactionStatistic: {
|
|
416
|
+
// '@type': 'InteractionCounter',
|
|
417
|
+
// interactionType: {
|
|
418
|
+
// '@type': 'WatchAction',
|
|
419
|
+
// },
|
|
420
|
+
// userInteractionCount: Number(videoItem?.statistics?.viewCount) || '',
|
|
421
|
+
// },
|
|
422
|
+
// };
|
|
423
|
+
|
|
424
|
+
// return JSON.stringify(generateSchemaObject(VideoSchema));
|
|
425
|
+
// }
|
|
426
|
+
|
|
427
|
+
export function moduleSchemas(modules) {
|
|
428
|
+
const schema = modules.map((module) => {
|
|
429
|
+
switch (module.name) {
|
|
430
|
+
case 'faq': {
|
|
431
|
+
const moduleSchema = {
|
|
432
|
+
'@context': 'https://schema.org',
|
|
433
|
+
'@type': 'FAQPage',
|
|
434
|
+
mainEntity: module.items?.map((item) => ({
|
|
435
|
+
'@type': 'Question',
|
|
436
|
+
acceptedAnswer: {
|
|
437
|
+
'@type': 'Answer',
|
|
438
|
+
text: cleanHTML(item.answer),
|
|
439
|
+
},
|
|
440
|
+
name: cleanHTML(item.question),
|
|
441
|
+
})),
|
|
442
|
+
};
|
|
443
|
+
|
|
444
|
+
return JSON.stringify(generateSchemaObject(moduleSchema));
|
|
445
|
+
}
|
|
446
|
+
default: {
|
|
447
|
+
return null;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
});
|
|
451
|
+
|
|
452
|
+
const filteredSchema = schema.filter((item) => item !== null);
|
|
453
|
+
|
|
454
|
+
return filteredSchema;
|
|
455
|
+
}
|
|
456
|
+
|
|
283
457
|
export function schemaGenerator(page = {}, pageImage) {
|
|
458
|
+
const webSiteImage =
|
|
459
|
+
(page.siteInfo?.site_logo && `${process.env.IMAGE_CDN_URL}/${page.siteInfo.site_logo}`) ||
|
|
460
|
+
page.featured_image_object?.url ||
|
|
461
|
+
pageImage;
|
|
462
|
+
|
|
463
|
+
const isHomepage = page.path === '/';
|
|
464
|
+
const hasOrganisationSchema = isHomepage || page.path === 'about-us';
|
|
465
|
+
const hasWebPageSchema =
|
|
466
|
+
page.type !== 'operator' && page.type !== 'game' && !hasOrganisationSchema && !page?.hasArchive;
|
|
467
|
+
const hasPerson = page?.author_id && !hasOrganisationSchema;
|
|
468
|
+
|
|
284
469
|
const jsonSchema = [
|
|
285
470
|
// Page Schema
|
|
286
471
|
page.seo_json_schema,
|
|
287
|
-
|
|
288
|
-
|
|
472
|
+
|
|
473
|
+
!isHomepage ? breadcrumbsSchema(page) : null,
|
|
474
|
+
hasWebPageSchema ? webPageSchema(page, pageImage, webSiteImage) : null,
|
|
475
|
+
hasOrganisationSchema ? organizationSchema(page, pageImage, webSiteImage) : null,
|
|
476
|
+
templateSchemas(page, pageImage, webSiteImage),
|
|
477
|
+
isHomepage ? webSiteSchema(page) : null,
|
|
478
|
+
hasPerson ? personSchema(page, webSiteImage) : null,
|
|
479
|
+
// page?.siteSchema?.video?.items?.length ? videoObject(page?.siteSchema?.video) : null,
|
|
289
480
|
// Modules Schemas
|
|
290
|
-
webPageSchema(page, pageImage),
|
|
291
|
-
organizationSchema(page, pageImage),
|
|
292
|
-
templateSchemas(page, pageImage),
|
|
293
481
|
...(page.sections?.main?.modules
|
|
294
482
|
? moduleSchemas(page.sections.main.modules, page.path)
|
|
295
483
|
: [null]),
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { getUrl } from './getters';
|
|
2
1
|
import * as Schema from './schema';
|
|
3
2
|
|
|
4
3
|
const parseCheckSchema = (schema) => {
|
|
@@ -8,389 +7,141 @@ const parseCheckSchema = (schema) => {
|
|
|
8
7
|
expect(json['@context']).toEqual('https://schema.org');
|
|
9
8
|
return json;
|
|
10
9
|
};
|
|
11
|
-
const pageImage = 'pageImage/pageImage.jpg';
|
|
12
10
|
|
|
13
11
|
describe('Schema Helper', () => {
|
|
14
12
|
test('breadcrumbsSchema()', () => {
|
|
15
|
-
const output = Schema.breadcrumbsSchema(
|
|
13
|
+
const output = Schema.breadcrumbsSchema({
|
|
14
|
+
path: 'some_path',
|
|
15
|
+
title: 'Some Title Review',
|
|
16
|
+
breadcrumbs: [
|
|
17
|
+
{ path: 'breadcrumbA', label: 'Breadcrumb A' },
|
|
18
|
+
{ path: 'breadcrumbB', label: 'Breadcrumb B' },
|
|
19
|
+
],
|
|
20
|
+
siteSchema: {
|
|
21
|
+
site_name: 'Site Name',
|
|
22
|
+
},
|
|
23
|
+
});
|
|
16
24
|
|
|
17
25
|
const json = parseCheckSchema(output);
|
|
18
|
-
expect(json['@type']).toEqual('BreadcrumbList');
|
|
19
26
|
|
|
27
|
+
expect(json['@type']).toEqual('BreadcrumbList');
|
|
20
28
|
expect(Object.prototype.toString.call(json.itemListElement)).toEqual('[object Array]');
|
|
21
|
-
expect(json.itemListElement).toHaveLength(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
expect(json.itemListElement).toHaveLength(4);
|
|
30
|
+
json.itemListElement.forEach((element, i) => {
|
|
31
|
+
expect(Object.prototype.toString.call(element)).toEqual('[object Object]');
|
|
32
|
+
// expect(Object.prototype.toString.call(element.item)).toBe('string');
|
|
33
|
+
expect(element['@type']).toEqual('ListItem');
|
|
34
|
+
expect(element.position).toEqual(i + 1);
|
|
35
|
+
switch (i) {
|
|
36
|
+
case 1:
|
|
37
|
+
expect(element.name).toEqual('Breadcrumb A');
|
|
38
|
+
expect(element.position).toEqual(2);
|
|
39
|
+
|
|
40
|
+
break;
|
|
41
|
+
case 2:
|
|
42
|
+
expect(element.name).toEqual('Breadcrumb B');
|
|
43
|
+
expect(element.position).toEqual(3);
|
|
44
|
+
break;
|
|
45
|
+
case 3:
|
|
46
|
+
expect(element.name).toEqual('Some Title Review');
|
|
47
|
+
expect(element.position).toEqual(4);
|
|
48
|
+
break;
|
|
49
|
+
default:
|
|
50
|
+
expect(element.name).toEqual('Site Name');
|
|
51
|
+
expect(element.position).toEqual(1);
|
|
52
|
+
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
35
56
|
});
|
|
36
57
|
|
|
37
|
-
test('
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
updated_at: '02/02/02',
|
|
46
|
-
seo_keywords: ['keyword_a', 'keyword_b'],
|
|
47
|
-
authors: [
|
|
48
|
-
{
|
|
49
|
-
profile_page_path: 'author_a/author_page',
|
|
50
|
-
email_address: 'email_a@email.com',
|
|
51
|
-
name: 'Author_A',
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
profile_page_path: 'author_b/author_page',
|
|
55
|
-
email_address: 'email_b@email.com',
|
|
56
|
-
name: 'Author_B',
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
|
-
siteSchema: {
|
|
60
|
-
site_name: 'Site Name',
|
|
61
|
-
alias_site_name: 'Alias Site Name',
|
|
62
|
-
organization_founding_date: '01/02/03',
|
|
63
|
-
linkedin: 'author_linkedin',
|
|
64
|
-
spotify: 'author_spotify',
|
|
65
|
-
wikipedia: 'author_wikipedia',
|
|
66
|
-
},
|
|
58
|
+
test('schemaGenerator(PCSA)', () => {
|
|
59
|
+
process.env.GATSBY_SITE_NAME = 'playcasino.co.za';
|
|
60
|
+
const output = Schema.schemaGenerator({
|
|
61
|
+
seo_json_schema: 'SEO JSON Schema',
|
|
62
|
+
author: {
|
|
63
|
+
name: 'Leo',
|
|
64
|
+
facebook_profile: 'url',
|
|
65
|
+
instagram_profile: 'url 2',
|
|
67
66
|
},
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
expect(json['@id']).toEqual(`${getUrl('web_page')}#webpage`);
|
|
74
|
-
expect(json.url).toEqual(getUrl('web_page'));
|
|
75
|
-
expect(json.name).toEqual('Meta Title');
|
|
76
|
-
expect(json.description).toEqual('Meta Description');
|
|
77
|
-
expect(json.inLanguage).toEqual('site_lang');
|
|
78
|
-
expect(json.datePublished).toEqual('01/01/01');
|
|
79
|
-
expect(json.dateModified).toEqual('02/02/02');
|
|
80
|
-
|
|
81
|
-
expect(Object.prototype.toString.call(json.isPartOf)).toEqual('[object Object]');
|
|
82
|
-
expect(json.isPartOf['@type']).toEqual('WebSite');
|
|
83
|
-
expect(json.isPartOf['@id']).toEqual(`${process.env.GATSBY_SITE_URL}#website`);
|
|
84
|
-
expect(json.isPartOf.url).toEqual(`${process.env.GATSBY_SITE_URL}`);
|
|
85
|
-
expect(json.isPartOf.inLanguage).toEqual('site_lang');
|
|
86
|
-
|
|
87
|
-
expect(Object.prototype.toString.call(json.primaryImageOfPage)).toEqual('[object Object]');
|
|
88
|
-
expect(json.primaryImageOfPage['@type']).toEqual('ImageObject');
|
|
89
|
-
expect(json.primaryImageOfPage['@id']).toEqual(`${getUrl('web_page')}#primaryimage`);
|
|
90
|
-
expect(json.primaryImageOfPage.url).toEqual(pageImage);
|
|
91
|
-
expect(json.primaryImageOfPage.inLanguage).toEqual('site_lang');
|
|
92
|
-
|
|
93
|
-
expect(Object.prototype.toString.call(json.author)).toEqual('[object Object]');
|
|
94
|
-
expect(json.author['@type']).toEqual('Organization');
|
|
95
|
-
expect(json.author.name).toEqual('Site Name');
|
|
96
|
-
expect(json.author.alternateName).toEqual('Alias Site Name');
|
|
97
|
-
expect(json.author.foundingDate).toEqual('01/02/03');
|
|
98
|
-
expect(json.author.publishingPrinciples).toEqual(undefined);
|
|
99
|
-
|
|
100
|
-
expect(Object.prototype.toString.call(json.author.logo)).toEqual('[object Object]');
|
|
101
|
-
expect(json.author.logo['@type']).toEqual('ImageObject');
|
|
102
|
-
expect(json.author.logo.url).toEqual(pageImage);
|
|
103
|
-
|
|
104
|
-
expect(Object.prototype.toString.call(json.author.contactPoint)).toEqual('[object Array]');
|
|
105
|
-
expect(json.author.contactPoint).toHaveLength(2);
|
|
106
|
-
expect(Object.prototype.toString.call(json.author.contactPoint[0])).toEqual('[object Object]');
|
|
107
|
-
expect(Object.prototype.toString.call(json.author.contactPoint[1])).toEqual('[object Object]');
|
|
108
|
-
expect(json.author.contactPoint[0]['@type']).toEqual('ContactPoint');
|
|
109
|
-
expect(json.author.contactPoint[1]['@type']).toEqual('ContactPoint');
|
|
110
|
-
expect(json.author.contactPoint[0].contactType).toEqual('Author');
|
|
111
|
-
expect(json.author.contactPoint[1].contactType).toEqual('Author');
|
|
112
|
-
expect(json.author.contactPoint[0].url).toEqual(`${getUrl('/')}author_a/author_page`);
|
|
113
|
-
expect(json.author.contactPoint[1].url).toEqual(`${getUrl('/')}author_b/author_page`);
|
|
114
|
-
expect(json.author.contactPoint[0].name).toEqual('Author_A');
|
|
115
|
-
expect(json.author.contactPoint[1].name).toEqual('Author_B');
|
|
116
|
-
expect(json.author.contactPoint[0].email).toEqual('email_a@email.com');
|
|
117
|
-
expect(json.author.contactPoint[1].email).toEqual('email_b@email.com');
|
|
118
|
-
|
|
119
|
-
expect(Object.prototype.toString.call(json.author.sameAs)).toEqual('[object Array]');
|
|
120
|
-
expect(json.author.sameAs).toHaveLength(3);
|
|
121
|
-
expect(json.author.sameAs[0]).toEqual('author_linkedin');
|
|
122
|
-
expect(json.author.sameAs[1]).toEqual('author_spotify');
|
|
123
|
-
expect(json.author.sameAs[2]).toEqual('author_wikipedia');
|
|
124
|
-
expect(json.author.knowsAbout).toEqual(undefined);
|
|
125
|
-
|
|
126
|
-
expect(Object.prototype.toString.call(json.keywords)).toEqual('[object Array]');
|
|
127
|
-
expect(json.keywords).toHaveLength(2);
|
|
128
|
-
expect(json.keywords[0]).toEqual('keyword_a');
|
|
129
|
-
expect(json.keywords[1]).toEqual('keyword_b');
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
test('organizationSchema()', () => {
|
|
133
|
-
const output = Schema.organizationSchema(
|
|
134
|
-
{
|
|
135
|
-
siteSchema: {
|
|
136
|
-
site_name: 'Site Name',
|
|
137
|
-
linkedin: 'organization_linkedin',
|
|
138
|
-
spotify: 'organization_spotify',
|
|
139
|
-
wikipedia: 'organization_wikipedia',
|
|
67
|
+
authors: [
|
|
68
|
+
{
|
|
69
|
+
email_address: 'email',
|
|
70
|
+
name: 'name',
|
|
71
|
+
profile_page_path: 'about-us/name',
|
|
140
72
|
},
|
|
73
|
+
],
|
|
74
|
+
breadcrumbs: [{ path: '/' }],
|
|
75
|
+
type: 'operator',
|
|
76
|
+
path: '/',
|
|
77
|
+
sections: { main: { modules: [{ name: 'faq' }] } },
|
|
78
|
+
siteSchema: {
|
|
79
|
+
site_name: 'Site Name',
|
|
141
80
|
},
|
|
142
|
-
|
|
143
|
-
);
|
|
81
|
+
});
|
|
144
82
|
|
|
145
|
-
|
|
146
|
-
expect(json['@type']).toEqual('Organization');
|
|
147
|
-
expect(json.url).toEqual(process.env.GATSBY_SITE_URL);
|
|
148
|
-
expect(json.name).toEqual('Site Name');
|
|
149
|
-
expect(json.logo).toEqual(pageImage);
|
|
150
|
-
|
|
151
|
-
expect(Object.prototype.toString.call(json.sameAs)).toEqual('[object Array]');
|
|
152
|
-
expect(json.sameAs).toHaveLength(3);
|
|
153
|
-
expect(json.sameAs[0]).toEqual('organization_linkedin');
|
|
154
|
-
expect(json.sameAs[1]).toEqual('organization_spotify');
|
|
155
|
-
expect(json.sameAs[2]).toEqual('organization_wikipedia');
|
|
156
|
-
});
|
|
83
|
+
expect(Object.prototype.toString.call(output)).toEqual('[object Array]');
|
|
157
84
|
|
|
158
|
-
|
|
159
|
-
|
|
85
|
+
expect(Object.prototype.toString.call(output[0])).toEqual('[object String]');
|
|
86
|
+
expect(output[0]).toEqual('SEO JSON Schema');
|
|
160
87
|
|
|
161
|
-
expect(output).
|
|
162
|
-
expect(output[0]).toEqual(undefined);
|
|
163
|
-
});
|
|
88
|
+
expect(output[2]).toEqual(null);
|
|
164
89
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
[
|
|
168
|
-
{
|
|
169
|
-
name: 'faq',
|
|
170
|
-
items: [
|
|
171
|
-
{ answer: 'Answer A', question: 'Question A' },
|
|
172
|
-
{ answer: 'Answer B', question: 'Question B' },
|
|
173
|
-
{ answer: 'Answer C', question: 'Question C' },
|
|
174
|
-
],
|
|
175
|
-
},
|
|
176
|
-
],
|
|
177
|
-
'/'
|
|
178
|
-
)[0];
|
|
90
|
+
const jsonOrganization = parseCheckSchema(output[3]);
|
|
91
|
+
expect(jsonOrganization['@type']).toEqual('Organization');
|
|
179
92
|
|
|
180
|
-
const
|
|
181
|
-
expect(
|
|
182
|
-
|
|
183
|
-
expect(Object.prototype.toString.call(json.mainEntity)).toEqual('[object Array]');
|
|
184
|
-
expect(json.mainEntity).toHaveLength(3);
|
|
185
|
-
expect(Object.prototype.toString.call(json.mainEntity[0])).toEqual('[object Object]');
|
|
186
|
-
expect(Object.prototype.toString.call(json.mainEntity[1])).toEqual('[object Object]');
|
|
187
|
-
expect(Object.prototype.toString.call(json.mainEntity[2])).toEqual('[object Object]');
|
|
188
|
-
expect(json.mainEntity[0]['@type']).toEqual('Question');
|
|
189
|
-
expect(json.mainEntity[1]['@type']).toEqual('Question');
|
|
190
|
-
expect(json.mainEntity[2]['@type']).toEqual('Question');
|
|
191
|
-
expect(json.mainEntity[0].name).toEqual('Question A');
|
|
192
|
-
expect(json.mainEntity[1].name).toEqual('Question B');
|
|
193
|
-
expect(json.mainEntity[2].name).toEqual('Question C');
|
|
194
|
-
|
|
195
|
-
expect(Object.prototype.toString.call(json.mainEntity[0].acceptedAnswer)).toEqual(
|
|
196
|
-
'[object Object]'
|
|
197
|
-
);
|
|
198
|
-
expect(Object.prototype.toString.call(json.mainEntity[1].acceptedAnswer)).toEqual(
|
|
199
|
-
'[object Object]'
|
|
200
|
-
);
|
|
201
|
-
expect(Object.prototype.toString.call(json.mainEntity[2].acceptedAnswer)).toEqual(
|
|
202
|
-
'[object Object]'
|
|
203
|
-
);
|
|
204
|
-
expect(json.mainEntity[0].acceptedAnswer['@type']).toEqual('Answer');
|
|
205
|
-
expect(json.mainEntity[1].acceptedAnswer['@type']).toEqual('Answer');
|
|
206
|
-
expect(json.mainEntity[2].acceptedAnswer['@type']).toEqual('Answer');
|
|
207
|
-
expect(json.mainEntity[0].acceptedAnswer.text).toEqual('Answer A');
|
|
208
|
-
expect(json.mainEntity[1].acceptedAnswer.text).toEqual('Answer B');
|
|
209
|
-
expect(json.mainEntity[2].acceptedAnswer.text).toEqual('Answer C');
|
|
210
|
-
});
|
|
93
|
+
const jsonArticle = parseCheckSchema(output[4]);
|
|
94
|
+
expect(jsonArticle['@type']).toEqual('Review');
|
|
211
95
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
type: 'other',
|
|
215
|
-
path: 'other_page',
|
|
216
|
-
});
|
|
96
|
+
const jsonWebSite = parseCheckSchema(output[5]);
|
|
97
|
+
expect(jsonWebSite['@type']).toEqual('WebSite');
|
|
217
98
|
|
|
218
|
-
|
|
99
|
+
const jsonFaq = parseCheckSchema(output[7]);
|
|
100
|
+
expect(jsonFaq['@type']).toEqual('FAQPage');
|
|
219
101
|
});
|
|
220
102
|
|
|
221
|
-
test('
|
|
222
|
-
|
|
103
|
+
test('schemaGenerator(IL)', () => {
|
|
104
|
+
process.env.GATSBY_SITE_NAME = 'irishluck.ie';
|
|
105
|
+
const output = Schema.schemaGenerator({
|
|
106
|
+
seo_json_schema: 'SEO JSON Schema',
|
|
223
107
|
type: 'article',
|
|
224
|
-
path: '
|
|
225
|
-
title: 'Article Title',
|
|
226
|
-
created_at: '01/01/01',
|
|
227
|
-
updated_at: '02/02/02',
|
|
228
|
-
featured_image_object: {
|
|
229
|
-
url: 'featured_image/image.jpg',
|
|
230
|
-
},
|
|
231
|
-
author: {
|
|
232
|
-
name: 'Very long name for the 100 characters Article Author test - ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
|
233
|
-
profile_page_path: 'article_author/author_page',
|
|
234
|
-
},
|
|
235
|
-
siteInfo: {
|
|
236
|
-
site_logo: 'logo.jpg',
|
|
237
|
-
},
|
|
108
|
+
path: '/test-path',
|
|
238
109
|
});
|
|
239
110
|
|
|
240
|
-
|
|
241
|
-
expect(json['@type']).toEqual('Article');
|
|
242
|
-
expect(json.url).toEqual(getUrl('article_page'));
|
|
243
|
-
expect(json.headline).toEqual('Article Title');
|
|
244
|
-
expect(json.datePublished).toEqual('01/01/01');
|
|
245
|
-
expect(json.dateModified).toEqual('02/02/02');
|
|
246
|
-
|
|
247
|
-
expect(Object.prototype.toString.call(json.mainEntityOfPage)).toEqual('[object Object]');
|
|
248
|
-
expect(json.mainEntityOfPage['@type']).toEqual('WebPage');
|
|
249
|
-
expect(json.mainEntityOfPage.url).toEqual(process.env.GATSBY_SITE_URL);
|
|
250
|
-
|
|
251
|
-
expect(Object.prototype.toString.call(json.author)).toEqual('[object Object]');
|
|
252
|
-
expect(json.author['@type']).toEqual('Person');
|
|
253
|
-
expect(json.author.name).toHaveLength(100);
|
|
254
|
-
expect(json.author.name).toEqual(
|
|
255
|
-
'Very long name for the 100 characters Article Author test - ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMN'
|
|
256
|
-
);
|
|
257
|
-
expect(json.author.url).toEqual(`${getUrl('/')}article_author/author_page`);
|
|
258
|
-
|
|
259
|
-
expect(Object.prototype.toString.call(json.publisher)).toEqual('[object Object]');
|
|
260
|
-
expect(json.publisher['@type']).toEqual('Organization');
|
|
261
|
-
expect(json.publisher.name).toBeTruthy();
|
|
262
|
-
expect(json.publisher.logo).toEqual(`${process.env.IMAGE_CDN_URL}/logo.jpg`);
|
|
263
|
-
});
|
|
111
|
+
expect(Object.prototype.toString.call(output)).toEqual('[object Array]');
|
|
264
112
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
type: 'operator',
|
|
268
|
-
path: 'operator_page',
|
|
269
|
-
title: 'Operator Title',
|
|
270
|
-
relation: {
|
|
271
|
-
name: 'Operator Relation Name',
|
|
272
|
-
rating: 3.5,
|
|
273
|
-
logo_url_object: {
|
|
274
|
-
url: 'logo_url/image.jpg',
|
|
275
|
-
},
|
|
276
|
-
},
|
|
277
|
-
featured_image_object: {
|
|
278
|
-
url: 'featured_image/image.jpg',
|
|
279
|
-
},
|
|
280
|
-
author: {
|
|
281
|
-
name: 'Very long name for the 100 characters Article Author test - ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
|
282
|
-
profile_page_path: 'operator_review_author/author_page',
|
|
283
|
-
},
|
|
284
|
-
siteInfo: {
|
|
285
|
-
site_logo: 'logo.jpg',
|
|
286
|
-
},
|
|
287
|
-
extra_fields: {
|
|
288
|
-
operator_summary: 'Operator Review Summary',
|
|
289
|
-
},
|
|
290
|
-
});
|
|
113
|
+
expect(Object.prototype.toString.call(output[0])).toEqual('[object String]');
|
|
114
|
+
expect(output[0]).toEqual('SEO JSON Schema');
|
|
291
115
|
|
|
292
|
-
const
|
|
293
|
-
expect(
|
|
294
|
-
expect(json.name).toEqual('Operator Relation Name');
|
|
295
|
-
expect(json.reviewBody).toEqual('Operator Review Summary');
|
|
296
|
-
|
|
297
|
-
expect(Object.prototype.toString.call(json.itemReviewed)).toEqual('[object Object]');
|
|
298
|
-
expect(json.itemReviewed['@type']).toEqual('Organization');
|
|
299
|
-
expect(json.itemReviewed.url).toEqual(getUrl('operator_page'));
|
|
300
|
-
expect(json.itemReviewed.name).toEqual('Operator Title');
|
|
301
|
-
expect(json.itemReviewed.image).toEqual('logo_url/image.jpg');
|
|
302
|
-
|
|
303
|
-
expect(Object.prototype.toString.call(json.reviewRating)).toEqual('[object Object]');
|
|
304
|
-
expect(json.reviewRating['@type']).toEqual('Rating');
|
|
305
|
-
expect(json.reviewRating.bestRating).toEqual('5');
|
|
306
|
-
expect(json.reviewRating.worstRating).toEqual('0');
|
|
307
|
-
expect(json.reviewRating.ratingValue).toEqual('3.5');
|
|
308
|
-
|
|
309
|
-
expect(Object.prototype.toString.call(json.author)).toEqual('[object Object]');
|
|
310
|
-
expect(json.author['@type']).toEqual('Person');
|
|
311
|
-
expect(json.author.name).toHaveLength(100);
|
|
312
|
-
expect(json.author.name).toEqual(
|
|
313
|
-
'Very long name for the 100 characters Article Author test - ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMN'
|
|
314
|
-
);
|
|
315
|
-
expect(json.author.url).toEqual(`${getUrl('/')}operator_review_author/author_page`);
|
|
316
|
-
|
|
317
|
-
expect(Object.prototype.toString.call(json.publisher)).toEqual('[object Object]');
|
|
318
|
-
expect(json.publisher['@type']).toEqual('Organization');
|
|
319
|
-
expect(json.publisher.name).toBeTruthy();
|
|
320
|
-
expect(json.publisher.logo).toEqual(`${process.env.IMAGE_CDN_URL}/logo.jpg`);
|
|
321
|
-
});
|
|
116
|
+
const jsonBreadcrumbs = parseCheckSchema(output[1]);
|
|
117
|
+
expect(jsonBreadcrumbs['@type']).toEqual('BreadcrumbList');
|
|
322
118
|
|
|
323
|
-
|
|
324
|
-
const output = Schema.templateSchemas({
|
|
325
|
-
type: 'game',
|
|
326
|
-
path: 'game_page',
|
|
327
|
-
relation: {
|
|
328
|
-
name: 'Game Relation Name',
|
|
329
|
-
first_rating: 3.5,
|
|
330
|
-
third_rating: 1.5,
|
|
331
|
-
},
|
|
332
|
-
featured_image_object: {
|
|
333
|
-
url: 'featured_image/image.jpg',
|
|
334
|
-
},
|
|
335
|
-
author: {
|
|
336
|
-
name: 'Very long name for the 100 characters Article Author test - ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
|
337
|
-
profile_page_path: 'operator_review_author/author_page',
|
|
338
|
-
},
|
|
339
|
-
siteInfo: {
|
|
340
|
-
site_logo: 'logo.jpg',
|
|
341
|
-
},
|
|
342
|
-
extra_fields: {
|
|
343
|
-
game_summary: 'Game Review Summary',
|
|
344
|
-
},
|
|
345
|
-
});
|
|
119
|
+
const jsonWebpage = parseCheckSchema(output[2]);
|
|
346
120
|
|
|
347
|
-
|
|
348
|
-
expect(
|
|
349
|
-
|
|
350
|
-
expect(
|
|
351
|
-
|
|
352
|
-
expect(
|
|
353
|
-
|
|
354
|
-
expect(Object.prototype.toString.call(json.applicationCategory)).toEqual('[object Array]');
|
|
355
|
-
expect(json.applicationCategory).toHaveLength(1);
|
|
356
|
-
expect(json.applicationCategory[0]).toEqual('Game');
|
|
357
|
-
|
|
358
|
-
expect(Object.prototype.toString.call(json.author)).toEqual('[object Object]');
|
|
359
|
-
expect(json.author['@type']).toEqual('Organization');
|
|
360
|
-
expect(json.author.name).toEqual(process.env.GATSBY_SITE_NAME);
|
|
361
|
-
expect(json.author.url).toEqual(process.env.GATSBY_SITE_URL);
|
|
362
|
-
|
|
363
|
-
expect(Object.prototype.toString.call(json.review)).toEqual('[object Object]');
|
|
364
|
-
expect(json.review['@type']).toEqual('Review');
|
|
365
|
-
expect(json.review.name).toEqual('Game Relation Name');
|
|
366
|
-
|
|
367
|
-
expect(Object.prototype.toString.call(json.review.reviewRating)).toEqual('[object Object]');
|
|
368
|
-
expect(json.review.reviewRating['@type']).toEqual('Rating');
|
|
369
|
-
expect(json.review.reviewRating.bestRating).toEqual('10');
|
|
370
|
-
expect(json.review.reviewRating.worstRating).toEqual('0');
|
|
371
|
-
expect(json.review.reviewRating.ratingValue).toEqual('2');
|
|
372
|
-
|
|
373
|
-
expect(Object.prototype.toString.call(json.review.author)).toEqual('[object Object]');
|
|
374
|
-
expect(json.review.author['@type']).toEqual('Person');
|
|
375
|
-
expect(json.review.author.name).toHaveLength(100);
|
|
376
|
-
expect(json.review.author.name).toEqual(
|
|
377
|
-
'Very long name for the 100 characters Article Author test - ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMN'
|
|
378
|
-
);
|
|
379
|
-
expect(json.review.author.url).toEqual(`${getUrl('/')}operator_review_author/author_page`);
|
|
380
|
-
|
|
381
|
-
expect(Object.prototype.toString.call(json.review.publisher)).toEqual('[object Object]');
|
|
382
|
-
expect(json.review.publisher['@type']).toEqual('Organization');
|
|
383
|
-
expect(json.review.publisher.name).toBeTruthy();
|
|
384
|
-
expect(json.review.publisher.logo).toEqual(`${process.env.IMAGE_CDN_URL}/logo.jpg`);
|
|
121
|
+
expect(jsonWebpage['@type']).toEqual('WebPage');
|
|
122
|
+
expect(jsonWebpage.keywords).toEqual(undefined);
|
|
123
|
+
|
|
124
|
+
expect(output[3]).toEqual(null);
|
|
125
|
+
|
|
126
|
+
expect(output[5]).toEqual(null);
|
|
385
127
|
});
|
|
386
128
|
|
|
387
|
-
test('schemaGenerator()', () => {
|
|
129
|
+
test('schemaGenerator(NSA)', () => {
|
|
130
|
+
process.env.GATSBY_SITE_NAME = 'norskespilleautomater.com';
|
|
388
131
|
const output = Schema.schemaGenerator({
|
|
389
132
|
seo_json_schema: 'SEO JSON Schema',
|
|
390
|
-
|
|
391
|
-
type: 'article',
|
|
133
|
+
type: 'other',
|
|
392
134
|
path: '/test-path',
|
|
393
|
-
|
|
135
|
+
siteSchema: {
|
|
136
|
+
publishing_principles: 'https://www.norskespilleautomater.com/om-oss/prinsipper',
|
|
137
|
+
knows_about: [
|
|
138
|
+
{
|
|
139
|
+
links: ['link'],
|
|
140
|
+
name: 'name',
|
|
141
|
+
type: 'type',
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
},
|
|
394
145
|
});
|
|
395
146
|
|
|
396
147
|
expect(Object.prototype.toString.call(output)).toEqual('[object Array]');
|
|
@@ -404,15 +155,57 @@ describe('Schema Helper', () => {
|
|
|
404
155
|
const jsonWebpage = parseCheckSchema(output[2]);
|
|
405
156
|
expect(jsonWebpage['@type']).toEqual('WebPage');
|
|
406
157
|
expect(jsonWebpage.keywords).toEqual(undefined);
|
|
407
|
-
expect(jsonWebpage.knowsAbout).toEqual(undefined);
|
|
408
158
|
|
|
409
|
-
|
|
410
|
-
expect(jsonOrganization['@type']).toEqual('Organization');
|
|
159
|
+
expect(output[3]).toEqual(null);
|
|
411
160
|
|
|
412
|
-
|
|
413
|
-
expect(jsonArticle['@type']).toEqual('Article');
|
|
161
|
+
expect(output[4]).toEqual(null);
|
|
414
162
|
|
|
415
|
-
|
|
416
|
-
|
|
163
|
+
expect(output[5]).toEqual(null);
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
test('schemaGenerator(game)', () => {
|
|
167
|
+
// process.env.GATSBY_SITE_NAME = 'norskespilleautomater.com';
|
|
168
|
+
const output = Schema.schemaGenerator({
|
|
169
|
+
seo_json_schema: 'SEO JSON Schema',
|
|
170
|
+
author: {
|
|
171
|
+
name: 'Leo',
|
|
172
|
+
facebook_profile: 'url',
|
|
173
|
+
twitter_profile: 'url',
|
|
174
|
+
},
|
|
175
|
+
type: 'game',
|
|
176
|
+
author_id: 23,
|
|
177
|
+
path: '/test-path',
|
|
178
|
+
relation: {
|
|
179
|
+
rating: 4,
|
|
180
|
+
},
|
|
181
|
+
siteSchema: {
|
|
182
|
+
video: { items: [{}] },
|
|
183
|
+
|
|
184
|
+
knows_about: [
|
|
185
|
+
{
|
|
186
|
+
links: ['link'],
|
|
187
|
+
name: 'name',
|
|
188
|
+
type: 'type',
|
|
189
|
+
},
|
|
190
|
+
],
|
|
191
|
+
},
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
expect(Object.prototype.toString.call(output)).toEqual('[object Array]');
|
|
195
|
+
|
|
196
|
+
expect(Object.prototype.toString.call(output[0])).toEqual('[object String]');
|
|
197
|
+
expect(output[0]).toEqual('SEO JSON Schema');
|
|
198
|
+
|
|
199
|
+
const jsonBreadcrumbs = parseCheckSchema(output[1]);
|
|
200
|
+
expect(jsonBreadcrumbs['@type']).toEqual('BreadcrumbList');
|
|
201
|
+
|
|
202
|
+
const jsonReviewer = parseCheckSchema(output[4]);
|
|
203
|
+
expect(jsonReviewer['@type']).toEqual('Review');
|
|
204
|
+
|
|
205
|
+
const jsonPerson = parseCheckSchema(output[6]);
|
|
206
|
+
expect(jsonPerson['@type']).toEqual('Person');
|
|
207
|
+
|
|
208
|
+
// const jsonVideoObject = parseCheckSchema(output[7]);
|
|
209
|
+
// expect(jsonVideoObject['@type']).toEqual('VideoObject');
|
|
417
210
|
});
|
|
418
211
|
});
|