gatsby-core-theme 2.2.2 → 2.2.3
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/.ci.yml +2 -0
- package/CHANGELOG.md +24 -0
- package/package.json +1 -1
- package/src/helpers/schema.js +20 -38
- package/src/helpers/schema.test.js +30 -22
package/.ci.yml
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
## [2.2.3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v2.2.2...v2.2.3) (2022-01-25)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Code Refactoring
|
|
5
|
+
|
|
6
|
+
* update schema and tests ([ef8a496](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ef8a496552c50178349004d7d8695a39ef2f11d2))
|
|
7
|
+
* update schema for matrix sites with position and image ([e804f7b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/e804f7bef4b2a6a233e3ef14878f2afaf147996c))
|
|
8
|
+
* update templateSchemas publisher and breadcrumb position ([9dd4955](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/9dd495589a977cb5fa0e11d4411316330bbf7a80))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Config
|
|
12
|
+
|
|
13
|
+
* added content deploy pipeline ([6febaa4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/6febaa49d529191978358b3b61f034c7e057b013))
|
|
14
|
+
* added content deploy pipeline ([9f23f69](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/9f23f69108933e5c1ef48f31be0f0afef1872139))
|
|
15
|
+
* added content deploy pipeline ([d8c8147](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d8c814782c099890a01a26aa2f86fe9973c346f4))
|
|
16
|
+
* added content deploy pipeline ([2d31659](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/2d31659b0681f78633a5668c9f493a4f34d32f25))
|
|
17
|
+
* added content deploy pipeline ([c497607](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c49760723a860abc31906df31d5269dc3357c5ab))
|
|
18
|
+
* added content deploy pipeline ([e193c83](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/e193c83d3d17126a7c936a266939580906dab639))
|
|
19
|
+
* added content deploy pipeline ([4b43283](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/4b43283bff99d22093ebd019fcdd7831a61917de))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
* Merge branch 'misc-update-schema-and-tests' into 'master' ([88111e6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/88111e62f2eff8fe742a0948f4f977ce4f236fa6))
|
|
23
|
+
* Merge branch 'master' of git.ilcd.rocks:team-floyd/themes/gatsby-themes ([7466000](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/74660006e597a5f7ff3a0d2856a6191e69ab69f3))
|
|
24
|
+
|
|
1
25
|
## [2.2.2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v2.2.1...v2.2.2) (2022-01-21)
|
|
2
26
|
|
|
3
27
|
|
package/package.json
CHANGED
package/src/helpers/schema.js
CHANGED
|
@@ -2,7 +2,7 @@ import { getGameRating, getUrl, getLanguage } from './getters';
|
|
|
2
2
|
import { cleanHTML } from './strings';
|
|
3
3
|
|
|
4
4
|
/* HardCoded Start */
|
|
5
|
-
const isIL = process.env.GATSBY_SITE_NAME === '
|
|
5
|
+
const isIL = process.env.GATSBY_SITE_NAME === 'irishluck.ie';
|
|
6
6
|
const isNSA = process.env.GATSBY_SITE_NAME === 'norskespilleautomater.com';
|
|
7
7
|
const publishingPrinciples = isIL
|
|
8
8
|
? 'https://www.irishluck.ie/editorial-principles'
|
|
@@ -86,7 +86,7 @@ export function breadcrumbsSchema(breadcrumbs) {
|
|
|
86
86
|
itemListElement: breadcrumbs.map((breadcrumb, index) => ({
|
|
87
87
|
'@type': 'ListItem',
|
|
88
88
|
name: breadcrumb.path,
|
|
89
|
-
position: index,
|
|
89
|
+
position: index + 1,
|
|
90
90
|
item: {
|
|
91
91
|
'@id': `${getUrl(breadcrumb.path)}#webpage`,
|
|
92
92
|
},
|
|
@@ -198,14 +198,25 @@ export function moduleSchemas(modules) {
|
|
|
198
198
|
return filteredSchema;
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
export function templateSchemas(page) {
|
|
201
|
+
export function templateSchemas(page, pageImage) {
|
|
202
|
+
const sharedProps = {
|
|
203
|
+
author: {
|
|
204
|
+
'@type': 'Person',
|
|
205
|
+
name: page.author?.name?.substring(0, 100),
|
|
206
|
+
url: getUrl(page.author?.profile_page_path || '/'),
|
|
207
|
+
},
|
|
208
|
+
publisher: {
|
|
209
|
+
'@type': 'Organization',
|
|
210
|
+
name: process.env.GATSBY_SITE_NAME,
|
|
211
|
+
logo: page.featured_image_object?.url || pageImage,
|
|
212
|
+
},
|
|
213
|
+
};
|
|
202
214
|
switch (page.type) {
|
|
203
215
|
case 'article': {
|
|
204
216
|
const schema = {
|
|
205
217
|
'@context': 'https://schema.org',
|
|
206
218
|
'@type': 'Article',
|
|
207
219
|
url: getUrl(page.path),
|
|
208
|
-
image: page.featured_image_object?.url,
|
|
209
220
|
headline: page.title,
|
|
210
221
|
datePublished: page.created_at,
|
|
211
222
|
dateModified: page.updated_at,
|
|
@@ -213,15 +224,7 @@ export function templateSchemas(page) {
|
|
|
213
224
|
'@type': 'WebPage',
|
|
214
225
|
url: process.env.GATSBY_SITE_URL,
|
|
215
226
|
},
|
|
216
|
-
|
|
217
|
-
'@type': 'Person',
|
|
218
|
-
name: page.author?.name?.substring(0, 100),
|
|
219
|
-
url: getUrl(page.author?.profile_page_path || '/'),
|
|
220
|
-
},
|
|
221
|
-
publisher: {
|
|
222
|
-
'@type': 'Organization',
|
|
223
|
-
name: process.env.GATSBY_SITE_NAME,
|
|
224
|
-
},
|
|
227
|
+
...sharedProps,
|
|
225
228
|
};
|
|
226
229
|
|
|
227
230
|
return JSON.stringify(generateSchemaObject(schema));
|
|
@@ -244,19 +247,7 @@ export function templateSchemas(page) {
|
|
|
244
247
|
worstRating: '0',
|
|
245
248
|
ratingValue: page.relation?.rating?.toString() || '',
|
|
246
249
|
},
|
|
247
|
-
|
|
248
|
-
'@type': 'Person',
|
|
249
|
-
name: page.author?.name?.substring(0, 100),
|
|
250
|
-
url: getUrl(page.author?.profile_page_path || '/'),
|
|
251
|
-
},
|
|
252
|
-
publisher: {
|
|
253
|
-
'@type': 'Organization',
|
|
254
|
-
name: process.env.GATSBY_SITE_NAME,
|
|
255
|
-
logo: {
|
|
256
|
-
'@type': 'ImageObject',
|
|
257
|
-
url: page.featured_image_object?.url,
|
|
258
|
-
},
|
|
259
|
-
},
|
|
250
|
+
...sharedProps,
|
|
260
251
|
};
|
|
261
252
|
|
|
262
253
|
return JSON.stringify(generateSchemaObject(schema));
|
|
@@ -269,7 +260,6 @@ export function templateSchemas(page) {
|
|
|
269
260
|
url: getUrl(page.path),
|
|
270
261
|
name: page.relation?.name || '',
|
|
271
262
|
description: page.extra_fields?.game_summary || '',
|
|
272
|
-
image: page.featured_image_object?.url,
|
|
273
263
|
operatingSystem: 'Multi-platform',
|
|
274
264
|
applicationCategory: ['Game'],
|
|
275
265
|
author: {
|
|
@@ -279,22 +269,14 @@ export function templateSchemas(page) {
|
|
|
279
269
|
},
|
|
280
270
|
review: {
|
|
281
271
|
'@type': 'Review',
|
|
282
|
-
name:
|
|
272
|
+
name: page.relation?.name || '',
|
|
283
273
|
reviewRating: {
|
|
284
274
|
'@type': 'Rating',
|
|
285
275
|
bestRating: '10',
|
|
286
276
|
worstRating: '0',
|
|
287
277
|
ratingValue: rating?.toString() || '',
|
|
288
278
|
},
|
|
289
|
-
|
|
290
|
-
'@type': 'Person',
|
|
291
|
-
name: page.author?.name?.substring(0, 100),
|
|
292
|
-
url: getUrl(page.author?.profile_page_path || '/'),
|
|
293
|
-
},
|
|
294
|
-
publisher: {
|
|
295
|
-
'@type': 'Organization',
|
|
296
|
-
name: process.env.GATSBY_SITE_NAME,
|
|
297
|
-
},
|
|
279
|
+
...sharedProps,
|
|
298
280
|
},
|
|
299
281
|
};
|
|
300
282
|
|
|
@@ -314,7 +296,7 @@ export function schemaGenerator(page = {}, pageImage) {
|
|
|
314
296
|
// Modules Schemas
|
|
315
297
|
webPageSchema(page, pageImage),
|
|
316
298
|
organizationSchema(page, pageImage),
|
|
317
|
-
templateSchemas(page),
|
|
299
|
+
templateSchemas(page, pageImage),
|
|
318
300
|
...(page.sections?.main?.modules ? moduleSchemas(page.sections.main.modules) : [null]),
|
|
319
301
|
];
|
|
320
302
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as Schema from './schema';
|
|
2
1
|
import { getUrl } from './getters';
|
|
2
|
+
import * as Schema from './schema';
|
|
3
3
|
|
|
4
4
|
const parseCheckSchema = (schema) => {
|
|
5
5
|
const json = JSON.parse(schema);
|
|
@@ -9,6 +9,8 @@ const parseCheckSchema = (schema) => {
|
|
|
9
9
|
return json;
|
|
10
10
|
};
|
|
11
11
|
const pageImage = 'pageImage/pageImage.jpg';
|
|
12
|
+
const isIL = process.env.GATSBY_SITE_NAME === 'irishluck.ie';
|
|
13
|
+
const isNSA = process.env.GATSBY_SITE_NAME === 'norskespilleautomater.com';
|
|
12
14
|
|
|
13
15
|
describe('Schema Helper', () => {
|
|
14
16
|
test('breadcrumbsSchema()', () => {
|
|
@@ -25,8 +27,8 @@ describe('Schema Helper', () => {
|
|
|
25
27
|
expect(json.itemListElement[1]['@type']).toEqual('ListItem');
|
|
26
28
|
expect(json.itemListElement[0].name).toEqual('breadcrumb_a');
|
|
27
29
|
expect(json.itemListElement[1].name).toEqual('breadcrumb_b');
|
|
28
|
-
expect(json.itemListElement[0].position).toEqual(
|
|
29
|
-
expect(json.itemListElement[1].position).toEqual(
|
|
30
|
+
expect(json.itemListElement[0].position).toEqual(1);
|
|
31
|
+
expect(json.itemListElement[1].position).toEqual(2);
|
|
30
32
|
|
|
31
33
|
expect(Object.prototype.toString.call(json.itemListElement[0].item)).toEqual('[object Object]');
|
|
32
34
|
expect(Object.prototype.toString.call(json.itemListElement[1].item)).toEqual('[object Object]');
|
|
@@ -81,7 +83,7 @@ describe('Schema Helper', () => {
|
|
|
81
83
|
expect(Object.prototype.toString.call(json.isPartOf)).toEqual('[object Object]');
|
|
82
84
|
expect(json.isPartOf['@type']).toEqual('WebSite');
|
|
83
85
|
expect(json.isPartOf['@id']).toEqual(`${process.env.GATSBY_SITE_URL}#website`);
|
|
84
|
-
expect(json.isPartOf.url).toEqual(process.env.GATSBY_SITE_URL);
|
|
86
|
+
expect(json.isPartOf.url).toEqual(`${process.env.GATSBY_SITE_URL}`);
|
|
85
87
|
expect(json.isPartOf.inLanguage).toEqual('site_lang');
|
|
86
88
|
|
|
87
89
|
expect(Object.prototype.toString.call(json.primaryImageOfPage)).toEqual('[object Object]');
|
|
@@ -95,9 +97,15 @@ describe('Schema Helper', () => {
|
|
|
95
97
|
expect(json.author.name).toEqual('Site Name');
|
|
96
98
|
expect(json.author.alternateName).toEqual('Alias Site Name');
|
|
97
99
|
expect(json.author.foundingDate).toEqual('01/02/03');
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
if (isIL || isNSA) {
|
|
101
|
+
expect(json.author.publishingPrinciples).toEqual(
|
|
102
|
+
isIL
|
|
103
|
+
? 'https://www.irishluck.ie/editorial-principles'
|
|
104
|
+
: 'https://www.norskespilleautomater.com/om-oss/prinsipper'
|
|
105
|
+
);
|
|
106
|
+
} else {
|
|
107
|
+
expect(json.author.publishingPrinciples).toEqual(undefined);
|
|
108
|
+
}
|
|
101
109
|
|
|
102
110
|
expect(Object.prototype.toString.call(json.author.logo)).toEqual('[object Object]');
|
|
103
111
|
expect(json.author.logo['@type']).toEqual('ImageObject');
|
|
@@ -124,11 +132,15 @@ describe('Schema Helper', () => {
|
|
|
124
132
|
expect(json.author.sameAs[1]).toEqual('author_spotify');
|
|
125
133
|
expect(json.author.sameAs[2]).toEqual('author_wikipedia');
|
|
126
134
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
135
|
+
if (isNSA) {
|
|
136
|
+
expect(Object.prototype.toString.call(json.author.knowsAbout)).toEqual('[object Array]');
|
|
137
|
+
expect(json.author.knowsAbout).toHaveLength(4);
|
|
138
|
+
expect(Object.prototype.toString.call(json.author.knowsAbout[0])).toEqual('[object Object]');
|
|
139
|
+
expect(json.author.knowsAbout[0]['@type']).toEqual('Thing');
|
|
140
|
+
expect(json.author.knowsAbout[0].name).toEqual('Norway');
|
|
141
|
+
} else {
|
|
142
|
+
expect(json.author.knowsAbout).toEqual(undefined);
|
|
143
|
+
}
|
|
132
144
|
|
|
133
145
|
expect(Object.prototype.toString.call(json.keywords)).toEqual('[object Array]');
|
|
134
146
|
expect(json.keywords).toHaveLength(2);
|
|
@@ -225,7 +237,6 @@ describe('Schema Helper', () => {
|
|
|
225
237
|
const json = parseCheckSchema(output);
|
|
226
238
|
expect(json['@type']).toEqual('Article');
|
|
227
239
|
expect(json.url).toEqual(getUrl('article_page'));
|
|
228
|
-
expect(json.image).toEqual('featured_image/image.jpg');
|
|
229
240
|
expect(json.headline).toEqual('Article Title');
|
|
230
241
|
expect(json.datePublished).toEqual('01/01/01');
|
|
231
242
|
expect(json.dateModified).toEqual('02/02/02');
|
|
@@ -245,6 +256,7 @@ describe('Schema Helper', () => {
|
|
|
245
256
|
expect(Object.prototype.toString.call(json.publisher)).toEqual('[object Object]');
|
|
246
257
|
expect(json.publisher['@type']).toEqual('Organization');
|
|
247
258
|
expect(json.publisher.name).toEqual(process.env.GATSBY_SITE_NAME);
|
|
259
|
+
expect(json.publisher.logo).toEqual('featured_image/image.jpg');
|
|
248
260
|
});
|
|
249
261
|
|
|
250
262
|
test('templateSchemas(operator)', () => {
|
|
@@ -299,19 +311,15 @@ describe('Schema Helper', () => {
|
|
|
299
311
|
expect(Object.prototype.toString.call(json.publisher)).toEqual('[object Object]');
|
|
300
312
|
expect(json.publisher['@type']).toEqual('Organization');
|
|
301
313
|
expect(json.publisher.name).toEqual(process.env.GATSBY_SITE_NAME);
|
|
302
|
-
|
|
303
|
-
expect(Object.prototype.toString.call(json.publisher.logo)).toEqual('[object Object]');
|
|
304
|
-
expect(json.publisher.logo['@type']).toEqual('ImageObject');
|
|
305
|
-
expect(json.publisher.logo.url).toEqual('featured_image/image.jpg');
|
|
314
|
+
expect(json.publisher.logo).toEqual('featured_image/image.jpg');
|
|
306
315
|
});
|
|
307
316
|
|
|
308
317
|
test('templateSchemas(game)', () => {
|
|
309
318
|
const output = Schema.templateSchemas({
|
|
310
319
|
type: 'game',
|
|
311
320
|
path: 'game_page',
|
|
312
|
-
title: 'Operator Title',
|
|
313
321
|
relation: {
|
|
314
|
-
name: '
|
|
322
|
+
name: 'Game Relation Name',
|
|
315
323
|
first_rating: 3.5,
|
|
316
324
|
third_rating: 1.5,
|
|
317
325
|
},
|
|
@@ -330,9 +338,8 @@ describe('Schema Helper', () => {
|
|
|
330
338
|
const json = parseCheckSchema(output);
|
|
331
339
|
expect(json['@type']).toEqual('VideoGame');
|
|
332
340
|
expect(json.url).toEqual(getUrl('game_page'));
|
|
333
|
-
expect(json.name).toEqual('
|
|
341
|
+
expect(json.name).toEqual('Game Relation Name');
|
|
334
342
|
expect(json.description).toEqual('Game Review Summary');
|
|
335
|
-
expect(json.image).toEqual('featured_image/image.jpg');
|
|
336
343
|
expect(json.operatingSystem).toEqual('Multi-platform');
|
|
337
344
|
|
|
338
345
|
expect(Object.prototype.toString.call(json.applicationCategory)).toEqual('[object Array]');
|
|
@@ -346,7 +353,7 @@ describe('Schema Helper', () => {
|
|
|
346
353
|
|
|
347
354
|
expect(Object.prototype.toString.call(json.review)).toEqual('[object Object]');
|
|
348
355
|
expect(json.review['@type']).toEqual('Review');
|
|
349
|
-
expect(json.review.name).toEqual('
|
|
356
|
+
expect(json.review.name).toEqual('Game Relation Name');
|
|
350
357
|
|
|
351
358
|
expect(Object.prototype.toString.call(json.review.reviewRating)).toEqual('[object Object]');
|
|
352
359
|
expect(json.review.reviewRating['@type']).toEqual('Rating');
|
|
@@ -365,6 +372,7 @@ describe('Schema Helper', () => {
|
|
|
365
372
|
expect(Object.prototype.toString.call(json.review.publisher)).toEqual('[object Object]');
|
|
366
373
|
expect(json.review.publisher['@type']).toEqual('Organization');
|
|
367
374
|
expect(json.review.publisher.name).toEqual(process.env.GATSBY_SITE_NAME);
|
|
375
|
+
expect(json.review.publisher.logo).toEqual('featured_image/image.jpg');
|
|
368
376
|
});
|
|
369
377
|
|
|
370
378
|
test('schemaGenerator()', () => {
|