gatsby-core-theme 31.0.1 → 31.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 CHANGED
@@ -1,3 +1,19 @@
1
+ ## [31.0.2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v31.0.1...v31.0.2) (2024-05-22)
2
+
3
+
4
+ ### Code Refactoring
5
+
6
+ * add author data to schema ([1fb10aa](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/1fb10aae770de676ec84fbba2db317aa4e9aa1ec))
7
+ * correction to knows about ([a019d7a](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a019d7a706041f5dcc142bb50b2e767cc22c92b1))
8
+
9
+
10
+ * Merge branch 'tm-4271-multiple-contributors' into 'master' ([7bc03c4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/7bc03c425ebc85b583324ddac976a56c9b17569e))
11
+
12
+
13
+ ### Tests
14
+
15
+ * fix test ([0bcbf37](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0bcbf3784962944ebb5b85d77043bd9895116cbc))
16
+
1
17
  ## [31.0.1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v31.0.0...v31.0.1) (2024-05-20)
2
18
 
3
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "31.0.1",
3
+ "version": "31.0.2",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "author": "",
6
6
  "license": "ISC",
@@ -1,4 +1,4 @@
1
- import { getGameRating, getUrl, getLanguage } from './getters';
1
+ import { getGameRating, getUrl, getLanguage, imagePrettyUrl } from './getters';
2
2
  import { cleanHTML } from './strings';
3
3
 
4
4
  /* HardCoded Start */
@@ -31,7 +31,53 @@ const socialLinks = [
31
31
  'wikipedia',
32
32
  'youtube',
33
33
  ];
34
+ const socialAuthorLinks = [
35
+ 'facebook_profile',
36
+ 'twitter_profile',
37
+ 'instagram_profile',
38
+ 'linkedin_profile',
39
+ ];
40
+
34
41
  /* HardCoded End */
42
+ const authorObj = (page, author, webSiteImage) => ({
43
+ '@context': 'https://schema.org',
44
+ '@type': 'Person',
45
+ name: author?.name || '',
46
+ image: author?.image ? imagePrettyUrl(author?.image) : '',
47
+ url: getUrl(author?.profile_page_path),
48
+ jobTitle: author?.author_title,
49
+ email: author?.email_address,
50
+ description: author?.biography,
51
+ sameAs: socialAuthorLinks
52
+ .map((socialLink) => author?.[socialLink])
53
+ .filter((socialLink) => socialLink),
54
+ knowsLanguage: getLanguage(page?.language),
55
+ nationality: {
56
+ '@type': 'Country',
57
+ name: author?.country?.name || '',
58
+ },
59
+ worksFor: {
60
+ '@type': 'Organization',
61
+ name: page?.siteSchema?.site_name,
62
+ logo: webSiteImage,
63
+ url: getUrl('/'),
64
+ sameAs: socialLinks
65
+ .map((socialLink) => page.siteSchema?.[socialLink])
66
+ .filter((socialLink) => socialLink),
67
+ },
68
+ knowsAbout: author?.knows_abouts?.map((item) => ({
69
+ '@type': item?.type,
70
+ name: item?.name,
71
+ sameAs: item?.links.map((link) => link?.link).filter((link) => link),
72
+ })),
73
+ });
74
+
75
+ const getAuthors = (page, webSiteImage) => {
76
+ if (page?.allAuthors?.length) {
77
+ return page?.allAuthors?.map((author) => authorObj(page, author, webSiteImage)) || [];
78
+ }
79
+ return page?.author_id ? authorObj(page, page?.author, webSiteImage) : '';
80
+ };
35
81
 
36
82
  function checkSchemaProp(prop) {
37
83
  return (
@@ -196,7 +242,6 @@ export function webPageSchema(page, pageImage) {
196
242
  '@type': 'Country',
197
243
  name: page?.reviewer?.country?.name,
198
244
  },
199
-
200
245
  knowsAbout: page?.reviewer?.knows_abouts?.map((item) => ({
201
246
  '@type': item?.type,
202
247
  name: item?.name,
@@ -226,23 +271,7 @@ export function webPageSchema(page, pageImage) {
226
271
  .filter((socialLink) => socialLink),
227
272
  ...(page?.knowsAbout ? { knowsAbout: page?.knowsAbout } : {}),
228
273
  },
229
- author: {
230
- '@type': 'Person',
231
- name: page?.author?.name,
232
- jobTitle: page?.author?.author_title,
233
- image: page?.author?.image_object?.url,
234
- email: page?.author?.email_address,
235
- nationality: {
236
- '@type': 'Country',
237
- name: page?.author?.country?.name,
238
- },
239
-
240
- knowsAbout: page?.author?.knows_abouts?.map((item) => ({
241
- '@type': item?.type,
242
- name: item?.name,
243
- sameAs: item?.links.map((link) => link?.link).filter((link) => link),
244
- })),
245
- },
274
+ author: getAuthors(page),
246
275
  };
247
276
  if (speakAbleModules.length > 0) {
248
277
  schema['@speakAbleModules'] = speakAbleModules.map((module) => JSON.parse(module));
@@ -359,12 +388,7 @@ export function moduleSchemas(modules, path, page, pageImage) {
359
388
 
360
389
  export function templateSchemas(page, pageImage) {
361
390
  const sharedProps = {
362
- author: {
363
- '@type': 'Person',
364
- name: page.author?.name?.substring(0, 100),
365
- url: getUrl(page.author?.profile_page_path || '/'),
366
- ...(page?.author?.knowsAbout ? { knowsAbout: page?.author?.knowsAbout } : {}),
367
- },
391
+ author: getAuthors(page),
368
392
  publisher: {
369
393
  '@type': 'Organization',
370
394
  name:
@@ -118,9 +118,11 @@ describe('Schema Helper', () => {
118
118
  created_at: '01/01/01',
119
119
  updated_at: '02/02/02',
120
120
  seo_keywords: ['keyword_a', 'keyword_b'],
121
+ author_id: 112,
121
122
  author: {
122
123
  profile_page_path: 'author_a/author_page',
123
124
  email_address: 'email_a@email.com',
125
+ image: 'author_image.jpg',
124
126
  name: 'Author_A',
125
127
  image_object: {
126
128
  url: 'author_image.jpg',
@@ -220,7 +222,7 @@ describe('Schema Helper', () => {
220
222
  expect(json.primaryImageOfPage.inLanguage).toEqual('site_lang');
221
223
  expect(Object.prototype.toString.call(json.author)).toEqual('[object Object]');
222
224
  expect(json.author['@type']).toEqual('Person');
223
- expect(json.author.image).toEqual('author_image.jpg');
225
+ expect(json.author.image).toEqual('https://cdn.images.com/author_image.jpg');
224
226
  expect(Object.prototype.toString.call(json.author.knowsAbout)).toEqual('[object Array]');
225
227
  expect(json.author.knowsAbout).toHaveLength(2);
226
228
  expect(Object.prototype.toString.call(json.reviewedBy)).toEqual('[object Object]');
@@ -330,9 +332,41 @@ describe('Schema Helper', () => {
330
332
  featured_image_object: {
331
333
  url: 'featured_image/image.jpg',
332
334
  },
335
+ author_id: 112,
333
336
  author: {
334
- name: 'Very long name for the 100 characters Article Author test - ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ',
335
337
  profile_page_path: 'article_author/author_page',
338
+ email_address: 'email_a@email.com',
339
+ image: 'author_image.jpg',
340
+ name: 'Very long name for the 100 characters Article Author test - ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMN',
341
+ image_object: {
342
+ url: 'author_image.jpg',
343
+ },
344
+ knows_abouts: [
345
+ {
346
+ '@type': 'Thing',
347
+ name: 'Ireland',
348
+ links: [
349
+ {
350
+ link: 'www.test.com',
351
+ },
352
+ {
353
+ link: 'www.test2.com',
354
+ },
355
+ ],
356
+ },
357
+ {
358
+ '@type': 'Thing',
359
+ name: 'South Africa',
360
+ links: [
361
+ {
362
+ link: 'www.test.com',
363
+ },
364
+ {
365
+ link: 'www.test2.com',
366
+ },
367
+ ],
368
+ },
369
+ ],
336
370
  },
337
371
  siteInfo: {
338
372
  site_logo: 'logo.jpg',
@@ -379,9 +413,41 @@ describe('Schema Helper', () => {
379
413
  featured_image_object: {
380
414
  url: 'featured_image/image.jpg',
381
415
  },
416
+ author_id: 112,
382
417
  author: {
383
- name: 'Very long name for the 100 characters Article Author test - ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ',
418
+ name: 'Very long name for the 100 characters Article Author test - ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMN',
384
419
  profile_page_path: 'operator_review_author/author_page',
420
+ email_address: 'email_a@email.com',
421
+ image: 'author_image.jpg',
422
+ image_object: {
423
+ url: 'author_image.jpg',
424
+ },
425
+ knows_abouts: [
426
+ {
427
+ '@type': 'Thing',
428
+ name: 'Ireland',
429
+ links: [
430
+ {
431
+ link: 'www.test.com',
432
+ },
433
+ {
434
+ link: 'www.test2.com',
435
+ },
436
+ ],
437
+ },
438
+ {
439
+ '@type': 'Thing',
440
+ name: 'South Africa',
441
+ links: [
442
+ {
443
+ link: 'www.test.com',
444
+ },
445
+ {
446
+ link: 'www.test2.com',
447
+ },
448
+ ],
449
+ },
450
+ ],
385
451
  },
386
452
  siteInfo: {
387
453
  site_logo: 'logo.jpg',
@@ -434,9 +500,41 @@ describe('Schema Helper', () => {
434
500
  featured_image_object: {
435
501
  url: 'featured_image/image.jpg',
436
502
  },
503
+ author_id: 112,
437
504
  author: {
438
- name: 'Very long name for the 100 characters Article Author test - ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ',
505
+ name: 'Very long name for the 100 characters Article Author test - ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMN',
439
506
  profile_page_path: 'operator_review_author/author_page',
507
+ email_address: 'email_a@email.com',
508
+ image: 'author_image.jpg',
509
+ image_object: {
510
+ url: 'author_image.jpg',
511
+ },
512
+ knows_abouts: [
513
+ {
514
+ '@type': 'Thing',
515
+ name: 'Ireland',
516
+ links: [
517
+ {
518
+ link: 'www.test.com',
519
+ },
520
+ {
521
+ link: 'www.test2.com',
522
+ },
523
+ ],
524
+ },
525
+ {
526
+ '@type': 'Thing',
527
+ name: 'South Africa',
528
+ links: [
529
+ {
530
+ link: 'www.test.com',
531
+ },
532
+ {
533
+ link: 'www.test2.com',
534
+ },
535
+ ],
536
+ },
537
+ ],
440
538
  },
441
539
  siteInfo: {
442
540
  site_logo: 'logo.jpg',