gatsby-core-theme 2.2.4 → 2.2.5
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 +19 -0
- package/gatsby-node.esm.js +2 -1
- package/package.json +1 -1
- package/src/components/atoms/menu/items/item/item.module.scss +4 -0
- package/src/components/molecules/content/index.js +2 -1
- package/src/helpers/schema.js +30 -3
- package/src/helpers/schema.test.js +15 -6
- package/src/helpers/strings.js +10 -0
- package/src/helpers/strings.test.js +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
## [2.2.5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v2.2.4...v2.2.5) (2022-02-01)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* content images url changed to main cdn ([eb71334](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/eb71334aa843df6b68ff021b7bce89f72ba37cd7))
|
|
7
|
+
* navigation menu fix ([0ae522f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0ae522f85dc646e535787132770b415feb2c2ce7))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Code Refactoring
|
|
11
|
+
|
|
12
|
+
* update review publisher info in schema ([4be14d8](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/4be14d8d058af3132eabfc5f3d7edcb2b65ae2db))
|
|
13
|
+
* update schema publisher name with owned_by ([b1f41c3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b1f41c3161db39eb90afa11ff10584a5ed36e257))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
* Merge branch 'tm-2685-content-images-cdn' into 'master' ([426ae80](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/426ae80f987034558cb2503dfda17c5757859897))
|
|
17
|
+
* Merge branch 'tm-2670-update-schema-and-tests' into 'master' ([c8d60fb](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c8d60fb00dfbfdea9f335bc4d12ea1766df2b114))
|
|
18
|
+
* Merge branch 'navigation' into 'master' ([02eccb3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/02eccb39c3ea7f615fac6978950a25872c5f5df6))
|
|
19
|
+
|
|
1
20
|
## [2.2.4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v2.2.3...v2.2.4) (2022-01-27)
|
|
2
21
|
|
|
3
22
|
|
package/gatsby-node.esm.js
CHANGED
|
@@ -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)
|
package/package.json
CHANGED
|
@@ -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],
|
package/src/helpers/schema.js
CHANGED
|
@@ -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 = [
|
|
@@ -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
|
-
|
|
140
|
+
publishingPrinciples:
|
|
141
|
+
page.siteSchema?.publishing_principles || (isIL || isNSA ? publishingPrinciples : null),
|
|
122
142
|
logo: {
|
|
123
143
|
'@type': 'ImageObject',
|
|
124
144
|
url: pageImage,
|
|
@@ -207,8 +227,15 @@ export function templateSchemas(page, pageImage) {
|
|
|
207
227
|
},
|
|
208
228
|
publisher: {
|
|
209
229
|
'@type': 'Organization',
|
|
210
|
-
name:
|
|
211
|
-
|
|
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,
|
|
212
239
|
},
|
|
213
240
|
};
|
|
214
241
|
switch (page.type) {
|
|
@@ -232,6 +232,9 @@ describe('Schema Helper', () => {
|
|
|
232
232
|
name: 'Very long name for the 100 characters Article Author test - ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
|
233
233
|
profile_page_path: 'article_author/author_page',
|
|
234
234
|
},
|
|
235
|
+
siteInfo: {
|
|
236
|
+
site_logo: 'logo.jpg',
|
|
237
|
+
},
|
|
235
238
|
});
|
|
236
239
|
|
|
237
240
|
const json = parseCheckSchema(output);
|
|
@@ -255,8 +258,8 @@ describe('Schema Helper', () => {
|
|
|
255
258
|
|
|
256
259
|
expect(Object.prototype.toString.call(json.publisher)).toEqual('[object Object]');
|
|
257
260
|
expect(json.publisher['@type']).toEqual('Organization');
|
|
258
|
-
expect(json.publisher.name).
|
|
259
|
-
expect(json.publisher.logo).toEqual(
|
|
261
|
+
expect(json.publisher.name).toBeTruthy();
|
|
262
|
+
expect(json.publisher.logo).toEqual(`${process.env.IMAGE_CDN_URL}/logo.jpg`);
|
|
260
263
|
});
|
|
261
264
|
|
|
262
265
|
test('templateSchemas(operator)', () => {
|
|
@@ -278,6 +281,9 @@ describe('Schema Helper', () => {
|
|
|
278
281
|
name: 'Very long name for the 100 characters Article Author test - ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
|
279
282
|
profile_page_path: 'operator_review_author/author_page',
|
|
280
283
|
},
|
|
284
|
+
siteInfo: {
|
|
285
|
+
site_logo: 'logo.jpg',
|
|
286
|
+
},
|
|
281
287
|
extra_fields: {
|
|
282
288
|
operator_summary: 'Operator Review Summary',
|
|
283
289
|
},
|
|
@@ -310,8 +316,8 @@ describe('Schema Helper', () => {
|
|
|
310
316
|
|
|
311
317
|
expect(Object.prototype.toString.call(json.publisher)).toEqual('[object Object]');
|
|
312
318
|
expect(json.publisher['@type']).toEqual('Organization');
|
|
313
|
-
expect(json.publisher.name).
|
|
314
|
-
expect(json.publisher.logo).toEqual(
|
|
319
|
+
expect(json.publisher.name).toBeTruthy();
|
|
320
|
+
expect(json.publisher.logo).toEqual(`${process.env.IMAGE_CDN_URL}/logo.jpg`);
|
|
315
321
|
});
|
|
316
322
|
|
|
317
323
|
test('templateSchemas(game)', () => {
|
|
@@ -330,6 +336,9 @@ describe('Schema Helper', () => {
|
|
|
330
336
|
name: 'Very long name for the 100 characters Article Author test - ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
|
331
337
|
profile_page_path: 'operator_review_author/author_page',
|
|
332
338
|
},
|
|
339
|
+
siteInfo: {
|
|
340
|
+
site_logo: 'logo.jpg',
|
|
341
|
+
},
|
|
333
342
|
extra_fields: {
|
|
334
343
|
game_summary: 'Game Review Summary',
|
|
335
344
|
},
|
|
@@ -371,8 +380,8 @@ describe('Schema Helper', () => {
|
|
|
371
380
|
|
|
372
381
|
expect(Object.prototype.toString.call(json.review.publisher)).toEqual('[object Object]');
|
|
373
382
|
expect(json.review.publisher['@type']).toEqual('Organization');
|
|
374
|
-
expect(json.review.publisher.name).
|
|
375
|
-
expect(json.review.publisher.logo).toEqual(
|
|
383
|
+
expect(json.review.publisher.name).toBeTruthy();
|
|
384
|
+
expect(json.review.publisher.logo).toEqual(`${process.env.IMAGE_CDN_URL}/logo.jpg`);
|
|
376
385
|
});
|
|
377
386
|
|
|
378
387
|
test('schemaGenerator()', () => {
|
package/src/helpers/strings.js
CHANGED
|
@@ -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.split('//');
|
|
61
|
+
if (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
|
});
|