gatsby-core-theme 2.2.2 → 2.2.6

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 CHANGED
@@ -33,4 +33,6 @@ Theme Publish:
33
33
  only:
34
34
  refs:
35
35
  - master
36
+ variables:
37
+ - $PIPELINE != "content-trigger"
36
38
 
package/CHANGELOG.md CHANGED
@@ -1,3 +1,64 @@
1
+ ## [2.2.6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v2.2.5...v2.2.6) (2022-02-02)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * content image cdn ([3cbb875](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/3cbb8756406365dd24814f4212797c52298f4acb))
7
+
8
+ ## [2.2.5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v2.2.4...v2.2.5) (2022-02-01)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * content images url changed to main cdn ([eb71334](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/eb71334aa843df6b68ff021b7bce89f72ba37cd7))
14
+ * navigation menu fix ([0ae522f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0ae522f85dc646e535787132770b415feb2c2ce7))
15
+
16
+
17
+ ### Code Refactoring
18
+
19
+ * update review publisher info in schema ([4be14d8](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/4be14d8d058af3132eabfc5f3d7edcb2b65ae2db))
20
+ * update schema publisher name with owned_by ([b1f41c3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b1f41c3161db39eb90afa11ff10584a5ed36e257))
21
+
22
+
23
+ * Merge branch 'tm-2685-content-images-cdn' into 'master' ([426ae80](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/426ae80f987034558cb2503dfda17c5757859897))
24
+ * Merge branch 'tm-2670-update-schema-and-tests' into 'master' ([c8d60fb](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c8d60fb00dfbfdea9f335bc4d12ea1766df2b114))
25
+ * Merge branch 'navigation' into 'master' ([02eccb3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/02eccb39c3ea7f615fac6978950a25872c5f5df6))
26
+
27
+ ## [2.2.4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v2.2.3...v2.2.4) (2022-01-27)
28
+
29
+
30
+ ### Code Refactoring
31
+
32
+ * update matrix tracker generation with operators ([66f8c13](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/66f8c13ec89baeaf7da2127eefe3b3a6b75de404))
33
+ * update tracker generation for operators and providers ([9b0b738](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/9b0b73894b02c9bc1b4abdc480562e24c91231d7))
34
+
35
+
36
+ * Merge branch 'tm-2653-update-matrix-tracker-generation' into 'master' ([4af9022](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/4af9022aa570f864ac5bd5579aec281af9dfd3a6))
37
+
38
+ ## [2.2.3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v2.2.2...v2.2.3) (2022-01-25)
39
+
40
+
41
+ ### Code Refactoring
42
+
43
+ * update schema and tests ([ef8a496](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ef8a496552c50178349004d7d8695a39ef2f11d2))
44
+ * update schema for matrix sites with position and image ([e804f7b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/e804f7bef4b2a6a233e3ef14878f2afaf147996c))
45
+ * update templateSchemas publisher and breadcrumb position ([9dd4955](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/9dd495589a977cb5fa0e11d4411316330bbf7a80))
46
+
47
+
48
+ ### Config
49
+
50
+ * added content deploy pipeline ([6febaa4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/6febaa49d529191978358b3b61f034c7e057b013))
51
+ * added content deploy pipeline ([9f23f69](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/9f23f69108933e5c1ef48f31be0f0afef1872139))
52
+ * added content deploy pipeline ([d8c8147](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d8c814782c099890a01a26aa2f86fe9973c346f4))
53
+ * added content deploy pipeline ([2d31659](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/2d31659b0681f78633a5668c9f493a4f34d32f25))
54
+ * added content deploy pipeline ([c497607](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c49760723a860abc31906df31d5269dc3357c5ab))
55
+ * added content deploy pipeline ([e193c83](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/e193c83d3d17126a7c936a266939580906dab639))
56
+ * added content deploy pipeline ([4b43283](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/4b43283bff99d22093ebd019fcdd7831a61917de))
57
+
58
+
59
+ * Merge branch 'misc-update-schema-and-tests' into 'master' ([88111e6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/88111e62f2eff8fe742a0948f4f977ce4f236fa6))
60
+ * Merge branch 'master' of git.ilcd.rocks:team-floyd/themes/gatsby-themes ([7466000](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/74660006e597a5f7ff3a0d2856a6191e69ab69f3))
61
+
1
62
  ## [2.2.2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v2.2.1...v2.2.2) (2022-01-21)
2
63
 
3
64
 
@@ -198,7 +198,8 @@ exports.createPages = async ({ actions: { createPage } }, themeOptions) => {
198
198
  authors = response.authors;
199
199
 
200
200
  page.translations = {};
201
- // siteSchema and authors are added to page for schemaGenerator()
201
+ // siteInfo, siteSchema and authors are added to page for schemaGenerator()
202
+ page.siteInfo = siteInfo;
202
203
  page.siteSchema = siteSchema;
203
204
  page.authors = Object.keys(authors || {}).map((key) =>
204
205
  pick(authors[key], pickAuthorsPageKeys)
@@ -251,70 +252,68 @@ exports.createPages = async ({ actions: { createPage } }, themeOptions) => {
251
252
  },
252
253
  });
253
254
  }
255
+ });
256
+ });
257
+ });
254
258
 
255
- // Operator tracker pages
256
- if (page.type === 'operator') {
257
- const operator = operators[page.relation_id];
258
- const trackerLinks = Object.keys(page.relation.links);
259
- const tracker = trackerLinks.map((key) =>
260
- generateTrackerLink(page.relation, key).toLowerCase().replace(' ', '_')
261
- );
262
- tracker.forEach((trackerPath) => {
263
- // Create splash page
264
- const trackerPageObject = {
265
- meta_title: 'Tracker',
266
- template: 'tracker',
267
- title: 'Tracker',
268
- type: 'page',
269
- language: languageKey,
270
- path: trackerPath,
271
- meta_robots: ['noindex', 'nofollow'],
272
- };
273
- createPage({
274
- path: trackerPath,
275
- component: require.resolve('./src/components/app.js'),
276
- context: { page: trackerPageObject, operator, isTracker: true },
277
- });
259
+ if (themeOptions.siteType === 'sport') {
260
+ Object.keys(
261
+ (processed.relations &&
262
+ processed.relations.sports_data &&
263
+ processed.relations.sports_data.providers)
264
+ || {}
265
+ ).forEach((providerId) => {
266
+ const provider = processed.relations.sports_data.providers[providerId];
267
+ const tracker = generateTrackerLink(provider, 'main');
268
+ const trackerPageObject = {
269
+ meta_title: 'Tracker',
270
+ template: 'tracker',
271
+ title: 'Tracker',
272
+ type: 'page',
273
+ language: languageKey,
274
+ path: tracker,
275
+ meta_robots: ['noindex', 'nofollow'],
276
+ };
277
+ createPage({
278
+ path: tracker,
279
+ component: require.resolve('./src/components/app.js'),
280
+ context: {
281
+ page: trackerPageObject,
282
+ provider: provider,
283
+ isTracker: true,
284
+ },
285
+ });
286
+ });
287
+ } else {
288
+ Object.keys(operators || {}).forEach((operatorId) => {
289
+ const operator = operators[operatorId];
290
+ const trackerLinks = Object.keys(operator.links);
291
+ const tracker = trackerLinks.map((key) =>
292
+ operator.links[key]
293
+ ? generateTrackerLink(operator, key).toLowerCase().replace(' ', '_')
294
+ : null
295
+ );
296
+ tracker.forEach((trackerPath) => {
297
+ // Create splash page
298
+ if (trackerPath) {
299
+ const trackerPageObject = {
300
+ meta_title: 'Tracker',
301
+ template: 'tracker',
302
+ title: 'Tracker',
303
+ type: 'page',
304
+ language: languageKey,
305
+ path: trackerPath,
306
+ meta_robots: ['noindex', 'nofollow'],
307
+ };
308
+ createPage({
309
+ path: trackerPath,
310
+ component: require.resolve('./src/components/app.js'),
311
+ context: { page: trackerPageObject, operator, isTracker: true },
278
312
  });
279
313
  }
280
-
281
- // Provider tracker pages (sports sites)
282
- if (
283
- page.type === 'sport' ||
284
- (themeOptions.themeType === 'rage-seo' && page.template === 'live_stream_providers')
285
- ) {
286
- const { providers } = page.relation;
287
- if (providers && providers.length) {
288
- const providerData = providers.map((provider) => {
289
- const tracker = generateTrackerLink(provider, 'main');
290
- const providerObject = provider;
291
- return { tracker, providerObject };
292
- });
293
- providerData.forEach((provider) => {
294
- const trackerPageObject = {
295
- meta_title: 'Tracker',
296
- template: 'tracker',
297
- title: 'Tracker',
298
- type: 'page',
299
- language: languageKey,
300
- path: provider.tracker,
301
- meta_robots: ['noindex', 'nofollow'],
302
- };
303
- createPage({
304
- path: provider.tracker,
305
- component: require.resolve('./src/components/app.js'),
306
- context: {
307
- page: trackerPageObject,
308
- provider: provider.providerObject,
309
- isTracker: true,
310
- },
311
- });
312
- });
313
- }
314
- }
315
314
  });
316
315
  });
317
- });
316
+ }
318
317
  };
319
318
 
320
319
  exports.onCreatePage = ({ page, actions }) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "2.2.2",
3
+ "version": "2.2.6",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "main": "index.js",
6
6
  "GATSBY_RECAPTCHA_SITEKEY": "6LfoyvMUAAAAAO4nl_MQnqHb4XdHxEiu5cXgIqeB",
@@ -10,6 +10,10 @@
10
10
  .item {
11
11
  padding: 1.5rem 2rem;
12
12
 
13
+ @include custom-min-max(1200, 1260) {
14
+ padding: 1.5rem 1.8rem;
15
+ }
16
+
13
17
  &.openedLink {
14
18
  background-color: var(--primary-hover-color);
15
19
  }
@@ -7,6 +7,7 @@ import parse from 'html-react-parser';
7
7
  import loadable from '@loadable/component';
8
8
  import LazyImage from '~hooks/lazy-image';
9
9
  import { parseCss } from '~helpers/css-parser';
10
+ import { parseContentImageUrl } from '~helpers/strings';
10
11
  import styles from './content.module.scss';
11
12
 
12
13
  const Content = ({ module, pageContext = null }) => {
@@ -32,7 +33,7 @@ const Content = ({ module, pageContext = null }) => {
32
33
  }
33
34
 
34
35
  const lazyProps = {
35
- src: node.attribs.src,
36
+ src: parseContentImageUrl(node.attribs.src),
36
37
  style: node.attribs.style ? parseCss(node.attribs.style) : null,
37
38
  alt: node.attribs.alt ? node.attribs.alt : 'missing alt',
38
39
  className: styles[stylesClass],
@@ -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 === 'Irishluck.ie';
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'
@@ -41,6 +41,25 @@ const knowsAbout = [
41
41
  ],
42
42
  },
43
43
  ];
44
+ const customSchema = {
45
+ // Matrix
46
+ 'playcasino.co.za': 'Playcasino',
47
+ 'norskespilleautomater.com': 'Norske Spilleautomater',
48
+ 'irishluck.ie': 'Irish Luck',
49
+ // Rage PPC
50
+ 'bekijksport.nl': 'Bekijk Sport',
51
+ 'bestsports.gr': 'Best Sports',
52
+ 'sesport.dk': 'Se Sport',
53
+ 'watchfooty.co.uk': 'WatchFooty',
54
+ // Rage SEO
55
+ 'fotballstreams.com': 'Fotball Streams',
56
+ 'fussballstreams.com': 'Fussball Streams',
57
+ 'livefotbollonline.se': 'Live Fotboll Online',
58
+ 'livestreamsvoetbal.nl': 'Live Streams Voetbal',
59
+ 'sefodbold.dk': 'Se Fodbold',
60
+ 'verfutbolonline.net': 'Ver Futbol Online',
61
+ 'watchsport.gr': 'Watch Sport',
62
+ };
44
63
  /* HardCoded End */
45
64
 
46
65
  const socialLinks = [
@@ -86,7 +105,7 @@ export function breadcrumbsSchema(breadcrumbs) {
86
105
  itemListElement: breadcrumbs.map((breadcrumb, index) => ({
87
106
  '@type': 'ListItem',
88
107
  name: breadcrumb.path,
89
- position: index,
108
+ position: index + 1,
90
109
  item: {
91
110
  '@id': `${getUrl(breadcrumb.path)}#webpage`,
92
111
  },
@@ -118,7 +137,8 @@ export function webPageSchema(page, pageImage) {
118
137
  name: page.siteSchema?.site_name || '',
119
138
  alternateName: page.siteSchema?.alias_site_name || '',
120
139
  foundingDate: page.siteSchema?.organization_founding_date || '',
121
- ...(isIL || isNSA ? { publishingPrinciples } : {}),
140
+ publishingPrinciples:
141
+ page.siteSchema?.publishing_principles || (isIL || isNSA ? publishingPrinciples : null),
122
142
  logo: {
123
143
  '@type': 'ImageObject',
124
144
  url: pageImage,
@@ -198,14 +218,32 @@ export function moduleSchemas(modules) {
198
218
  return filteredSchema;
199
219
  }
200
220
 
201
- export function templateSchemas(page) {
221
+ export function templateSchemas(page, pageImage) {
222
+ const sharedProps = {
223
+ author: {
224
+ '@type': 'Person',
225
+ name: page.author?.name?.substring(0, 100),
226
+ url: getUrl(page.author?.profile_page_path || '/'),
227
+ },
228
+ publisher: {
229
+ '@type': 'Organization',
230
+ name:
231
+ page.siteSchema?.owned_by ||
232
+ customSchema[process.env.GATSBY_SITE_NAME] ||
233
+ page.siteInfo?.site_name ||
234
+ process.env.GATSBY_SITE_NAME,
235
+ logo:
236
+ `${process.env.IMAGE_CDN_URL}/${page.siteInfo?.site_logo}` ||
237
+ page.featured_image_object?.url ||
238
+ pageImage,
239
+ },
240
+ };
202
241
  switch (page.type) {
203
242
  case 'article': {
204
243
  const schema = {
205
244
  '@context': 'https://schema.org',
206
245
  '@type': 'Article',
207
246
  url: getUrl(page.path),
208
- image: page.featured_image_object?.url,
209
247
  headline: page.title,
210
248
  datePublished: page.created_at,
211
249
  dateModified: page.updated_at,
@@ -213,15 +251,7 @@ export function templateSchemas(page) {
213
251
  '@type': 'WebPage',
214
252
  url: process.env.GATSBY_SITE_URL,
215
253
  },
216
- author: {
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
- },
254
+ ...sharedProps,
225
255
  };
226
256
 
227
257
  return JSON.stringify(generateSchemaObject(schema));
@@ -244,19 +274,7 @@ export function templateSchemas(page) {
244
274
  worstRating: '0',
245
275
  ratingValue: page.relation?.rating?.toString() || '',
246
276
  },
247
- author: {
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
- },
277
+ ...sharedProps,
260
278
  };
261
279
 
262
280
  return JSON.stringify(generateSchemaObject(schema));
@@ -269,7 +287,6 @@ export function templateSchemas(page) {
269
287
  url: getUrl(page.path),
270
288
  name: page.relation?.name || '',
271
289
  description: page.extra_fields?.game_summary || '',
272
- image: page.featured_image_object?.url,
273
290
  operatingSystem: 'Multi-platform',
274
291
  applicationCategory: ['Game'],
275
292
  author: {
@@ -279,22 +296,14 @@ export function templateSchemas(page) {
279
296
  },
280
297
  review: {
281
298
  '@type': 'Review',
282
- name: 'TODO - Review Name',
299
+ name: page.relation?.name || '',
283
300
  reviewRating: {
284
301
  '@type': 'Rating',
285
302
  bestRating: '10',
286
303
  worstRating: '0',
287
304
  ratingValue: rating?.toString() || '',
288
305
  },
289
- author: {
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
- },
306
+ ...sharedProps,
298
307
  },
299
308
  };
300
309
 
@@ -314,7 +323,7 @@ export function schemaGenerator(page = {}, pageImage) {
314
323
  // Modules Schemas
315
324
  webPageSchema(page, pageImage),
316
325
  organizationSchema(page, pageImage),
317
- templateSchemas(page),
326
+ templateSchemas(page, pageImage),
318
327
  ...(page.sections?.main?.modules ? moduleSchemas(page.sections.main.modules) : [null]),
319
328
  ];
320
329
 
@@ -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(0);
29
- expect(json.itemListElement[1].position).toEqual(1);
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
- expect(json.author.publishingPrinciples).toEqual(
99
- 'https://www.norskespilleautomater.com/om-oss/prinsipper'
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
- expect(Object.prototype.toString.call(json.author.knowsAbout)).toEqual('[object Array]');
128
- expect(json.author.knowsAbout).toHaveLength(4);
129
- expect(Object.prototype.toString.call(json.author.knowsAbout[0])).toEqual('[object Object]');
130
- expect(json.author.knowsAbout[0]['@type']).toEqual('Thing');
131
- expect(json.author.knowsAbout[0].name).toEqual('Norway');
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);
@@ -220,12 +232,14 @@ describe('Schema Helper', () => {
220
232
  name: 'Very long name for the 100 characters Article Author test - ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ',
221
233
  profile_page_path: 'article_author/author_page',
222
234
  },
235
+ siteInfo: {
236
+ site_logo: 'logo.jpg',
237
+ },
223
238
  });
224
239
 
225
240
  const json = parseCheckSchema(output);
226
241
  expect(json['@type']).toEqual('Article');
227
242
  expect(json.url).toEqual(getUrl('article_page'));
228
- expect(json.image).toEqual('featured_image/image.jpg');
229
243
  expect(json.headline).toEqual('Article Title');
230
244
  expect(json.datePublished).toEqual('01/01/01');
231
245
  expect(json.dateModified).toEqual('02/02/02');
@@ -244,7 +258,8 @@ describe('Schema Helper', () => {
244
258
 
245
259
  expect(Object.prototype.toString.call(json.publisher)).toEqual('[object Object]');
246
260
  expect(json.publisher['@type']).toEqual('Organization');
247
- expect(json.publisher.name).toEqual(process.env.GATSBY_SITE_NAME);
261
+ expect(json.publisher.name).toBeTruthy();
262
+ expect(json.publisher.logo).toEqual(`${process.env.IMAGE_CDN_URL}/logo.jpg`);
248
263
  });
249
264
 
250
265
  test('templateSchemas(operator)', () => {
@@ -266,6 +281,9 @@ describe('Schema Helper', () => {
266
281
  name: 'Very long name for the 100 characters Article Author test - ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ',
267
282
  profile_page_path: 'operator_review_author/author_page',
268
283
  },
284
+ siteInfo: {
285
+ site_logo: 'logo.jpg',
286
+ },
269
287
  extra_fields: {
270
288
  operator_summary: 'Operator Review Summary',
271
289
  },
@@ -298,20 +316,16 @@ describe('Schema Helper', () => {
298
316
 
299
317
  expect(Object.prototype.toString.call(json.publisher)).toEqual('[object Object]');
300
318
  expect(json.publisher['@type']).toEqual('Organization');
301
- 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');
319
+ expect(json.publisher.name).toBeTruthy();
320
+ expect(json.publisher.logo).toEqual(`${process.env.IMAGE_CDN_URL}/logo.jpg`);
306
321
  });
307
322
 
308
323
  test('templateSchemas(game)', () => {
309
324
  const output = Schema.templateSchemas({
310
325
  type: 'game',
311
326
  path: 'game_page',
312
- title: 'Operator Title',
313
327
  relation: {
314
- name: 'Operator Relation Name',
328
+ name: 'Game Relation Name',
315
329
  first_rating: 3.5,
316
330
  third_rating: 1.5,
317
331
  },
@@ -322,6 +336,9 @@ describe('Schema Helper', () => {
322
336
  name: 'Very long name for the 100 characters Article Author test - ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ',
323
337
  profile_page_path: 'operator_review_author/author_page',
324
338
  },
339
+ siteInfo: {
340
+ site_logo: 'logo.jpg',
341
+ },
325
342
  extra_fields: {
326
343
  game_summary: 'Game Review Summary',
327
344
  },
@@ -330,9 +347,8 @@ describe('Schema Helper', () => {
330
347
  const json = parseCheckSchema(output);
331
348
  expect(json['@type']).toEqual('VideoGame');
332
349
  expect(json.url).toEqual(getUrl('game_page'));
333
- expect(json.name).toEqual('Operator Relation Name');
350
+ expect(json.name).toEqual('Game Relation Name');
334
351
  expect(json.description).toEqual('Game Review Summary');
335
- expect(json.image).toEqual('featured_image/image.jpg');
336
352
  expect(json.operatingSystem).toEqual('Multi-platform');
337
353
 
338
354
  expect(Object.prototype.toString.call(json.applicationCategory)).toEqual('[object Array]');
@@ -346,7 +362,7 @@ describe('Schema Helper', () => {
346
362
 
347
363
  expect(Object.prototype.toString.call(json.review)).toEqual('[object Object]');
348
364
  expect(json.review['@type']).toEqual('Review');
349
- expect(json.review.name).toEqual('TODO - Review Name');
365
+ expect(json.review.name).toEqual('Game Relation Name');
350
366
 
351
367
  expect(Object.prototype.toString.call(json.review.reviewRating)).toEqual('[object Object]');
352
368
  expect(json.review.reviewRating['@type']).toEqual('Rating');
@@ -364,7 +380,8 @@ describe('Schema Helper', () => {
364
380
 
365
381
  expect(Object.prototype.toString.call(json.review.publisher)).toEqual('[object Object]');
366
382
  expect(json.review.publisher['@type']).toEqual('Organization');
367
- expect(json.review.publisher.name).toEqual(process.env.GATSBY_SITE_NAME);
383
+ expect(json.review.publisher.name).toBeTruthy();
384
+ expect(json.review.publisher.logo).toEqual(`${process.env.IMAGE_CDN_URL}/logo.jpg`);
368
385
  });
369
386
 
370
387
  test('schemaGenerator()', () => {
@@ -55,3 +55,13 @@ export function truncateString(str, num, dots = '...') {
55
55
  export function cleanHTML(string) {
56
56
  return string && string.replace(/(<([^>]+)>)/gi, '');
57
57
  }
58
+
59
+ export function parseContentImageUrl(src) {
60
+ const srcArr = src && src.split('//');
61
+ if (srcArr && srcArr.length === 2) {
62
+ const refUrl = srcArr[1].substring(srcArr[1].indexOf('/'));
63
+ return process.env.IMAGE_CDN_URL + refUrl;
64
+ }
65
+
66
+ return src;
67
+ }
@@ -33,4 +33,12 @@ describe('Strings Helper', () => {
33
33
  test('cleanHTML()', () => {
34
34
  expect(Strings.cleanHTML('<p>hello <a>i</a> think</p>')).toEqual('hello i think');
35
35
  });
36
+
37
+ test('parseContentImageUrl()', () => {
38
+ expect(
39
+ Strings.parseContentImageUrl(
40
+ 'https://assets-srv.s3.eu-west-1.amazonaws.com/irishluck-jackpot.jpeg'
41
+ )
42
+ ).toEqual('https://cdn.images.com/irishluck-jackpot.jpeg');
43
+ });
36
44
  });