gatsby-core-theme 2.1.0 → 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 +81 -0
- package/gatsby-node.esm.js +2 -22
- package/package.json +1 -1
- package/src/components/atoms/disclaimer/disclaimer.test.js +2 -2
- package/src/components/atoms/disclaimer/index.js +37 -16
- package/src/components/atoms/menu/items/item/index.js +7 -3
- package/src/components/molecules/counter/index.js +2 -2
- package/src/components/organisms/anchor/anchor.module.scss +17 -4
- package/src/components/organisms/anchor/index.js +3 -11
- package/src/components/organisms/cards/cards.module.scss +2 -0
- package/src/helpers/generators.js +3 -3
- package/src/helpers/generators.test.js +1 -1
- package/src/helpers/processor/common.js +1 -1
- package/src/helpers/processor/index.js +27 -1
- package/src/helpers/processor/modules.js +17 -11
- 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,84 @@
|
|
|
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
|
+
|
|
25
|
+
## [2.2.2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v2.2.1...v2.2.2) (2022-01-21)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Bug Fixes
|
|
29
|
+
|
|
30
|
+
* dmca url fix ([778e0a6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/778e0a6ed1fc4828e165203c090d3cf26f3ac1a9))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
* Merge branch 'master' of git.ilcd.rocks:team-floyd/themes/gatsby-themes ([cf5e415](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/cf5e4157bc7a75842dbf9f71c34501bd631b111f))
|
|
34
|
+
|
|
35
|
+
## [2.2.1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v2.2.0...v2.2.1) (2022-01-20)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
### Bug Fixes
|
|
39
|
+
|
|
40
|
+
* dmca badge now using env var for id ([bc65104](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/bc651049d3a435ee0cbf4b7f2bd418a300609fc8))
|
|
41
|
+
|
|
42
|
+
# [2.2.0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v2.1.0...v2.2.0) (2022-01-18)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### Bug Fixes
|
|
46
|
+
|
|
47
|
+
* add track background color ([8886659](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/888665908dc7a97e008d42321e1a61482d1d31d8))
|
|
48
|
+
* add variable thumb-color ([7d0d1da](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/7d0d1da9f6244573fa38dca0fbc463ceb0e5840d))
|
|
49
|
+
* dmca ([a320701](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a320701a80b61e1a354fcc295f531d763b683261))
|
|
50
|
+
* fixes ([3886daf](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/3886daf5e8771ae69e4379a440ed944b23d39ae6))
|
|
51
|
+
* menu item, cards row gap ([6fca1e4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/6fca1e4f9117bd0d84c143ba57eb0531b467327b))
|
|
52
|
+
* menu item, cards row gap ([cd319ca](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/cd319ca0f4efa1845e5cf2df1e22644dd366e312))
|
|
53
|
+
* placeholder ([8c9b5bd](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/8c9b5bdaef7173406689e3e210e586b237d46ba3))
|
|
54
|
+
* relocate placeholders to processor ([96c17f6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/96c17f636abc652013d0bf396b3a496a167748ea))
|
|
55
|
+
* removed slider from anchor module ([185975f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/185975f75a3f6a592a4477d772ccf148e17e07ce))
|
|
56
|
+
* small fixes ([cc29dfa](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/cc29dfa365105bbaae1b14c0b9641d2d936c1ffe))
|
|
57
|
+
* use generateplaceholder for sitemap titles ([9e3ef4e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/9e3ef4ee5f8f0c5dff129f2da8a50f3997215feb))
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
### Code Refactoring
|
|
61
|
+
|
|
62
|
+
* move replacePlaceholder to gatsby node esm ([9eb9d84](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/9eb9d842f2ef1496550348a502d1323ce1552475))
|
|
63
|
+
* update counter li key prop ([8796b36](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/8796b361618e44347e1250943e2d31a6b8977b09))
|
|
64
|
+
* update generators tests ([39dd1f5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/39dd1f5e24f7e79abbaf98793be83ede80ca7a14))
|
|
65
|
+
* update placeholder generation in gatsby-node.esm, processSitemapPages and generatePlaceholderString ([52ae3fe](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/52ae3fe551d4520296be05302df58a1880f46970))
|
|
66
|
+
* update processSitemapPages for tests and remove generatePlaceholderString import ([3b73cb8](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/3b73cb84a2d4d00ceb625aa0f21a4416990dfc34))
|
|
67
|
+
* update siteInfo check for node process ([6940762](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/69407626dda1f4541b86589c2f738929363ddb09))
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
* Merge branch 'tm-2625-dmca' into 'master' ([d75e192](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d75e1927e5c8eac06426c43b5e18396202359b72))
|
|
71
|
+
* Merge branch 'tm-2654-minor-fixes' into 'master' ([d207bd6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d207bd6a376d390714c157f82f98ccdca3334844))
|
|
72
|
+
* Merge branch 'tm-2656-placeholder' into 'master' ([92d1b1b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/92d1b1b36f733f9b880750b36aa710bd5bba536a))
|
|
73
|
+
* Merge branch 'tm-2557-cards-v2-changes' into 'master' ([bd5c28f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/bd5c28f764cb38a949d0638d6bf4782a7ad9de14))
|
|
74
|
+
* Merge branch 'tm-2655-anchor-module' into 'master' ([4748e7a](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/4748e7a8458003eea7c8dd0c163fb338dcd2f173))
|
|
75
|
+
* Merge branch 'tm-2656-fix-placeholders' into 'master' ([b8a06f3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b8a06f3cc24fc39df0ca949c404c41ed69a13ad8))
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
### Features
|
|
79
|
+
|
|
80
|
+
* cards v2 filters cvhanges ([b0f3a96](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b0f3a96cc784fcf432cee9c14b63574df362e05f))
|
|
81
|
+
|
|
1
82
|
# [2.1.0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v2.0.19...v2.1.0) (2022-01-13)
|
|
2
83
|
|
|
3
84
|
|
package/gatsby-node.esm.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { cloneDeep, chunk, pick } from 'lodash';
|
|
6
6
|
import chalk from 'chalk';
|
|
7
7
|
import { getData, getLocalData } from './src/helpers/api';
|
|
8
|
-
import {
|
|
8
|
+
import { generateTrackerLink } from './src/helpers/generators';
|
|
9
9
|
import processor, { processSitemapPages } from './src/helpers/processor';
|
|
10
10
|
import { pickAuthorsPageKeys } from './src/constants/pick-keys';
|
|
11
11
|
|
|
@@ -150,13 +150,13 @@ exports.createPages = async ({ actions: { createPage } }, themeOptions) => {
|
|
|
150
150
|
// add data to modules
|
|
151
151
|
const processed = processor.run(response, themeOptions, fs);
|
|
152
152
|
pages = processed.pages;
|
|
153
|
-
htmlSitemapPages = processSitemapPages(pages, processed.site_markets);
|
|
154
153
|
siteInfo = processed.general;
|
|
155
154
|
operators = processed.relations.operator;
|
|
156
155
|
templates = processed.templates;
|
|
157
156
|
// eslint-disable-next-line prefer-destructuring
|
|
158
157
|
languageKey = Object.keys(processed.relations.translations)[0];
|
|
159
158
|
translations = processed.relations.translations[languageKey];
|
|
159
|
+
htmlSitemapPages = processSitemapPages(pages, processed.site_markets);
|
|
160
160
|
|
|
161
161
|
if (themeOptions.siteType === 'sport') {
|
|
162
162
|
sports = Object.keys(response.relations['sports_data'].sports).map(
|
|
@@ -204,26 +204,6 @@ exports.createPages = async ({ actions: { createPage } }, themeOptions) => {
|
|
|
204
204
|
pick(authors[key], pickAuthorsPageKeys)
|
|
205
205
|
);
|
|
206
206
|
|
|
207
|
-
// replacing string placehoders with year, month, date, etc.
|
|
208
|
-
page.title =
|
|
209
|
-
page.title &&
|
|
210
|
-
generatePlaceholderString(page.title, translations, {
|
|
211
|
-
siteName: response.general.site_name,
|
|
212
|
-
siteTitle: page.title,
|
|
213
|
-
});
|
|
214
|
-
page.meta_title =
|
|
215
|
-
page.meta_title &&
|
|
216
|
-
generatePlaceholderString(page.meta_title, translations, {
|
|
217
|
-
siteName: response.general.site_name,
|
|
218
|
-
siteTitle: page.title,
|
|
219
|
-
});
|
|
220
|
-
page.meta_description =
|
|
221
|
-
page.meta_description &&
|
|
222
|
-
generatePlaceholderString(page.meta_description, translations, {
|
|
223
|
-
siteName: response.general.site_name,
|
|
224
|
-
siteTitle: page.title,
|
|
225
|
-
});
|
|
226
|
-
|
|
227
207
|
if (hasArchiveModule(page)) {
|
|
228
208
|
createArchivePage(page, marketSections, prefilledModules, createPage);
|
|
229
209
|
return;
|
package/package.json
CHANGED
|
@@ -15,8 +15,8 @@ const dmcaImg = (
|
|
|
15
15
|
describe('Disclaimer Component', () => {
|
|
16
16
|
test('render disclaimer badge', () => {
|
|
17
17
|
const { container } = render(<Disclaimer image={dmcaImg} />);
|
|
18
|
-
expect(container.querySelectorAll('
|
|
19
|
-
expect(container.
|
|
18
|
+
expect(container.querySelectorAll('a')).toHaveLength(1);
|
|
19
|
+
expect(container.querySelectorAll('img')).toHaveLength(1);
|
|
20
20
|
});
|
|
21
21
|
});
|
|
22
22
|
afterEach(() => {
|
|
@@ -1,21 +1,42 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable no-return-assign */
|
|
2
|
+
/* eslint-disable no-plusplus */
|
|
3
|
+
/* eslint-disable no-var */
|
|
4
|
+
import React, { useRef } from 'react';
|
|
2
5
|
import PropTypes from 'prop-types';
|
|
3
|
-
import LazyLoad from 'react-lazyload';
|
|
4
6
|
|
|
5
|
-
const Disclaimer = ({ image }) =>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
7
|
+
const Disclaimer = ({ image }) => {
|
|
8
|
+
const anchorElement = useRef(null);
|
|
9
|
+
|
|
10
|
+
function dmca() {
|
|
11
|
+
document.addEventListener(
|
|
12
|
+
'click',
|
|
13
|
+
() => {
|
|
14
|
+
const element = anchorElement.current;
|
|
15
|
+
if (element.getAttribute('href').indexOf('refurl') < 0) {
|
|
16
|
+
element.href = `${`${
|
|
17
|
+
element.href + (element.href.indexOf('?') === -1 ? '?' : '&')
|
|
18
|
+
}refurl`}=${document.location.href.replace(/\/$/, '')}`;
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
false
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<>
|
|
27
|
+
<a
|
|
28
|
+
ref={anchorElement}
|
|
29
|
+
onClick={dmca}
|
|
30
|
+
href={`//www.dmca.com/Protection/Status.aspx?ID=${process.env.DMCA_PROTECTION_ID}`}
|
|
31
|
+
title="DMCA.com Protection Status"
|
|
32
|
+
target="_blank"
|
|
33
|
+
rel="noreferrer"
|
|
34
|
+
>
|
|
35
|
+
{image}
|
|
36
|
+
</a>
|
|
37
|
+
</>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
19
40
|
|
|
20
41
|
export default Disclaimer;
|
|
21
42
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable no-nested-ternary */
|
|
1
2
|
import React, { useState, useEffect, useContext } from 'react';
|
|
2
3
|
import PropTypes from 'prop-types';
|
|
3
4
|
import Link from '~hooks/link';
|
|
@@ -63,7 +64,7 @@ export default function Item({
|
|
|
63
64
|
{item.value?.includes('http') || item.value?.includes('www') ? (
|
|
64
65
|
<a
|
|
65
66
|
aria-label={`${item?.title} link`}
|
|
66
|
-
href={item.value}
|
|
67
|
+
href={item.value ? item.value : '#'}
|
|
67
68
|
title={item.title}
|
|
68
69
|
rel={`noreferrer ${item.nofollow && 'nofollow'}`}
|
|
69
70
|
target="_blank"
|
|
@@ -78,7 +79,7 @@ export default function Item({
|
|
|
78
79
|
<ItemImage />
|
|
79
80
|
{item.title}
|
|
80
81
|
</a>
|
|
81
|
-
) : (
|
|
82
|
+
) : item.value !== null ? (
|
|
82
83
|
<Link
|
|
83
84
|
className={`${gtmClass} ${styles.item} ${opened && styles.openedLink} ${active} ${
|
|
84
85
|
!options.mobile.subMenuDropDownButton && isMobile && hasChildren
|
|
@@ -87,7 +88,8 @@ export default function Item({
|
|
|
87
88
|
} ${hasChildren ? styles.hasChildren : ''} ${
|
|
88
89
|
!options.mobile.subMenuDropDownButton ? styles.noDropDownButton : ''
|
|
89
90
|
}`}
|
|
90
|
-
|
|
91
|
+
disabled={item.value === null}
|
|
92
|
+
to={item.value}
|
|
91
93
|
title={item.title}
|
|
92
94
|
rel={item.nofollow && 'nofollow'}
|
|
93
95
|
aria-label={`${item?.title} link`}
|
|
@@ -96,6 +98,8 @@ export default function Item({
|
|
|
96
98
|
<ItemImage />
|
|
97
99
|
{item.title}
|
|
98
100
|
</Link>
|
|
101
|
+
) : (
|
|
102
|
+
<div className={styles.item}>{item.title}</div>
|
|
99
103
|
)}
|
|
100
104
|
{options.mobile.subMenuDropDownButton && isMobile && hasChildren && (
|
|
101
105
|
<button
|
|
@@ -1,13 +1,26 @@
|
|
|
1
|
-
.
|
|
1
|
+
.anchor {
|
|
2
|
+
@include flex-direction(row);
|
|
3
|
+
&::-webkit-scrollbar {
|
|
4
|
+
height: 0.5rem;
|
|
5
|
+
}
|
|
6
|
+
&::-webkit-scrollbar-track {
|
|
7
|
+
background: var(--anchor-track-color);
|
|
8
|
+
}
|
|
9
|
+
&::-webkit-scrollbar-thumb {
|
|
10
|
+
background: var(--anchor-thumb-color);
|
|
11
|
+
}
|
|
12
|
+
overflow-x: scroll;
|
|
2
13
|
.link {
|
|
3
14
|
word-break: inherit;
|
|
4
15
|
white-space: nowrap;
|
|
5
|
-
|
|
16
|
+
margin-bottom: 0.5rem;
|
|
6
17
|
background-color: var(--color-7);
|
|
7
18
|
padding: 1rem 2.5rem;
|
|
8
19
|
border-radius: 0.6rem;
|
|
9
20
|
color: #000;
|
|
10
21
|
font-weight: 400;
|
|
22
|
+
margin-right: 1.6rem;
|
|
23
|
+
margin-bottom: 0.5rem;
|
|
11
24
|
|
|
12
25
|
&:hover {
|
|
13
26
|
background-color: var(--secondary-color);
|
|
@@ -15,10 +28,10 @@
|
|
|
15
28
|
}
|
|
16
29
|
}
|
|
17
30
|
}
|
|
18
|
-
.storyDivs{
|
|
31
|
+
.storyDivs {
|
|
19
32
|
width: 100%;
|
|
20
33
|
display: block;
|
|
21
34
|
margin: 3rem 0;
|
|
22
35
|
background-color: #eee;
|
|
23
36
|
padding: 2rem;
|
|
24
|
-
}
|
|
37
|
+
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
|
|
4
|
-
import Slider from '~molecules/slider';
|
|
5
4
|
import keygen from '~helpers/keygen';
|
|
6
5
|
import { anchorLink } from '~helpers/strings';
|
|
7
6
|
import styles from './anchor.module.scss';
|
|
8
7
|
|
|
9
|
-
function Anchor({ module: { items }, headerOffset = 80
|
|
8
|
+
function Anchor({ module: { items }, headerOffset = 80 }) {
|
|
10
9
|
const handleClick = (event) => {
|
|
11
10
|
event.preventDefault();
|
|
12
11
|
const scrollToElementId = event.currentTarget.getAttribute('href').replace('#', '');
|
|
@@ -23,13 +22,7 @@ function Anchor({ module: { items }, headerOffset = 80, sliderGap = 0 }) {
|
|
|
23
22
|
};
|
|
24
23
|
|
|
25
24
|
return (
|
|
26
|
-
<
|
|
27
|
-
useArrows={false}
|
|
28
|
-
usePagination={false}
|
|
29
|
-
settings={{ numberOfSlides: 0, sliderGap }}
|
|
30
|
-
className={styles.sliderWrapper}
|
|
31
|
-
gtmClass="anchor-carousel-gtm"
|
|
32
|
-
>
|
|
25
|
+
<div className={styles.anchor} gtmClass="anchor-carousel-gtm">
|
|
33
26
|
{items.map((anchor) => (
|
|
34
27
|
<a
|
|
35
28
|
className={`${styles.link} anchor-carousel-gtm anchor-menu-gtm`}
|
|
@@ -40,7 +33,7 @@ function Anchor({ module: { items }, headerOffset = 80, sliderGap = 0 }) {
|
|
|
40
33
|
{anchor?.label}
|
|
41
34
|
</a>
|
|
42
35
|
))}
|
|
43
|
-
</
|
|
36
|
+
</div>
|
|
44
37
|
);
|
|
45
38
|
}
|
|
46
39
|
|
|
@@ -53,7 +46,6 @@ Anchor.propTypes = {
|
|
|
53
46
|
),
|
|
54
47
|
}).isRequired,
|
|
55
48
|
headerOffset: PropTypes.number.isRequired,
|
|
56
|
-
sliderGap: PropTypes.number,
|
|
57
49
|
styles: PropTypes.shape({}),
|
|
58
50
|
};
|
|
59
51
|
|
|
@@ -21,7 +21,7 @@ export function generateTrackerLink(operator, trackerType) {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
export function generatePlaceholderString(string, translations,
|
|
24
|
+
export function generatePlaceholderString(string = '', translations, data) {
|
|
25
25
|
const date = new Date();
|
|
26
26
|
const day = date.getDate();
|
|
27
27
|
const month = months[date.getMonth()];
|
|
@@ -38,8 +38,8 @@ export function generatePlaceholderString(string, translations, props) {
|
|
|
38
38
|
'[currentdate]': `${(translations && translations[month]) || month} ${day}, ${year}`,
|
|
39
39
|
'[currentmonth]': (translations && translations[month]) || month,
|
|
40
40
|
'[currentyear]': year,
|
|
41
|
-
'[sitename]': (
|
|
42
|
-
'[title]': (
|
|
41
|
+
'[sitename]': (data && data.siteName) || '',
|
|
42
|
+
'[title]': (data && data.pageTitle) || '',
|
|
43
43
|
}[match])
|
|
44
44
|
);
|
|
45
45
|
}
|
|
@@ -4,7 +4,7 @@ import settings from '../../constants/settings';
|
|
|
4
4
|
// eslint-disable-next-line import/no-cycle
|
|
5
5
|
import { processExtraFields } from '.';
|
|
6
6
|
|
|
7
|
-
export function groupBy(list, keyName = 'author_id', single = false) {
|
|
7
|
+
export function groupBy(list = {}, keyName = 'author_id', single = false) {
|
|
8
8
|
const newObj = Object.values(list).reduce((acc, currentVal) => {
|
|
9
9
|
if (!acc[currentVal[keyName]]) {
|
|
10
10
|
acc[currentVal[keyName]] = [];
|
|
@@ -8,7 +8,7 @@ import chalk from 'chalk';
|
|
|
8
8
|
import ModuleValue from '../../constants/module-value';
|
|
9
9
|
import SearchTypesEnable from '../../constants/search-types-enable';
|
|
10
10
|
import { pickHTMLSitemapPageKeys } from '../../constants/pick-keys';
|
|
11
|
-
|
|
11
|
+
import { generatePlaceholderString } from '../generators';
|
|
12
12
|
// eslint-disable-next-line import/no-cycle
|
|
13
13
|
import { processModule } from './modules';
|
|
14
14
|
// eslint-disable-next-line import/no-cycle
|
|
@@ -131,6 +131,31 @@ export function processExtraFields(extraFields) {
|
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
+
function updatePlaceholders(page, data) {
|
|
135
|
+
const languageKey = Object.keys(data.relations.translations)[0];
|
|
136
|
+
const translations = data.relations.translations[languageKey];
|
|
137
|
+
|
|
138
|
+
// replacing string placehoders with year, month, date, etc.
|
|
139
|
+
page.title =
|
|
140
|
+
page.title &&
|
|
141
|
+
generatePlaceholderString(page.title, translations, {
|
|
142
|
+
siteName: data.general.site_name,
|
|
143
|
+
siteTitle: page.title,
|
|
144
|
+
});
|
|
145
|
+
page.meta_title =
|
|
146
|
+
page.meta_title &&
|
|
147
|
+
generatePlaceholderString(page.meta_title, translations, {
|
|
148
|
+
siteName: data.general.site_name,
|
|
149
|
+
siteTitle: page.title,
|
|
150
|
+
});
|
|
151
|
+
page.meta_description =
|
|
152
|
+
page.meta_description &&
|
|
153
|
+
generatePlaceholderString(page.meta_description, translations, {
|
|
154
|
+
siteName: data.general.site_name,
|
|
155
|
+
siteTitle: page.title,
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
|
|
134
159
|
export default {
|
|
135
160
|
run(data, themeOptions, fs) {
|
|
136
161
|
const start = new Date();
|
|
@@ -163,6 +188,7 @@ export default {
|
|
|
163
188
|
transformedPages[market][pageType].forEach((page, index) => {
|
|
164
189
|
// process page extra fields
|
|
165
190
|
processExtraFields(page.extra_fields);
|
|
191
|
+
updatePlaceholders(page, data);
|
|
166
192
|
|
|
167
193
|
// set page relation
|
|
168
194
|
if (
|
|
@@ -114,19 +114,25 @@ export function processCardsV2(module, pagesCloned, pagesMappedById) {
|
|
|
114
114
|
pagesMappedById[page_id] && module.items.push(pagesMappedById[page_id]);
|
|
115
115
|
});
|
|
116
116
|
} else if (cardSelector === 'use_filters') {
|
|
117
|
-
|
|
118
|
-
const pagesGroupedByType = pagesCloned[pageType];
|
|
117
|
+
let pagesList = [];
|
|
119
118
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
119
|
+
if (pageType) {
|
|
120
|
+
// Get all pages by the selected page type
|
|
121
|
+
const pagesGroupedByType = pagesCloned[pageType];
|
|
122
|
+
|
|
123
|
+
// Grouping pages by template ID
|
|
124
|
+
if (!pagesGroupedByTemplateId[pageType]) {
|
|
125
|
+
pagesGroupedByTemplateId[pageType] = groupBy(pagesGroupedByType, 'template_id');
|
|
126
|
+
}
|
|
124
127
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
// Populate pagesList if page type and template exists
|
|
129
|
+
pagesList =
|
|
130
|
+
!pagesGroupedByTemplateId[pageType] || !pagesGroupedByTemplateId[pageType][pageTemplateId]
|
|
131
|
+
? []
|
|
132
|
+
: pagesGroupedByTemplateId[pageType][pageTemplateId];
|
|
133
|
+
} else {
|
|
134
|
+
pagesList = pagesMappedById.map((page) => page);
|
|
135
|
+
}
|
|
130
136
|
|
|
131
137
|
// Check if there are pages before starting filtering
|
|
132
138
|
if (pagesList.length > 0) {
|
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()', () => {
|