gatsby-core-theme 44.0.40 → 44.0.42

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.
Files changed (30) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/package.json +1 -1
  3. package/src/components/atoms/author-box/details/index.js +2 -1
  4. package/src/components/atoms/header-operator-bannner/index.js +2 -1
  5. package/src/components/atoms/notifications/notification-items/cards-v2/index.js +5 -4
  6. package/src/components/atoms/notifications/notification-items/spotlight/index.js +5 -4
  7. package/src/components/molecules/carousel/default-slide/index.js +1 -1
  8. package/src/components/molecules/header/variants/default/template-one/index.js +5 -4
  9. package/src/components/molecules/header/variants/operator/template-one-two/index.js +7 -6
  10. package/src/components/molecules/header/variants/slot/template-one/index.js +4 -3
  11. package/src/components/molecules/link-list/index.js +2 -1
  12. package/src/components/molecules/spotlights_v2/icon/template-one/index.js +4 -3
  13. package/src/components/molecules/spotlights_v2/image/template-one/index.js +4 -3
  14. package/src/components/molecules/spotlights_v2/image/template-two/index.js +4 -3
  15. package/src/components/molecules/spotlights_v2/image-text/template-one/index.js +3 -2
  16. package/src/components/molecules/spotlights_v2/image-text/template-three/item/index.js +4 -4
  17. package/src/components/molecules/spotlights_v2/image-text/template-two/index.js +3 -2
  18. package/src/components/molecules/toplist/default-row/index.js +4 -3
  19. package/src/components/molecules/toplist/header/index.js +2 -1
  20. package/src/components/organisms/head/index.js +3 -3
  21. package/src/components/pages/tracker/index-ssr.js +2 -1
  22. package/src/components/pages/tracker/index.js +2 -1
  23. package/src/constants/metaTags.js +71 -15
  24. package/src/constants/pick-keys.mjs +3 -2
  25. package/src/helpers/getters.mjs +1 -13
  26. package/src/helpers/getters.test.js +0 -10
  27. package/src/helpers/head.js +48 -8
  28. package/src/helpers/head.test.js +26 -1
  29. package/src/helpers/image.js +26 -0
  30. package/src/helpers/image.test.js +21 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,33 @@
1
+ ## [44.0.42](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.0.41...v44.0.42) (2025-05-21)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * fix test ([033c59d](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/033c59d02855f46fe2b484b1927e9d94c81c28d2))
7
+ * make changes ([0155c8c](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/0155c8c074b0b51b2926d0a1963ffa26db3401c8))
8
+ * remove static logic for IRL ([d51dd66](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/d51dd66f4ef558432b5095940f21a01381e4daa9))
9
+ * remove when content is null ([7ed4f5d](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/7ed4f5daacbe07658ada459dce15abb6394e5e34))
10
+
11
+
12
+ * Merge branch 'tm-5213-head-update' into 'master' ([28abae7](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/28abae7bdf0a46f1e8ac05c06dc6a6914ae4f665))
13
+
14
+ ## [44.0.41](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.0.40...v44.0.41) (2025-05-20)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * moved the alt function in a seperate file ([5cbee51](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/5cbee51b7c6d5afd38ec6cec048e4db6e13d7565))
20
+ * moved the alt function in a seperate file ([ddb1adb](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/ddb1adb1db4c5286464d576da4b8568655a91de9))
21
+ * moved the alt function in a seperate file ([bb4af76](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/bb4af76c7d4499593c58e7ff7b4fcb0844ad671d))
22
+ * operator images alt text translations ([744a9bf](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/744a9bf7115d9d82323c79f0cb0c02d5a3d271cf))
23
+ * pass the page data to custome head function ([dc4293b](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/dc4293b3b7d7ae42ffe1634ca5c694f3fa126b0d))
24
+ * update pick keys constant to include rating comments ([bac40c0](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/bac40c01be69c9fb8b097aeca9733afc74e3d498))
25
+ * variable reassignment ([1e7acf3](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/1e7acf36a709c7d157f438acf9f3a70011ee6af4))
26
+
27
+
28
+ * Merge branch 'tm-5468-alt-text-translations' into 'master' ([fb65d5d](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/fb65d5dc534d30d45c21013a48f782564f11362c))
29
+ * Merge branch 'tm-5433-ratings-template-block' into 'master' ([88c210d](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/88c210da286370e223aa66a5235bd7ca81b0573f))
30
+
1
31
  ## [44.0.40](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.0.39...v44.0.40) (2025-05-19)
2
32
 
3
33
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "44.0.40",
3
+ "version": "44.0.42",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "author": "",
6
6
  "license": "ISC",
@@ -1,7 +1,8 @@
1
1
  /* eslint-disable react-hooks/rules-of-hooks */
2
2
  import React from 'react';
3
3
  import PropTypes from 'prop-types';
4
- import { imagePrettyUrl, getAltText } from '~helpers/getters';
4
+ import { imagePrettyUrl } from '~helpers/getters';
5
+ import { getAltText } from '~helpers/image';
5
6
  import styles from './author-details.module.scss';
6
7
  import LazyImage from '~hooks/lazy-image';
7
8
  import Link from '~hooks/link';
@@ -4,7 +4,8 @@ import LazyImage from '~hooks/lazy-image'
4
4
  import useTranslate from '~hooks/useTranslate/useTranslate'
5
5
  import Bonus from '~molecules/bonus-box/template-three'
6
6
  import { TrackingKeys } from '~constants/tracking-api'
7
- import { getAltText, imagePrettyUrl } from '~helpers/getters'
7
+ import { imagePrettyUrl } from '~helpers/getters'
8
+ import { getAltText } from '~helpers/image';
8
9
 
9
10
  import styles from './header-operator-bannner.module.scss'
10
11
  import { trackerLinkActive } from "~helpers/tracker.mjs";
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { imagePrettyUrl, getImageFilename, getAltText, getExtraField } from 'gatsby-core-theme/src/helpers/getters';
4
- import LazyImage from 'gatsby-core-theme/src/hooks/lazy-image';
5
- import keygen from 'gatsby-core-theme/src/helpers/keygen';
6
- import Link from 'gatsby-core-theme/src/hooks/link';
3
+ import LazyImage from '~hooks/lazy-image';
4
+ import keygen from '~helpers/keygen';
5
+ import Link from '~hooks/link';
6
+ import { imagePrettyUrl, getExtraField } from '~helpers/getters';
7
+ import { getAltText, getImageFilename } from '~helpers/image';
7
8
  import useTranslate from '~hooks/useTranslate/useTranslate';
8
9
  import CloseIcon from '~images/icons/close';
9
10
  import styles from './notification-items.module.scss';
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { imagePrettyUrl, getImageFilename, getAltText } from 'gatsby-core-theme/src/helpers/getters';
4
- import LazyImage from 'gatsby-core-theme/src/hooks/lazy-image';
5
- import keygen from 'gatsby-core-theme/src/helpers/keygen';
6
- import Link from 'gatsby-core-theme/src/hooks/link';
3
+ import { imagePrettyUrl } from '~helpers/getters';
4
+ import { getAltText, getImageFilename } from '~helpers/image';
5
+ import LazyImage from '~hooks/lazy-image';
6
+ import keygen from '~helpers/keygen';
7
+ import Link from '~hooks/link';
7
8
  import useTranslate from '~hooks/useTranslate/useTranslate';
8
9
  import CloseIcon from '~images/icons/close';
9
10
  import styles from './notification-items.module.scss';
@@ -5,7 +5,7 @@ import React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
 
7
7
  import ResponsiveImages from '~hooks/responsive-images';
8
- import { getAltText } from '~helpers/getters';
8
+ import { getAltText } from '~helpers/image';
9
9
  import styles from './default-slide.module.scss';
10
10
 
11
11
  const Slide = ({
@@ -2,10 +2,11 @@
2
2
  import React from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { FaArrowRight } from '@react-icons/all-files/fa/FaArrowRight';
5
- import LazyImage from 'gatsby-core-theme/src/hooks/lazy-image';
6
- import Button from 'gatsby-core-theme/src/components/atoms/button/button';
7
- import { imagePrettyUrl, getAltText, getExtraField } from 'gatsby-core-theme/src/helpers/getters';
8
- import VariableComponent from 'gatsby-core-theme/src/components/molecules/header/variants/default/variables';
5
+ import LazyImage from '~hooks/lazy-image';
6
+ import { getAltText } from '~helpers/image';
7
+ import Button from '~atoms/button/button';
8
+ import { imagePrettyUrl, getExtraField } from '~helpers/getters';
9
+ import VariableComponent from '~molecules/header/variants/default/variables';
9
10
  import styles from './template-one.module.scss';
10
11
 
11
12
  export default function TemplateOne({
@@ -1,19 +1,20 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  // eslint-disable-next-line import/no-extraneous-dependencies
4
- import { imagePrettyUrl, getAltText } from 'gatsby-core-theme/src/helpers/getters';
5
- import LazyImage from 'gatsby-core-theme/src/hooks/lazy-image';
6
- import StarRating from 'gatsby-core-theme/src/components/molecules/star-rating/one-star';
7
4
  import { FaStar } from '@react-icons/all-files/fa/FaStar';
5
+ import { imagePrettyUrl } from '~helpers/getters';
6
+ import { getAltText } from '~helpers/image';
7
+ import LazyImage from '~hooks/lazy-image';
8
+ import StarRating from '~molecules/star-rating/one-star';
8
9
  import useTranslate from '~hooks/useTranslate/useTranslate';
9
10
  import Verify from '~images/icons/verify';
10
- import Rating from '../../../../../atoms/ratings';
11
- import OperatorBanner from '../../../../../atoms/header-operator-bannner';
11
+ import Rating from '~atoms/ratings';
12
+ import OperatorBanner from '~atoms/header-operator-bannner';
12
13
  import VariableComponent from '../variables';
13
14
  import styles from './template-one-two.module.scss';
14
15
  import { TrackingKeys } from '~constants/tracking-api'
15
16
  import PrettyLink from '~atoms/pretty-link';
16
- import Ribbons from '../../../../../atoms/ribbons';
17
+ import Ribbons from '~atoms/ribbons';
17
18
 
18
19
  const TemplateOneTwo = ({
19
20
  relation,
@@ -2,9 +2,10 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
 
4
4
  import { FaStar } from '@react-icons/all-files/fa/FaStar';
5
- import { imagePrettyUrl, getAltText } from 'gatsby-core-theme/src/helpers/getters';
6
- import OperatorBanner from 'gatsby-core-theme/src/components/atoms/header-operator-bannner';
7
- import Rating from 'gatsby-core-theme/src/components/atoms/ratings';
5
+ import { imagePrettyUrl } from '~helpers/getters';
6
+ import OperatorBanner from '~atoms/header-operator-bannner';
7
+ import Rating from '~atoms/ratings';
8
+ import { getAltText } from '~helpers/image';
8
9
  import Verify from '~images/icons/verify';
9
10
  import { TrackingKeys } from '~constants/tracking-api'
10
11
  import styles from './slot.module.scss';
@@ -4,7 +4,8 @@ import React from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
 
6
6
  import keygen from '~helpers/keygen';
7
- import { imagePrettyUrl, getAltText } from '~helpers/getters';
7
+ import { imagePrettyUrl } from '~helpers/getters';
8
+ import { getAltText } from '~helpers/image';
8
9
  import Link from '~hooks/link';
9
10
  import LazyImage from '~hooks/lazy-image';
10
11
 
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import keygen from '~helpers/keygen';
4
- import LazyImage from '../../../../../hooks/lazy-image';
5
- import Link from '../../../../../hooks/link';
6
- import { getAltText, imagePrettyUrl } from '../../../../../helpers/getters.mjs';
4
+ import LazyImage from '~hooks/lazy-image';
5
+ import Link from '~hooks/link';
6
+ import { imagePrettyUrl } from '~helpers/getters.mjs';
7
+ import { getAltText } from '~helpers/image';
7
8
  import styles from './template-one.module.scss';
8
9
  import useTranslate from '~hooks/useTranslate/useTranslate';
9
10
 
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import keygen from '~helpers/keygen';
4
- import LazyImage from '../../../../../hooks/lazy-image';
5
- import Link from '../../../../../hooks/link';
6
- import { getAltText, imagePrettyUrl } from '../../../../../helpers/getters.mjs';
4
+ import LazyImage from '~hooks/lazy-image';
5
+ import Link from '~hooks/link';
6
+ import { imagePrettyUrl } from '~helpers/getters.mjs';
7
+ import { getAltText } from '~helpers/image';
7
8
  import styles from './template-one.module.scss';
8
9
  import useTranslate from '~hooks/useTranslate/useTranslate';
9
10
 
@@ -2,9 +2,10 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { FaArrowRight } from '@react-icons/all-files/fa/FaArrowRight';
4
4
  import keygen from '~helpers/keygen';
5
- import LazyImage from '../../../../../hooks/lazy-image';
6
- import Link from '../../../../../hooks/link';
7
- import { getAltText, imagePrettyUrl } from '../../../../../helpers/getters.mjs';
5
+ import LazyImage from '~hooks/lazy-image';
6
+ import Link from '~hooks/link';
7
+ import { imagePrettyUrl } from '~helpers/getters.mjs';
8
+ import { getAltText } from '~helpers/image';
8
9
  import styles from './template-two.module.scss';
9
10
  import useTranslate from '~hooks/useTranslate/useTranslate';
10
11
 
@@ -2,9 +2,10 @@ import React from "react";
2
2
  import PropTypes from "prop-types";
3
3
  import { FaArrowRight } from "@react-icons/all-files/fa/FaArrowRight";
4
4
  import keygen from "~helpers/keygen";
5
- import LazyImage from "../../../../../hooks/lazy-image";
5
+ import LazyImage from "~hooks/lazy-image";
6
6
  import Button from "../../../../atoms/button/button";
7
- import { getAltText, imagePrettyUrl } from "../../../../../helpers/getters.mjs";
7
+ import { imagePrettyUrl } from "~helpers/getters.mjs";
8
+ import { getAltText } from '~helpers/image';
8
9
  import useTranslate from "~hooks/useTranslate/useTranslate";
9
10
  import styles from "./template-one.module.scss";
10
11
 
@@ -5,13 +5,13 @@ import PropTypes from "prop-types";
5
5
  import { FaArrowRight } from "@react-icons/all-files/fa/FaArrowRight";
6
6
  import { FaPlus } from "@react-icons/all-files/fa/FaPlus";
7
7
  import { FaMinus } from "@react-icons/all-files/fa/FaMinus";
8
- import LazyImage from "../../../../../../hooks/lazy-image";
8
+ import LazyImage from "~hooks/lazy-image";
9
9
  import useTranslate from "~hooks/useTranslate/useTranslate";
10
- import Button from "../../../../../atoms/button/button";
10
+ import Button from "~atoms/button/button";
11
11
  import {
12
- getAltText,
13
12
  imagePrettyUrl,
14
- } from "../../../../../../helpers/getters.mjs";
13
+ } from "~helpers/getters.mjs";
14
+ import { getAltText } from "~helpers/image";
15
15
  import styles from "./style.module.scss";
16
16
 
17
17
  export default function TemplateOne({
@@ -2,10 +2,11 @@ import React from "react";
2
2
  import PropTypes from "prop-types";
3
3
  import { FaArrowRight } from "@react-icons/all-files/fa/FaArrowRight";
4
4
  import keygen from "~helpers/keygen";
5
- import LazyImage from "../../../../../hooks/lazy-image";
5
+ import LazyImage from "~hooks/lazy-image";
6
6
  import Button from "../../../../atoms/button/button";
7
7
  import useTranslate from "~hooks/useTranslate/useTranslate";
8
- import { getAltText, imagePrettyUrl } from "../../../../../helpers/getters.mjs";
8
+ import { imagePrettyUrl } from "~helpers/getters.mjs";
9
+ import { getAltText } from '~helpers/image';
9
10
  import styles from "./template-two.module.scss";
10
11
 
11
12
  export default function TemplateOne({
@@ -4,15 +4,16 @@ import React from 'react'
4
4
  import PropTypes from 'prop-types'
5
5
  import Bonus from '~molecules/bonus-box/template-one'
6
6
  import SellingPoints from '~atoms/selling-points'
7
- import ReviewLink from '../../../atoms/review-link'
7
+ import ReviewLink from '~atoms/review-link'
8
8
  import PrettyLink from '~atoms/pretty-link'
9
9
  import OperatorCta from '~atoms/button/operator-cta'
10
- import { imagePrettyUrl, getAltText } from '~helpers/getters'
10
+ import { getAltText } from '~helpers/image';
11
+ import { imagePrettyUrl } from '~helpers/getters'
11
12
  import LazyImage from '~hooks/lazy-image'
12
13
  import { TrackingKeys } from '~constants/tracking-api'
13
14
 
14
15
  import styles from './default-row.module.scss'
15
- import Ribbons from '../../../atoms/ribbons'
16
+ import Ribbons from '~atoms/ribbons'
16
17
 
17
18
  const Row = ({
18
19
  item,
@@ -2,7 +2,8 @@ import React from "react";
2
2
  import PropTypes from "prop-types";
3
3
  import LazyImage from "~hooks/lazy-image";
4
4
  import keygen from "~helpers/keygen";
5
- import { imagePrettyUrl, getAltText } from "~helpers/getters";
5
+ import { imagePrettyUrl } from "~helpers/getters";
6
+ import { getAltText } from '~helpers/image';
6
7
  import OperatorCta from "~atoms/button/operator-cta";
7
8
  import StarRating from "~molecules/star-rating";
8
9
  import { TrackingKeys } from '~constants/tracking-api'
@@ -7,9 +7,9 @@ import { getUrl, getLanguage } from "~helpers/getters";
7
7
  import { getMetaTags, getCanonicalUrl } from "~helpers/head";
8
8
  import customData from "./customData";
9
9
 
10
- const HeadData = ({ page = {}, siteInfo }) => {
10
+ const HeadData = ({ page = {} }) => {
11
11
  const isTracker = page.template === "tracker";
12
- const metaTags = getMetaTags(page, siteInfo, isTracker);
12
+ const metaTags = getMetaTags(page, isTracker);
13
13
  let defaultHref = null;
14
14
 
15
15
  return (
@@ -17,7 +17,7 @@ const HeadData = ({ page = {}, siteInfo }) => {
17
17
  <title>{page.meta_title}</title>
18
18
  <html lang={getLanguage(page.language)} />
19
19
  {metaTags}
20
- {customData()}
20
+ {customData(page)}
21
21
  {process.env.GATSBY_ACTIVE_ENV === "development" && (
22
22
  <meta name="googlebot" content="noindex,follow" />
23
23
  )}
@@ -6,7 +6,8 @@ import React, { useEffect } from 'react';
6
6
  import PropTypes from 'prop-types';
7
7
  import Button from '~atoms/button/button';
8
8
  import LazyImage from '~hooks/lazy-image';
9
- import { imagePrettyUrl, getAltText, getExtraField } from '~helpers/getters';
9
+ import { imagePrettyUrl, getExtraField } from '~helpers/getters';
10
+ import { getAltText } from '~helpers/image';
10
11
  import styles from './tracker.module.scss';
11
12
  import { getTrackerName } from '~helpers/tracker';
12
13
  import useTranslate from '~hooks/useTranslate/useTranslate';
@@ -4,7 +4,8 @@ import React, { useEffect } from "react";
4
4
  import PropTypes from "prop-types";
5
5
  import Button from "~atoms/button/button";
6
6
  import LazyImage from "~hooks/lazy-image";
7
- import { imagePrettyUrl, getAltText, getExtraField } from "~helpers/getters";
7
+ import { imagePrettyUrl, getExtraField } from "~helpers/getters";
8
+ import { getAltText } from '~helpers/image';
8
9
  import styles from "./tracker.module.scss";
9
10
  import { getTrackerName } from "~helpers/tracker";
10
11
  import useTranslate from "~hooks/useTranslate/useTranslate";
@@ -1,15 +1,71 @@
1
- import { getLanguage,setName } from '~helpers/getters';
2
- import { getRobotOptions, getCanonicalUrl } from '~helpers/head';
3
-
4
-
5
- export default (page, siteInfo, pageImage, isTracker) => [
6
- { type: "meta", name: "description", content: page.meta_description },
7
- { type: "meta", name: "robots", content: getRobotOptions(page.robot_options) },
8
- { type: "meta", property: "og:title", content: page.meta_title },
9
- { type: "meta", property: "og:site_name", content: siteInfo?.site_name ? setName(siteInfo.site_name) : "" },
10
- { type: "meta", property: "og:description", content: page.meta_description },
11
- { type: "meta", property: "og:type", content: page.path === '/' ? 'website' : 'article' },
12
- { type: "meta", property: "og:image", content: pageImage },
13
- { type: "meta", property: "og:url", content: getCanonicalUrl(page, isTracker) },
14
- { type: "meta", property: "og:locale", content: getLanguage(page.language) === 'en' ? 'en_GB' : getLanguage(page.language) },
15
- ];
1
+ /* eslint-disable camelcase */
2
+ import parse from 'html-react-parser';
3
+ import { getLanguage, setName, getPageImage, imagePrettyUrl } from "~helpers/getters";
4
+ import { getRobotOptions, getCanonicalUrl, transformMetaTitle, getTwitterUsername } from "~helpers/head";
5
+
6
+
7
+
8
+ export default (page, isTracker) => {
9
+ const { relation, meta_title, meta_description, relation_type, siteInfo } = page;
10
+ const pageImage = getPageImage(page) || imagePrettyUrl(siteInfo?.site_logo);
11
+ const parsedMetaDescr = meta_description ? parse(meta_description) : '';
12
+ const metaTitle = transformMetaTitle(relation, meta_title, relation_type);
13
+ const twitterUsername = getTwitterUsername(page.siteSchema?.twitter);
14
+
15
+
16
+ return [
17
+ { type: "meta", name: "description", content: page.meta_description },
18
+ {
19
+ type: "meta",
20
+ name: "robots",
21
+ content: getRobotOptions(page.robot_options),
22
+ },
23
+ { type: "meta", property: "og:title", content: metaTitle},
24
+ {
25
+ type: "meta",
26
+ property: "og:site_name",
27
+ content: siteInfo?.site_name ? setName(siteInfo.site_name) : "",
28
+ },
29
+ { type: "meta", property: "og:description", content: parsedMetaDescr },
30
+ {
31
+ type: "meta",
32
+ property: "og:type",
33
+ content: page.path === "/" ? "website" : "article",
34
+ },
35
+ { type: "meta", property: "og:image", content: pageImage },
36
+ {
37
+ type: "meta",
38
+ property: "og:url",
39
+ content: getCanonicalUrl(page, isTracker),
40
+ },
41
+ {
42
+ type: "meta",
43
+ property: "og:locale",
44
+ content:
45
+ getLanguage(page.language) === "en"
46
+ ? "en_GB"
47
+ : getLanguage(page.language),
48
+ },
49
+ { type: "meta", content: process.env.PLACENAME },
50
+ { type: "region", content: process.env.COUNTRY },
51
+ {
52
+ type: "meta",
53
+ name: "facebook-domain-verification",
54
+ content: process.env.FBVERIFACTION,
55
+ },
56
+ {
57
+ type: "meta",
58
+ name: "robots",
59
+ content:
60
+ process.env.GATSBY_ACTIVE_ENV !== "development"
61
+ ? page?.meta_robots?.join(",")
62
+ : null,
63
+ },
64
+ { type: "meta", name: "twitter:title", content: twitterUsername && metaTitle },
65
+ { type: "meta", name: "twitter:description", content: twitterUsername && parsedMetaDescr },
66
+ { type: "meta", name: "twitter:site", content: twitterUsername && `@${twitterUsername}` },
67
+ { type: "meta", name: "twitter:creator", content: twitterUsername && `@${twitterUsername}` },
68
+ { type: "meta", name: "twitter:card", content: twitterUsername && 'summary' },
69
+ { type: "meta", name: "twitter:image", content: twitterUsername && pageImage.replace('/filters:format(webp)', '') },
70
+ ]
71
+ };
@@ -127,7 +127,8 @@ export const pickRelationKeys = {
127
127
  'languages',
128
128
  'average_deposit_fee_amount',
129
129
  'average_withdrawal_times',
130
- 'best_game'
130
+ 'best_game',
131
+ 'rating_comments',
131
132
  ],
132
133
  operator_simplified: [
133
134
  "short_name",
@@ -140,7 +141,7 @@ export const pickRelationKeys = {
140
141
  "logo",
141
142
  "type",
142
143
  "market",
143
- "status"
144
+ "status",
144
145
  ],
145
146
  game: [
146
147
  "id",
@@ -1,3 +1,4 @@
1
+ /* eslint-disable react-hooks/rules-of-hooks */
1
2
  /* eslint-disable no-prototype-builtins */
2
3
  /* eslint-disable no-nested-ternary */
3
4
  import { generateTrackerLink } from "./generators.mjs";
@@ -106,15 +107,6 @@ export function image(filename, width, height, fit = "cover") {
106
107
  return `${cloudFrontUrl}/${Buffer.from(imageRequest).toString("base64")}`;
107
108
  }
108
109
 
109
- export function getImageFilename(src) {
110
- const srcArr = src && src.substring(src.lastIndexOf("/") + 1).split(".");
111
- if (!srcArr.length) {
112
- return "";
113
- }
114
-
115
- return srcArr[0];
116
- }
117
-
118
110
  export function getImageExtension(filename) {
119
111
  return filename && filename.split(".").pop();
120
112
  }
@@ -447,10 +439,6 @@ export const getRoundMinutes = (time) => {
447
439
  return value === 0 ? 1 : value;
448
440
  };
449
441
 
450
- export function getAltText(imageObject, defaultAlt = "") {
451
- return imageObject && imageObject.alt ? imageObject.alt : defaultAlt;
452
- }
453
-
454
442
  export function updateArrayTranslations(array, keysArray, translations) {
455
443
  if (array && array.length > 0 && keysArray && keysArray.length > 0) {
456
444
  array.forEach((elm, index) => {
@@ -313,16 +313,6 @@ describe('Getters Helper', () => {
313
313
  expect(Getters.getRoundMinutes('3:29')).toBe(3);
314
314
  });
315
315
 
316
- test('Test altText', () => {
317
- const alt = Getters.getAltText({ alt: 'imageAlt' }, 'default');
318
- expect(alt).toEqual('imageAlt');
319
- });
320
-
321
- test('Test without altText', () => {
322
- const altText = Getters.getAltText(null, 'default');
323
- expect(altText).toEqual('default');
324
- });
325
-
326
316
  const array = ['apple', 'banana', 'cherry'];
327
317
  const keysArray = ['fruit_apple', 'fruit_banana', 'fruit_cherry'];
328
318
  const translations = {
@@ -1,17 +1,23 @@
1
1
  import React from "react";
2
- import { getPageImage, imagePrettyUrl } from "~helpers/getters";
2
+ import { getPageImage, imagePrettyUrl, getBonus } from "~helpers/getters";
3
+ import { generatePlaceholderString } from "~helpers/generators";
3
4
  import keygen from "~helpers/keygen";
4
5
  import metaTags from "~constants/metaTags";
5
6
 
6
7
  export const getMetaTags = (page, siteInfo, isTracker) => {
7
8
  const pageImage = getPageImage(page) || imagePrettyUrl(siteInfo?.site_logo);
8
- return metaTags(page, siteInfo, pageImage, isTracker).map((meta) => (
9
- <meta
10
- key={keygen()}
11
- {...(meta.name ? { name: meta.name } : { property: meta.property })}
12
- content={meta.content}
13
- />
14
- ));
9
+ // eslint-disable-next-line array-callback-return
10
+ return metaTags(page, siteInfo, pageImage, isTracker).map((meta) => {
11
+ if (meta?.content) {
12
+ return (
13
+ <meta
14
+ key={keygen()}
15
+ {...(meta.name ? { name: meta.name } : { property: meta.property })}
16
+ content={meta.content}
17
+ />
18
+ );
19
+ }
20
+ });
15
21
  };
16
22
 
17
23
  export function getCanonicalUrl(page, isTracker) {
@@ -49,3 +55,37 @@ export function getRobotOptions(options) {
49
55
  array.push("noindex,follow");
50
56
  return array.join();
51
57
  }
58
+
59
+ export function getLocale(language) {
60
+ if (language) {
61
+ const locale = language.split("_").reverse();
62
+ locale[1] = locale[1].toUpperCase();
63
+ return locale.join("_");
64
+ }
65
+ return null;
66
+ }
67
+
68
+ export function getTwitterUsername(url) {
69
+ // eslint-disable-next-line no-useless-escape
70
+ const regex = /https?:\/\/(www\.)?twitter\.com\/(#!\/)?@?([^\/]*)/;
71
+ const m = regex.exec(url);
72
+
73
+ if (m !== null && m.length >= 3) {
74
+ return m[3];
75
+ }
76
+
77
+ return null;
78
+ }
79
+
80
+ export function transformMetaTitle(relation, metaTitle, type) {
81
+ if (type !== "operator") return metaTitle;
82
+
83
+ switch (metaTitle) {
84
+ case "[OPERATOR_REVIEW_META_TITLE]":
85
+ return `${relation.name} ${generatePlaceholderString("[YEAR]")} ${
86
+ getBonus("main", relation).one_liner
87
+ }`;
88
+ default:
89
+ return metaTitle;
90
+ }
91
+ }
@@ -1,4 +1,4 @@
1
- import {getMetaTags, getCanonicalUrl} from './head';
1
+ import {getMetaTags, getCanonicalUrl, getTwitterUsername, getLocale} from './head';
2
2
 
3
3
  describe('head.js functions', () => {
4
4
  describe('getMetaTags', () => {
@@ -47,4 +47,29 @@ describe('head.js functions', () => {
47
47
  expect(getCanonicalUrl(page, false)).toBe('https://example.com/about');
48
48
  });
49
49
  });
50
+
51
+ describe('getLocale', () => {
52
+ it('returns null when no language is provided', () => {
53
+ expect(getLocale(null)).toBeNull();
54
+ expect(getLocale(undefined)).toBeNull();
55
+ expect(getLocale('')).toBeNull();
56
+ });
57
+
58
+ it('transforms language code correctly', () => {
59
+ expect(getLocale('en_us')).toBe('us_EN');
60
+ });
61
+ });
62
+
63
+ describe('getTwitterUsername', () => {
64
+ it('returns null for invalid Twitter URLs', () => {
65
+ expect(getTwitterUsername('')).toBeNull();
66
+ expect(getTwitterUsername('https://example.com')).toBeNull();
67
+ expect(getTwitterUsername('https://twitter.com')).toBeNull();
68
+ });
69
+
70
+ it('extracts username from various Twitter URL formats', () => {
71
+ expect(getTwitterUsername('https://twitter.com/username')).toBe('username');
72
+ expect(getTwitterUsername('https://www.twitter.com/username')).toBe('username');
73
+ });
74
+ });
50
75
  });
@@ -0,0 +1,26 @@
1
+ /* eslint-disable react-hooks/rules-of-hooks */
2
+ /* eslint-disable import/prefer-default-export */
3
+ import useTranslate from '../hooks/useTranslate/useTranslate';
4
+
5
+ export function getAltText(imageObject, defaultAlt = "") {
6
+ // If alt is for operator image we check for custom translations
7
+ if(imageObject && imageObject.alt && imageObject.alt.toLowerCase().includes('image for')) {
8
+ const originalAlt = imageObject.alt.toLowerCase();
9
+ const regex = /(logo image for|image for)\s*/i;
10
+
11
+ // Replace all occurrences of the matched phrases with an empty string
12
+ const newAlt = `${useTranslate('image_for', 'Logo image for')} ${originalAlt.replace(regex, '')}`;
13
+ return useTranslate(newAlt.replace(/\s+/g, '_').toLowerCase(), newAlt);
14
+ }
15
+
16
+ return imageObject && imageObject.alt ? imageObject.alt : defaultAlt;
17
+ }
18
+
19
+ export function getImageFilename(src) {
20
+ const srcArr = src && src.substring(src.lastIndexOf("/") + 1).split(".");
21
+ if (!srcArr.length) {
22
+ return "";
23
+ }
24
+
25
+ return srcArr[0];
26
+ }
@@ -0,0 +1,21 @@
1
+ import * as Image from './image';
2
+
3
+ describe('Getters Helper', () => {
4
+
5
+ test('Test altText', () => {
6
+ const alt = Image.getAltText({ alt: 'imageAlt' }, 'default');
7
+ expect(alt).toEqual('imageAlt');
8
+ });
9
+
10
+ test('Test without altText', () => {
11
+ const altText = Image.getAltText(null, 'default');
12
+ expect(altText).toEqual('default');
13
+ });
14
+
15
+
16
+
17
+ test('Test with altText for operators', () => {
18
+ const altText = Image.getAltText({ alt: 'Image for operator' }, 'Test');
19
+ expect(altText).toEqual('Logo image for operator');
20
+ });
21
+ });