@anywayseo/tools 5.10.0 → 6.0.0

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 (61) hide show
  1. package/dist/components/base/article-meta/item/index.d.ts +2 -0
  2. package/dist/components/game-demo/index.d.ts +2 -6
  3. package/dist/components/index.cjs +3 -3
  4. package/dist/components/index.mjs +3 -3
  5. package/dist/components/seo/href-langs/index.d.ts +8 -0
  6. package/dist/components/seo/index.d.ts +8 -6
  7. package/dist/components/seo/json-ld/index.d.ts +7 -0
  8. package/dist/components/seo/types.d.ts +10 -2
  9. package/dist/components/seo/utils.d.ts +3 -2
  10. package/dist/components/{strapi-component → strapi-content-renderer/strapi-component}/external-image/index.d.ts +1 -1
  11. package/dist/components/{strapi-component → strapi-content-renderer/strapi-component}/index.d.ts +1 -1
  12. package/dist/components/{strapi-component → strapi-content-renderer/strapi-component}/rich-text/index.d.ts +2 -1
  13. package/dist/components/{strapi-component → strapi-content-renderer/strapi-component}/utils.d.ts +1 -1
  14. package/dist/index-0AAkKSsc.mjs +146 -0
  15. package/dist/{index-D1gNEJUA.mjs → index-B5C9u9UE.mjs} +2 -2
  16. package/dist/{index-CAhVRVmv.js → index-B5SWTYZm.js} +90 -40
  17. package/dist/index-BJsA8Upb.js +192 -0
  18. package/dist/{index-DzOucsVx.js → index-BSAasfl2.js} +4 -5
  19. package/dist/index-BU1gLt1p.js +145 -0
  20. package/dist/{index-C2HtVL6w.mjs → index-BhzKUTPZ.mjs} +91 -41
  21. package/dist/{index-D9i6mZaH.mjs → index-C7buhUOk.mjs} +4 -5
  22. package/dist/{index-DgrIJs-a.js → index-CAjUjAgI.js} +5 -0
  23. package/dist/{index-Bph7a3PR.mjs → index-CQC6DRGf.mjs} +6 -1
  24. package/dist/index-CUDzMwnz.mjs +193 -0
  25. package/dist/{index-DXTC3R_J.js → index-DJSBjQzq.js} +2 -2
  26. package/dist/{index-B4M1IKzL.js → index-DZc8PJET.js} +1 -1
  27. package/dist/{index-ClIPWZ3z.mjs → index-U-DmPFa7.mjs} +1 -1
  28. package/dist/index.cjs +18 -7
  29. package/dist/index.mjs +29 -18
  30. package/dist/layout/index.cjs +7 -7
  31. package/dist/layout/index.mjs +7 -7
  32. package/dist/providers/index.cjs +2 -2
  33. package/dist/providers/index.mjs +2 -2
  34. package/dist/providers/site-provider/index.d.ts +2 -1
  35. package/dist/types/api/index.d.ts +2 -16
  36. package/dist/types/api/strapi-navigation.d.ts +16 -0
  37. package/dist/types/api/strapi-page.d.ts +45 -0
  38. package/dist/types/common/index.d.ts +1 -0
  39. package/dist/types/components/game-demo/index.d.ts +5 -0
  40. package/dist/types/components/index.d.ts +1 -1
  41. package/dist/types/content/seo/index.d.ts +38 -1
  42. package/dist/types/index.d.ts +2 -1
  43. package/dist/types/json-ld/index.d.ts +162 -0
  44. package/dist/types/site/index.d.ts +9 -4
  45. package/dist/utils/api/index.d.ts +4 -2
  46. package/dist/utils/api/strapi-guards.d.ts +4 -0
  47. package/dist/utils/api/strapi-navigation.d.ts +2 -0
  48. package/dist/utils/api/strapi-seo.d.ts +13 -0
  49. package/dist/utils/index.cjs +14 -3
  50. package/dist/utils/index.d.ts +1 -0
  51. package/dist/utils/index.mjs +25 -14
  52. package/dist/utils/json-ld/index.d.ts +70 -0
  53. package/dist/utils/navigation/index.d.ts +1 -0
  54. package/package.json +1 -1
  55. package/dist/components/strapi-content-renderer/utils.d.ts +0 -2
  56. package/dist/index-BeJTy4iY.mjs +0 -26
  57. package/dist/index-BfITsKAr.js +0 -25
  58. package/dist/index-CYr1ct1t.js +0 -93
  59. package/dist/index-cQqALZIW.mjs +0 -94
  60. package/dist/types/components/strapi-component/index.d.ts +0 -5
  61. package/dist/types/page/index.d.ts +0 -7
@@ -1,7 +1,9 @@
1
1
  import { FC } from 'react';
2
+ type ArticleMetaIcon = 'date' | 'time' | 'author';
2
3
  type ArticleMetaItemProps = {
3
4
  label: string;
4
5
  value: string;
6
+ icon?: ArticleMetaIcon;
5
7
  };
6
8
  declare const ArticleMetaItem: FC<ArticleMetaItemProps>;
7
9
  export default ArticleMetaItem;
@@ -1,5 +1,5 @@
1
1
  import { FC, ReactElement } from 'react';
2
- import { BoxPositionProps, ImageFit } from '../../types';
2
+ import { BoxPositionProps, IGameDemo, ImageFit } from '../../types';
3
3
  type GamePreviewImageProps = {
4
4
  previewImage: string;
5
5
  previewImageFit?: ImageFit;
@@ -7,10 +7,6 @@ type GamePreviewImageProps = {
7
7
  previewImage: ReactElement;
8
8
  previewImageFit?: never;
9
9
  };
10
- type GameDemoProps = {
11
- name: string;
12
- src?: string;
13
- refLink?: string;
14
- } & BoxPositionProps & GamePreviewImageProps;
10
+ type GameDemoProps = IGameDemo & GamePreviewImageProps & BoxPositionProps;
15
11
  declare const GameDemo: FC<GameDemoProps>;
16
12
  export default GameDemo;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("../index-CAhVRVmv.js");
4
- const index$1 = require("../index-DzOucsVx.js");
3
+ const index = require("../index-B5SWTYZm.js");
4
+ const index$1 = require("../index-BSAasfl2.js");
5
5
  const index$2 = require("../index-DDg_PkD2.js");
6
- const index$3 = require("../index-B4M1IKzL.js");
6
+ const index$3 = require("../index-DZc8PJET.js");
7
7
  exports.ActionButton = index.ActionButton;
8
8
  exports.ArticleCard = index.ArticleCard;
9
9
  exports.ArticleCardGrid = index.ArticleCardGrid;
@@ -1,7 +1,7 @@
1
- import { A, a, b, c, n, o, d, B, e, C, r, q, F, f, g, G, h, i, j, p, H, I, L, N, s, P, S, k, T, l, t, m } from "../index-C2HtVL6w.mjs";
2
- import { C as C2, a as a2, b as b2, L as L2, c as c2, R, S as S2, d as d2 } from "../index-D9i6mZaH.mjs";
1
+ import { A, a, b, c, n, o, d, B, e, C, r, q, F, f, g, G, h, i, j, p, H, I, L, N, s, P, S, k, T, l, t, m } from "../index-BhzKUTPZ.mjs";
2
+ import { C as C2, a as a2, b as b2, L as L2, c as c2, R, S as S2, d as d2 } from "../index-C7buhUOk.mjs";
3
3
  import { H as H2, a as a3, b as b3, O, P as P2, U } from "../index-BEjKnOZA.mjs";
4
- import { I as I2, L as L3 } from "../index-ClIPWZ3z.mjs";
4
+ import { I as I2, L as L3 } from "../index-U-DmPFa7.mjs";
5
5
  export {
6
6
  A as ActionButton,
7
7
  a as ArticleCard,
@@ -0,0 +1,8 @@
1
+ import { FC } from 'react';
2
+ import { IHrefLang } from '../../../types';
3
+ type HrefLangsProps = {
4
+ siteName: string;
5
+ hrefLangs: IHrefLang[];
6
+ };
7
+ declare const HrefLangs: FC<HrefLangsProps>;
8
+ export default HrefLangs;
@@ -1,11 +1,13 @@
1
1
  import { FC, PropsWithChildren } from 'react';
2
- import { IHrefLang, ILocale, ISeo } from '../../types';
3
- import { SeoItemGetter } from './types';
2
+ import { SeoCanonical, SeoDescription, SeoHrefLangs, SeoLocale, SeoStructuredData, SeoTitle } from './types';
4
3
  type SeoProps = PropsWithChildren<{
5
- title?: ISeo['title'] | SeoItemGetter;
6
- description?: ISeo['description'] | SeoItemGetter;
7
- lang?: ILocale['code'];
8
- hrefLangs?: IHrefLang[];
4
+ pathname: Location['pathname'];
5
+ locale?: SeoLocale;
6
+ title?: SeoTitle;
7
+ description?: SeoDescription;
8
+ canonicalUrl?: SeoCanonical;
9
+ hrefLangs?: SeoHrefLangs;
10
+ structuredData?: SeoStructuredData;
9
11
  }>;
10
12
  declare const Seo: FC<SeoProps>;
11
13
  export default Seo;
@@ -0,0 +1,7 @@
1
+ import { FC } from 'react';
2
+ import { Schemas } from '../../../types';
3
+ type JsonLdProps = {
4
+ schemas: Schemas;
5
+ };
6
+ declare const JsonLd: FC<JsonLdProps>;
7
+ export default JsonLd;
@@ -1,6 +1,14 @@
1
- export interface ISeoItemPlaceholders {
1
+ import { IHrefLang, ILocale, ISeoMetadata, IStructuredData, Nullable } from '../../types';
2
+ export interface ISeoMetaItemPlaceholders {
2
3
  siteName: string;
3
4
  currentYear: string;
4
5
  currentMonth: string;
5
6
  }
6
- export type SeoItemGetter = (placeholders: ISeoItemPlaceholders) => string;
7
+ type SeoMetaItemGetter = (placeholders: ISeoMetaItemPlaceholders) => string;
8
+ export type SeoLocale = Nullable<ILocale['code']>;
9
+ export type SeoTitle = Nullable<ISeoMetadata['title'] | SeoMetaItemGetter>;
10
+ export type SeoDescription = Nullable<ISeoMetadata['description'] | SeoMetaItemGetter>;
11
+ export type SeoCanonical = Nullable<string>;
12
+ export type SeoHrefLangs = IHrefLang[];
13
+ export type SeoStructuredData = Nullable<IStructuredData>;
14
+ export {};
@@ -1,2 +1,3 @@
1
- import { ISeoItemPlaceholders } from './types';
2
- export declare function replacePlaceholders(text: string, placeholders: ISeoItemPlaceholders): string;
1
+ import { ISeoMetaItemPlaceholders, SeoDescription, SeoTitle } from './types';
2
+ export declare function buildPlaceholders(siteName: string, lang: string): ISeoMetaItemPlaceholders;
3
+ export declare function getSeoMetaItem<T extends SeoTitle | SeoDescription>(item: NonNullable<T>, placeholders: ISeoMetaItemPlaceholders): string;
@@ -1,5 +1,5 @@
1
1
  import { FC } from 'react';
2
- import { IGatsbyImageFile, ExternalImageComponent, ExternalImageComponentProps } from '../../../types';
2
+ import { IGatsbyImageFile, ExternalImageComponent, ExternalImageComponentProps } from '../../../../types';
3
3
  type ExternalImageProps = ExternalImageComponentProps<IGatsbyImageFile> & {
4
4
  component: ExternalImageComponent;
5
5
  };
@@ -1,5 +1,5 @@
1
1
  import { FC } from 'react';
2
- import { StrapiComponentType, ExternalImageComponent } from '../../types';
2
+ import { StrapiComponentType, ExternalImageComponent } from '../../../types';
3
3
  type StrapiComponentProps = {
4
4
  type: StrapiComponentType;
5
5
  props: any;
@@ -1,6 +1,7 @@
1
1
  import { FC } from 'react';
2
+ import { IStrapiRichText } from '../../../../types';
2
3
  type RichTextProps = {
3
- content: string;
4
+ content: IStrapiRichText['data']['content'];
4
5
  };
5
6
  declare const RichText: FC<RichTextProps>;
6
7
  export default RichText;
@@ -1,4 +1,4 @@
1
- import { Currency } from '../../types';
1
+ import { Currency } from '../../../types';
2
2
  export declare function extractItemsFromJson(content: {
3
3
  ['strapi_json_value']: string[];
4
4
  }): string[];
@@ -0,0 +1,146 @@
1
+ import { DEFAULT_LANGUAGE } from "./i18n/index.mjs";
2
+ function isStrapiContent(array) {
3
+ return Array.isArray(array) && array.every(
4
+ (item) => typeof item === "object" && item !== null && "__typename" in item && typeof item.__typename === "string"
5
+ );
6
+ }
7
+ function isStrapiPageData(data) {
8
+ const maybe = data;
9
+ return Boolean(typeof data === "object" && maybe.content);
10
+ }
11
+ function isStrapiPageContext(context) {
12
+ const maybe = context;
13
+ return Boolean(typeof context === "object" && maybe.hrefLangs);
14
+ }
15
+ function getCurrencySymbol(currencyCode, locale = DEFAULT_LANGUAGE) {
16
+ const symbol = 0 .toLocaleString(locale, {
17
+ style: "currency",
18
+ currency: currencyCode,
19
+ minimumFractionDigits: 0,
20
+ maximumFractionDigits: 0
21
+ }).replace(/\d/g, "").trim();
22
+ return symbol;
23
+ }
24
+ function buildGraph(schemas) {
25
+ return Object.values(schemas);
26
+ }
27
+ const id = {
28
+ organization: (siteUrl) => `${siteUrl}/#organization`,
29
+ website: (siteUrl) => `${siteUrl}/#website`,
30
+ webpage: (pageUrl) => `${pageUrl}`,
31
+ review: (pageUrl) => `${pageUrl}#review`,
32
+ game: (pageUrl) => `${pageUrl}#game`,
33
+ author: (authorPageUrl) => `${authorPageUrl}#person`
34
+ };
35
+ function buildOrganizationSchema(params) {
36
+ const { site, lang } = params;
37
+ const logoUrl = `${site.url}${site.logo.url}`;
38
+ return {
39
+ "@type": "Organization",
40
+ "@id": id.organization(site.url),
41
+ name: site.name,
42
+ url: site.url,
43
+ logo: {
44
+ "@type": "ImageObject",
45
+ url: logoUrl,
46
+ contentUrl: logoUrl,
47
+ width: site.logo.width,
48
+ height: site.logo.height,
49
+ caption: site.logo.alt,
50
+ inLanguage: lang
51
+ }
52
+ };
53
+ }
54
+ function buildWebsiteSchema(params) {
55
+ const { site, lang } = params;
56
+ return {
57
+ "@type": "WebSite",
58
+ "@id": id.website(site.url),
59
+ url: site.url,
60
+ name: site.name,
61
+ inLanguage: lang,
62
+ publisher: { "@id": id.organization(site.url) }
63
+ };
64
+ }
65
+ function getEntitySchema({ site, page, structuredData }) {
66
+ if (!structuredData) {
67
+ return null;
68
+ }
69
+ const { entity, content } = structuredData;
70
+ if (entity === "game-review" && content.review && content.game) {
71
+ return buildGameReviewSchema({ site, page, author: content.author, review: content.review, game: content.game });
72
+ }
73
+ return null;
74
+ }
75
+ function buildWebpageSchema(params, mainEntity) {
76
+ const { site, page, lang } = params;
77
+ return {
78
+ "@type": "WebPage",
79
+ "@id": id.webpage(page.url),
80
+ url: page.url,
81
+ name: page.title,
82
+ ...page.description ? { description: page.description } : {},
83
+ inLanguage: lang,
84
+ isPartOf: { "@id": id.website(site.url) },
85
+ ...mainEntity ? { mainEntity } : {}
86
+ };
87
+ }
88
+ function buildGameReviewSchema(params) {
89
+ const { site, page, author, review, game } = params;
90
+ return {
91
+ "@type": "Review",
92
+ "@id": id.review(page.url),
93
+ name: review.title,
94
+ reviewBody: review.description,
95
+ ...author ? {
96
+ author: {
97
+ "@type": "Person",
98
+ name: author.name,
99
+ ...author.url ? { "@id": id.author(author.url), url: author.url } : {}
100
+ }
101
+ } : {},
102
+ publisher: { "@id": id.organization(site.url) },
103
+ datePublished: review.publishedAt,
104
+ dateModified: review.updatedAt || review.publishedAt,
105
+ ...review.rating ? {
106
+ reviewRating: {
107
+ "@type": "Rating",
108
+ ratingValue: review.rating.value,
109
+ bestRating: review.rating.max,
110
+ worstRating: review.rating.min
111
+ }
112
+ } : {},
113
+ itemReviewed: {
114
+ "@type": "Game",
115
+ "@id": id.game(page.url),
116
+ url: page.url,
117
+ name: game.name,
118
+ ...game.genre ? { genre: game.genre } : {}
119
+ }
120
+ };
121
+ }
122
+ function randomComparator() {
123
+ return Math.random() - 0.5;
124
+ }
125
+ function seededRandom(seed) {
126
+ return Math.abs(Math.sin(seed));
127
+ }
128
+ function getSeededRandomComparator(seed) {
129
+ const safeSeed = Math.abs(seed) % Number.MAX_SAFE_INTEGER;
130
+ let index = 0;
131
+ return () => seededRandom(safeSeed + index++) - 0.5;
132
+ }
133
+ export {
134
+ isStrapiPageData as a,
135
+ isStrapiPageContext as b,
136
+ buildGraph as c,
137
+ buildOrganizationSchema as d,
138
+ buildWebsiteSchema as e,
139
+ getEntitySchema as f,
140
+ getCurrencySymbol as g,
141
+ buildWebpageSchema as h,
142
+ isStrapiContent as i,
143
+ buildGameReviewSchema as j,
144
+ getSeededRandomComparator as k,
145
+ randomComparator as r
146
+ };
@@ -2,11 +2,11 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { MDXProvider } from "@mdx-js/react";
3
3
  import "react-i18next";
4
4
  import "@chakra-ui/react";
5
- import { I as Image, L as Link } from "./index-ClIPWZ3z.mjs";
5
+ import { I as Image, L as Link } from "./index-U-DmPFa7.mjs";
6
6
  import "./index-BJRvnR8Q.mjs";
7
7
  import "./index-RzByAgHO.mjs";
8
- import "react";
9
8
  import "@chakra-ui/icons";
9
+ import "react";
10
10
  import { P as Paragraph, U as Unordered, O as Ordered, b as Heading3, a as Heading2, H as Heading1 } from "./index-BEjKnOZA.mjs";
11
11
  function omitProps(props, omittedKeys) {
12
12
  const result = { ...props };
@@ -3,23 +3,32 @@ const jsxRuntime = require("react/jsx-runtime");
3
3
  const react = require("@chakra-ui/react");
4
4
  const reactI18next = require("react-i18next");
5
5
  const react$2 = require("@mdx-js/react");
6
- const index = require("./index-B4M1IKzL.js");
6
+ const index = require("./index-DZc8PJET.js");
7
7
  require("./index-C6MG_f24.js");
8
8
  const index$6 = require("./index-CBRFCYhV.js");
9
9
  const icons = require("@chakra-ui/icons");
10
10
  require("react-medium-image-zoom");
11
11
  const react$1 = require("react");
12
- const index$2 = require("./index-DzOucsVx.js");
12
+ const index$2 = require("./index-BSAasfl2.js");
13
13
  const index$3 = require("./index-DDg_PkD2.js");
14
+ const index$7 = require("./index-CAjUjAgI.js");
15
+ const index$5 = require("./index-BU1gLt1p.js");
14
16
  const index$1 = require("./index-ov4J7p3D.js");
15
17
  const index$4 = require("./index-CVv755RW.js");
16
- const index$5 = require("./index-BfITsKAr.js");
17
18
  const i18next = require("i18next");
18
19
  const Markdown = require("react-markdown");
19
- const ArticleMetaItem = ({ label, value }) => {
20
+ const ArticleMetaIconMap = {
21
+ date: /* @__PURE__ */ jsxRuntime.jsx(icons.CalendarIcon, {}),
22
+ time: /* @__PURE__ */ jsxRuntime.jsx(icons.TimeIcon, {}),
23
+ author: /* @__PURE__ */ jsxRuntime.jsx(icons.AtSignIcon, {})
24
+ };
25
+ const ArticleMetaItem = ({ label, value, icon }) => {
20
26
  const color = react.useColorModeValue("gray.600", "gray.400");
21
- return /* @__PURE__ */ jsxRuntime.jsxs(react.Box, { children: [
22
- /* @__PURE__ */ jsxRuntime.jsx(react.Text, { as: "span", color, children: label }),
27
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.Flex, { lineHeight: 6, children: [
28
+ /* @__PURE__ */ jsxRuntime.jsxs(react.Text, { as: "span", display: "inline-flex", alignItems: "center", gap: 1, me: 1, color, children: [
29
+ !!icon && ArticleMetaIconMap[icon],
30
+ label
31
+ ] }),
23
32
  value
24
33
  ] });
25
34
  };
@@ -31,18 +40,20 @@ const ArticleMeta = ({ createdAt, updatedAt, minutesToRead, authorName, variant
31
40
  !!publicationDate && /* @__PURE__ */ jsxRuntime.jsx(
32
41
  ArticleMetaItem,
33
42
  {
34
- label: variant === "full" ? `📅 ${t("meta.publicationDate")}` : "📅 ",
43
+ icon: "date",
44
+ label: variant === "full" ? t("meta.publicationDate") : "",
35
45
  value: publicationDate
36
46
  }
37
47
  ),
38
48
  !!minutesToRead && /* @__PURE__ */ jsxRuntime.jsx(
39
49
  ArticleMetaItem,
40
50
  {
41
- label: variant === "full" ? `⏳ ${t("meta.readingTime.label")}` : "⏳ ",
51
+ icon: "time",
52
+ label: variant === "full" ? t("meta.readingTime.label") : "",
42
53
  value: t("meta.readingTime.count", { count: minutesToRead })
43
54
  }
44
55
  ),
45
- !!authorName && /* @__PURE__ */ jsxRuntime.jsx(ArticleMetaItem, { label: variant === "full" ? `🧑🏻‍💻 ${t("meta.author")}` : "🧑🏻‍💻 ", value: authorName })
56
+ !!authorName && /* @__PURE__ */ jsxRuntime.jsx(ArticleMetaItem, { icon: "author", label: variant === "full" ? t("meta.author") : "", value: authorName })
46
57
  ] });
47
58
  };
48
59
  const ONE_LINE_HEIGHT = 24;
@@ -682,7 +693,7 @@ const NotFound = () => {
682
693
  const CookiePolicy = () => {
683
694
  const { t } = reactI18next.useTranslation("pageCookiePolicy");
684
695
  const { metadata } = index.useSiteContext();
685
- const { name: siteName } = metadata;
696
+ const siteName = metadata.name;
686
697
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
687
698
  /* @__PURE__ */ jsxRuntime.jsx(index$3.Heading1, { children: t("title") }),
688
699
  /* @__PURE__ */ jsxRuntime.jsx(index$3.Paragraph, { children: t("text", { siteName }) }),
@@ -788,7 +799,7 @@ const Contacts = () => {
788
799
  const PrivacyPolicy = ({ contactsSlug }) => {
789
800
  const { t } = reactI18next.useTranslation("pagePrivacyPolicy");
790
801
  const { metadata } = index.useSiteContext();
791
- const { name: siteName } = metadata;
802
+ const siteName = metadata.name;
792
803
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
793
804
  /* @__PURE__ */ jsxRuntime.jsx(index$3.Heading1, { children: t("title") }),
794
805
  /* @__PURE__ */ jsxRuntime.jsx(index$3.Paragraph, { children: t("text") }),
@@ -818,7 +829,7 @@ const PrivacyPolicy = ({ contactsSlug }) => {
818
829
  const TermsAndConditions = ({ privacyPolicySlug }) => {
819
830
  const { t } = reactI18next.useTranslation("pageTermsAndConditions");
820
831
  const { metadata } = index.useSiteContext();
821
- const { name: siteName } = metadata;
832
+ const siteName = metadata.name;
822
833
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
823
834
  /* @__PURE__ */ jsxRuntime.jsx(index$3.Heading1, { children: t("title") }),
824
835
  /* @__PURE__ */ jsxRuntime.jsx(index$3.Paragraph, { children: t("text", { siteName }) }),
@@ -940,6 +951,13 @@ const ProsCons = ({ items, ...boxProps }) => {
940
951
  /* @__PURE__ */ jsxRuntime.jsx(ProsConsCard, { itemType: "cons", items: cons })
941
952
  ] });
942
953
  };
954
+ function buildPlaceholders(siteName, lang) {
955
+ return {
956
+ siteName,
957
+ currentYear: index$1.getCurrentYear(lang),
958
+ currentMonth: index$1.getCurrentMonth(lang)
959
+ };
960
+ }
943
961
  function replacePlaceholders(text, placeholders) {
944
962
  Object.entries(placeholders).forEach(([placeholder, replacement]) => {
945
963
  const regex = new RegExp(`{{${placeholder}}}`, "g");
@@ -947,30 +965,67 @@ function replacePlaceholders(text, placeholders) {
947
965
  });
948
966
  return text;
949
967
  }
950
- const Seo = ({ children, title, description, lang, hrefLangs = [] }) => {
951
- const { metadata } = index.useSiteContext();
952
- const { name: siteName, lang: defaultLang, seo } = metadata;
953
- const { title: defaultTitle, description: defaultDescription } = seo;
954
- const siteLang = lang || defaultLang;
955
- const placeholders = react$1.useMemo(
956
- () => ({
957
- siteName,
958
- currentYear: index$1.getCurrentYear(siteLang),
959
- currentMonth: index$1.getCurrentMonth(siteLang)
960
- }),
961
- [siteName, siteLang]
968
+ function getSeoMetaItem(item, placeholders) {
969
+ if (typeof item === "string") {
970
+ return replacePlaceholders(item, placeholders);
971
+ }
972
+ return item(placeholders);
973
+ }
974
+ const JsonLd = ({ schemas }) => {
975
+ const graph = index$5.buildGraph(schemas);
976
+ if (!graph.length) {
977
+ return null;
978
+ }
979
+ const jsonLd = {
980
+ "@context": "https://schema.org",
981
+ "@graph": graph
982
+ };
983
+ return /* @__PURE__ */ jsxRuntime.jsx(
984
+ "script",
985
+ {
986
+ type: "application/ld+json",
987
+ dangerouslySetInnerHTML: {
988
+ __html: JSON.stringify(jsonLd)
989
+ }
990
+ }
962
991
  );
992
+ };
993
+ const HrefLangs = ({ siteName, hrefLangs }) => {
994
+ return hrefLangs.map(({ href, hrefLang }, index2) => /* @__PURE__ */ jsxRuntime.jsx("link", { rel: "alternate", hrefLang, href: index$7.buildCanonicalUrl(siteName, href) }, index2));
995
+ };
996
+ const Seo = ({
997
+ children,
998
+ pathname,
999
+ locale,
1000
+ title,
1001
+ description,
1002
+ canonicalUrl,
1003
+ hrefLangs = [],
1004
+ structuredData
1005
+ }) => {
1006
+ const { metadata: siteMetadata, logo: siteLogo, localization } = index.useSiteContext();
1007
+ const { name: siteName, seo: siteSeo } = siteMetadata;
1008
+ const { title: defaultTitle, description: defaultDescription } = siteSeo;
1009
+ const defaultLocale = localization.defaultLocale.code;
1010
+ const lang = locale || defaultLocale;
1011
+ const placeholders = buildPlaceholders(siteName, lang);
1012
+ const siteUrl = index$7.buildCanonicalUrl(siteName);
1013
+ const pageUrl = index$7.buildCanonicalUrl(siteName, pathname);
1014
+ const pageTitle = getSeoMetaItem(title ?? defaultTitle, placeholders);
1015
+ const pageDescription = getSeoMetaItem(description ?? defaultDescription, placeholders);
1016
+ const siteData = { url: siteUrl, name: siteName, logo: siteLogo };
1017
+ const pageData = { url: pageUrl, title: pageTitle, description: pageDescription };
1018
+ const organizationSchema = index$5.buildOrganizationSchema({ site: siteData, lang });
1019
+ const websiteSchema = index$5.buildWebsiteSchema({ site: siteData, lang });
1020
+ const entitySchema = index$5.getEntitySchema({ site: siteData, page: pageData, structuredData });
1021
+ const webpageSchema = index$5.buildWebpageSchema({ site: siteData, page: pageData, lang }, entitySchema);
963
1022
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
964
- /* @__PURE__ */ jsxRuntime.jsx("html", { lang: siteLang }),
965
- /* @__PURE__ */ jsxRuntime.jsx("title", { children: title ? typeof title === "string" ? replacePlaceholders(title, placeholders) : title(placeholders) : defaultTitle }),
966
- /* @__PURE__ */ jsxRuntime.jsx(
967
- "meta",
968
- {
969
- name: "description",
970
- content: description ? typeof description === "string" ? replacePlaceholders(description, placeholders) : description(placeholders) : defaultDescription
971
- }
972
- ),
973
- hrefLangs.map(({ href, hrefLang }, index2) => /* @__PURE__ */ jsxRuntime.jsx("link", { rel: "alternate", hrefLang, href: `https://${siteName}${href}` }, index2)),
1023
+ /* @__PURE__ */ jsxRuntime.jsx("html", { lang }),
1024
+ /* @__PURE__ */ jsxRuntime.jsx("title", { children: pageTitle }),
1025
+ /* @__PURE__ */ jsxRuntime.jsx("meta", { name: "description", content: pageDescription }),
1026
+ /* @__PURE__ */ jsxRuntime.jsx("link", { rel: "canonical", href: canonicalUrl ?? pageUrl }),
1027
+ /* @__PURE__ */ jsxRuntime.jsx(HrefLangs, { siteName, hrefLangs }),
1028
+ /* @__PURE__ */ jsxRuntime.jsx(JsonLd, { schemas: { organization: organizationSchema, website: websiteSchema, webpage: webpageSchema } }),
974
1029
  children
975
1030
  ] });
976
1031
  };
@@ -1252,13 +1307,8 @@ const StrapiComponent = ({ type, props, imageComponent }) => {
1252
1307
  return null;
1253
1308
  }
1254
1309
  };
1255
- function isStrapiContent(array) {
1256
- return Array.isArray(array) && array.every(
1257
- (item) => typeof item === "object" && item !== null && "__typename" in item && typeof item.__typename === "string"
1258
- );
1259
- }
1260
1310
  const StrapiContentRenderer = ({ content, imageComponent }) => {
1261
- if (!isStrapiContent(content)) {
1311
+ if (!index$5.isStrapiContent(content)) {
1262
1312
  return null;
1263
1313
  }
1264
1314
  return content.map(({ __typename: type, ...props }, index2) => /* @__PURE__ */ jsxRuntime.jsx(StrapiComponent, { type, props, imageComponent }, index2));