@anywayseo/tools 6.1.0 → 6.3.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 (39) hide show
  1. package/dist/components/index.cjs +1 -1
  2. package/dist/components/index.mjs +21 -21
  3. package/dist/components/seo/href-langs/index.d.ts +2 -2
  4. package/dist/components/seo/index.d.ts +2 -8
  5. package/dist/components/seo/open-graph/index.d.ts +8 -0
  6. package/dist/components/seo/utils.d.ts +2 -2
  7. package/dist/hooks/index.mjs +1 -1
  8. package/dist/i18n/index.mjs +1 -1
  9. package/dist/{index-TcBorTSf.mjs → index-B7EwEV0P.mjs} +2 -2
  10. package/dist/{index-P_fDAJVz.js → index-BKWX6mIo.js} +17 -13
  11. package/dist/{index-BPthShL-.mjs → index-BVAydcbQ.mjs} +3 -3
  12. package/dist/{index-CQC6DRGf.mjs → index-Bhur6qbX.mjs} +4 -4
  13. package/dist/{index-MnQnVvsM.mjs → index-Bx11bnvY.mjs} +21 -17
  14. package/dist/{index-BS5T9Il4.mjs → index-CKrYF12N.mjs} +1 -1
  15. package/dist/{index-CoNbTY7l.mjs → index-Ckj5oSGb.mjs} +57 -9
  16. package/dist/{index-2sU4ya6z.mjs → index-Cp-_VJLP.mjs} +4 -4
  17. package/dist/{index-CnVcCa5O.js → index-DHKoOk4o.js} +48 -0
  18. package/dist/{index-BBU_vIrY.mjs → index-DWrKuZCO.mjs} +65 -53
  19. package/dist/{index-C6A-3gBz.mjs → index-HgCW5XhG.mjs} +4 -4
  20. package/dist/{index-C93pA9Jv.js → index-ISfgFSXE.js} +41 -29
  21. package/dist/{index-B5WurBlm.mjs → index-O8N4FTK9.mjs} +2 -2
  22. package/dist/index.cjs +67 -66
  23. package/dist/index.mjs +53 -52
  24. package/dist/layout/index.mjs +5 -5
  25. package/dist/providers/index.mjs +2 -2
  26. package/dist/types/content/seo/index.d.ts +56 -3
  27. package/dist/types/index.d.ts +1 -1
  28. package/dist/types/seo/index.d.ts +2 -0
  29. package/dist/types/seo/open-graph/index.d.ts +11 -0
  30. package/dist/utils/api/strapi-seo.d.ts +2 -13
  31. package/dist/utils/index.cjs +36 -35
  32. package/dist/utils/index.d.ts +1 -1
  33. package/dist/utils/index.mjs +25 -24
  34. package/dist/utils/seo/index.d.ts +2 -0
  35. package/dist/utils/{json-ld → seo/json-ld}/index.d.ts +1 -1
  36. package/dist/utils/seo/open-graph/index.d.ts +15 -0
  37. package/package.json +2 -2
  38. package/dist/components/seo/types.d.ts +0 -14
  39. /package/dist/types/{json-ld → seo/json-ld}/index.d.ts +0 -0
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("../index-C93pA9Jv.js");
3
+ const index = require("../index-ISfgFSXE.js");
4
4
  const index$1 = require("../index-CxuOu0E2.js");
5
5
  const index$2 = require("../index-DDg_PkD2.js");
6
6
  const index$3 = require("../index-DAPaiozu.js");
@@ -1,31 +1,31 @@
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-BBU_vIrY.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-2sU4ya6z.mjs";
1
+ import { A, a, b, c, d, e, f, B, g, C, h, i, F, j, k, G, l, m, n, o, H, I, L, N, P, p, S, q, T, r, s, t } from "../index-DWrKuZCO.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-Cp-_VJLP.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-B5WurBlm.mjs";
4
+ import { I as I2, L as L3 } from "../index-O8N4FTK9.mjs";
5
5
  export {
6
6
  A as ActionButton,
7
7
  a as ArticleCard,
8
8
  b as ArticleCardGrid,
9
9
  c as ArticleInfoCard,
10
- n as ArticleMeta,
11
- o as Author,
12
- d as AuthorCard,
10
+ d as ArticleMeta,
11
+ e as Author,
12
+ f as AuthorCard,
13
13
  B as BonusCard,
14
- e as BonusCardGrid,
14
+ g as BonusCardGrid,
15
15
  C2 as CasinoTable,
16
16
  C as Center,
17
- r as Contacts,
17
+ h as Contacts,
18
18
  a2 as Container,
19
- q as CookiePolicy,
19
+ i as CookiePolicy,
20
20
  b2 as CopyText,
21
21
  F as Faq,
22
- f as FeatureCard,
23
- g as FeatureCardGrid,
22
+ j as FeatureCard,
23
+ k as FeatureCardGrid,
24
24
  G as GameCard,
25
- h as GameCardGrid,
26
- i as GameDemo,
27
- j as GameInfo,
28
- p as Grid,
25
+ l as GameCardGrid,
26
+ m as GameDemo,
27
+ n as GameInfo,
28
+ o as Grid,
29
29
  H2 as H1,
30
30
  a3 as H2,
31
31
  b3 as H3,
@@ -39,16 +39,16 @@ export {
39
39
  N as NotFound,
40
40
  O as OL,
41
41
  P2 as P,
42
- s as PrivacyPolicy,
43
- P as ProsCons,
42
+ P as PrivacyPolicy,
43
+ p as ProsCons,
44
44
  R as Rating,
45
45
  S as Seo,
46
46
  S2 as SocialNetwork,
47
47
  d2 as SocialNetworks,
48
- k as StrapiContentRenderer,
48
+ q as StrapiContentRenderer,
49
49
  T as Table,
50
- l as Tabs,
51
- t as TermsAndConditions,
52
- m as Tip,
50
+ r as Tabs,
51
+ s as TermsAndConditions,
52
+ t as Tip,
53
53
  U as UL
54
54
  };
@@ -1,8 +1,8 @@
1
1
  import { FC } from 'react';
2
- import { IHrefLang } from '../../../types';
2
+ import { ISeo } from '../../../types';
3
3
  type HrefLangsProps = {
4
4
  siteName: string;
5
- hrefLangs: IHrefLang[];
5
+ hrefLangs: ISeo['hrefLangs'];
6
6
  };
7
7
  declare const HrefLangs: FC<HrefLangsProps>;
8
8
  export default HrefLangs;
@@ -1,13 +1,7 @@
1
1
  import { FC, PropsWithChildren } from 'react';
2
- import { SeoCanonical, SeoDescription, SeoHrefLangs, SeoLocale, SeoStructuredData, SeoTitle } from './types';
3
- type SeoProps = PropsWithChildren<{
2
+ import { ISeo } from '../../types';
3
+ type SeoProps = PropsWithChildren<ISeo & {
4
4
  pathname: Location['pathname'];
5
- locale?: SeoLocale;
6
- title?: SeoTitle;
7
- description?: SeoDescription;
8
- canonicalUrl?: SeoCanonical;
9
- hrefLangs?: SeoHrefLangs;
10
- structuredData?: SeoStructuredData;
11
5
  }>;
12
6
  declare const Seo: FC<SeoProps>;
13
7
  export default Seo;
@@ -0,0 +1,8 @@
1
+ import { FC } from 'react';
2
+ import { IOpenGraph, IOpenGraphMetaItem } from '../../../types';
3
+ type OpenGraphProps = {
4
+ meta: IOpenGraphMetaItem[];
5
+ options?: IOpenGraph['options'];
6
+ };
7
+ declare const OpenGraph: FC<OpenGraphProps>;
8
+ export default OpenGraph;
@@ -1,3 +1,3 @@
1
- import { ISeoMetaItemPlaceholders, SeoDescription, SeoTitle } from './types';
1
+ import { ISeoMetaItemPlaceholders, SeoMetaItem } from '../../types';
2
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;
3
+ export declare function getSeoMetaItem<T extends SeoMetaItem>(item: NonNullable<T>, placeholders: ISeoMetaItemPlaceholders): string;
@@ -1,5 +1,5 @@
1
1
  import { u } from "../index-DHURrUMW.mjs";
2
- import { u as u2 } from "../index-BS5T9Il4.mjs";
2
+ import { u as u2 } from "../index-CKrYF12N.mjs";
3
3
  export {
4
4
  u as useLocalization,
5
5
  u2 as usePrimaryColors
@@ -1,4 +1,4 @@
1
- import { d as dictionary, c as dictionary$1, e as dictionary$2, f as dictionary$3, g as dictionary$4, h as dictionary$5, i as dictionary$6, j as dictionary$7, k as dictionary$8, l as dictionary$9, m as dictionary$a, n as dictionary$b, o as dictionary$c, p as dictionary$d, q as dictionary$e, r as dictionary$f, s as dictionary$g, t as dictionary$h, u as dictionary$i, v as dictionary$j, w as dictionary$k, x as dictionary$l, y as dictionary$m } from "../index-C6A-3gBz.mjs";
1
+ import { d as dictionary, c as dictionary$1, e as dictionary$2, f as dictionary$3, g as dictionary$4, h as dictionary$5, i as dictionary$6, j as dictionary$7, k as dictionary$8, l as dictionary$9, m as dictionary$a, n as dictionary$b, o as dictionary$c, p as dictionary$d, q as dictionary$e, r as dictionary$f, s as dictionary$g, t as dictionary$h, u as dictionary$i, v as dictionary$j, w as dictionary$k, x as dictionary$l, y as dictionary$m } from "../index-HgCW5XhG.mjs";
2
2
  const resources = {
3
3
  bg: dictionary$m,
4
4
  bn: dictionary$l,
@@ -2,9 +2,9 @@ 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-B5WurBlm.mjs";
5
+ import { I as Image, L as Link } from "./index-O8N4FTK9.mjs";
6
6
  import "./index-BJRvnR8Q.mjs";
7
- import "./index-C6A-3gBz.mjs";
7
+ import "./index-HgCW5XhG.mjs";
8
8
  import "@chakra-ui/icons";
9
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";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const index = require("./index-CAjUjAgI.js");
3
- const index$1 = require("./index-CnVcCa5O.js");
3
+ const index$1 = require("./index-DHKoOk4o.js");
4
4
  const DUMMY_PAGE_TYPE = "DUMMY";
5
5
  const NavigationSlug = {
6
6
  HEADER: "header-navigation",
@@ -126,33 +126,33 @@ function extractReview(content, seo, createdAt, updatedAt) {
126
126
  }
127
127
  return null;
128
128
  }
129
- function extractSeoData(pageData, pageContext) {
130
- const result = {
131
- locale: null,
132
- meta: { title: null, description: null },
133
- canonicalUrl: null,
134
- hrefLangs: [],
135
- structuredData: null
136
- };
129
+ function buildSeoFromStrapi(pageData, pageContext) {
130
+ const result = {};
137
131
  if (index$1.isStrapiPageContext(pageContext)) {
138
- result.hrefLangs = pageContext.hrefLangs ?? [];
132
+ result.hrefLangs = pageContext.hrefLangs;
139
133
  }
140
134
  if (index$1.isStrapiPageData(pageData)) {
141
135
  const { locale, seo, canonicalUrl, author, content, createdAt, updatedAt } = pageData ?? {};
142
136
  const { metaTitle, metaDescription } = seo ?? {};
143
- result.locale = locale ?? null;
144
- result.canonicalUrl = canonicalUrl ?? null;
137
+ result.lang = locale;
138
+ result.canonicalUrl = canonicalUrl;
145
139
  result.meta = { title: metaTitle ?? null, description: metaDescription ?? null };
146
140
  const structuredDataContent = {};
141
+ const openGraphContent = {};
147
142
  if (index$1.isStrapiContent(content)) {
148
143
  const review = extractReview(content, seo ?? null, createdAt ?? null, updatedAt ?? null);
149
144
  const game = extractGame(content);
150
145
  if (review && game) {
151
146
  structuredDataContent.review = review;
152
147
  structuredDataContent.game = game;
148
+ openGraphContent.article = {
149
+ createdAt: review.publishedAt,
150
+ updatedAt: review.updatedAt || review.publishedAt
151
+ };
153
152
  const reviewAuthor = extractAuthor(author ?? null);
154
153
  if (reviewAuthor) {
155
154
  structuredDataContent.author = reviewAuthor;
155
+ openGraphContent.article.author = reviewAuthor.name;
156
156
  }
157
157
  }
158
158
  }
@@ -161,6 +161,10 @@ function extractSeoData(pageData, pageContext) {
161
161
  entity: "game-review",
162
162
  content: structuredDataContent
163
163
  } : null;
164
+ result.openGraph = openGraphContent ? {
165
+ options: { withTwitterCard: true },
166
+ content: openGraphContent
167
+ } : null;
164
168
  }
165
169
  return result;
166
170
  }
@@ -190,7 +194,7 @@ function getLocales(defaultLocaleCode, locales) {
190
194
  return 0;
191
195
  });
192
196
  }
193
- exports.extractSeoData = extractSeoData;
197
+ exports.buildSeoFromStrapi = buildSeoFromStrapi;
194
198
  exports.getLocale = getLocale;
195
199
  exports.getLocales = getLocales;
196
200
  exports.getNavigation = getNavigation;
@@ -58,10 +58,10 @@ function formatNumber(number, options) {
58
58
  return `${formatter.format(round(number, precision))}${postfix}`;
59
59
  }
60
60
  export {
61
- getCurrentMonth as a,
62
- formatNumber as b,
61
+ formatNumber as a,
62
+ getCurrentYear as b,
63
63
  formatDate as f,
64
- getCurrentYear as g,
64
+ getCurrentMonth as g,
65
65
  round as r,
66
66
  toFixedTwo as t
67
67
  };
@@ -12,8 +12,8 @@ function isAbsolutePath(path = "") {
12
12
  return /^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(path);
13
13
  }
14
14
  export {
15
- buildCanonicalUrl as a,
16
- buildPath as b,
17
- isAbsolutePath as c,
18
- isRelativePath as i
15
+ buildPath as a,
16
+ buildCanonicalUrl as b,
17
+ isRelativePath as c,
18
+ isAbsolutePath as i
19
19
  };
@@ -1,5 +1,5 @@
1
- import { i as isRelativePath } from "./index-CQC6DRGf.mjs";
2
- import { c as isStrapiPageContext, b as isStrapiPageData, i as isStrapiContent, a as isStrapiRichText } from "./index-CoNbTY7l.mjs";
1
+ import { c as isRelativePath } from "./index-Bhur6qbX.mjs";
2
+ import { k as isStrapiPageContext, l as isStrapiPageData, j as isStrapiContent, m as isStrapiRichText } from "./index-Ckj5oSGb.mjs";
3
3
  const DUMMY_PAGE_TYPE = "DUMMY";
4
4
  const NavigationSlug = {
5
5
  HEADER: "header-navigation",
@@ -125,33 +125,33 @@ function extractReview(content, seo, createdAt, updatedAt) {
125
125
  }
126
126
  return null;
127
127
  }
128
- function extractSeoData(pageData, pageContext) {
129
- const result = {
130
- locale: null,
131
- meta: { title: null, description: null },
132
- canonicalUrl: null,
133
- hrefLangs: [],
134
- structuredData: null
135
- };
128
+ function buildSeoFromStrapi(pageData, pageContext) {
129
+ const result = {};
136
130
  if (isStrapiPageContext(pageContext)) {
137
- result.hrefLangs = pageContext.hrefLangs ?? [];
131
+ result.hrefLangs = pageContext.hrefLangs;
138
132
  }
139
133
  if (isStrapiPageData(pageData)) {
140
134
  const { locale, seo, canonicalUrl, author, content, createdAt, updatedAt } = pageData ?? {};
141
135
  const { metaTitle, metaDescription } = seo ?? {};
142
- result.locale = locale ?? null;
143
- result.canonicalUrl = canonicalUrl ?? null;
136
+ result.lang = locale;
137
+ result.canonicalUrl = canonicalUrl;
144
138
  result.meta = { title: metaTitle ?? null, description: metaDescription ?? null };
145
139
  const structuredDataContent = {};
140
+ const openGraphContent = {};
146
141
  if (isStrapiContent(content)) {
147
142
  const review = extractReview(content, seo ?? null, createdAt ?? null, updatedAt ?? null);
148
143
  const game = extractGame(content);
149
144
  if (review && game) {
150
145
  structuredDataContent.review = review;
151
146
  structuredDataContent.game = game;
147
+ openGraphContent.article = {
148
+ createdAt: review.publishedAt,
149
+ updatedAt: review.updatedAt || review.publishedAt
150
+ };
152
151
  const reviewAuthor = extractAuthor(author ?? null);
153
152
  if (reviewAuthor) {
154
153
  structuredDataContent.author = reviewAuthor;
154
+ openGraphContent.article.author = reviewAuthor.name;
155
155
  }
156
156
  }
157
157
  }
@@ -160,6 +160,10 @@ function extractSeoData(pageData, pageContext) {
160
160
  entity: "game-review",
161
161
  content: structuredDataContent
162
162
  } : null;
163
+ result.openGraph = openGraphContent ? {
164
+ options: { withTwitterCard: true },
165
+ content: openGraphContent
166
+ } : null;
163
167
  }
164
168
  return result;
165
169
  }
@@ -190,9 +194,9 @@ function getLocales(defaultLocaleCode, locales) {
190
194
  });
191
195
  }
192
196
  export {
193
- getLocale as a,
194
- getLocales as b,
197
+ getLocales as a,
198
+ buildSeoFromStrapi as b,
195
199
  getNavigation as c,
196
- extractSeoData as e,
197
- getSiteName as g
200
+ getSiteName as d,
201
+ getLocale as g
198
202
  };
@@ -1,6 +1,6 @@
1
1
  import { useColorModeValue } from "@chakra-ui/react";
2
2
  import "./index-BJRvnR8Q.mjs";
3
- import "./index-C6A-3gBz.mjs";
3
+ import "./index-HgCW5XhG.mjs";
4
4
  import { L as LIGHT_THEME_COLOR, D as DARK_THEME_COLOR } from "./index-BRVKhbs6.mjs";
5
5
  function usePrimaryColors() {
6
6
  const color = useColorModeValue(LIGHT_THEME_COLOR, DARK_THEME_COLOR);
@@ -124,6 +124,53 @@ function buildGameReviewSchema(params) {
124
124
  }
125
125
  };
126
126
  }
127
+ function buildOpenGraphMeta(params) {
128
+ const { site, page, lang, content } = params;
129
+ const { article, image } = content ?? {};
130
+ const type = article ? "article" : "website";
131
+ const meta = [
132
+ { property: "og:site_name", content: site.name },
133
+ { property: "og:locale", content: lang },
134
+ { property: "og:type", content: type },
135
+ { property: "og:url", content: page.url },
136
+ { property: "og:title", content: page.title },
137
+ { property: "og:description", content: page.description }
138
+ ];
139
+ if (image) {
140
+ const imageMeta = [
141
+ { property: "og:image", content: image.url },
142
+ { property: "og:image:alt", content: image.alt }
143
+ ];
144
+ if (image.width && image.height) {
145
+ imageMeta.push(
146
+ { property: "og:image:width", content: String(image.width) },
147
+ { property: "og:image:height", content: String(image.height) }
148
+ );
149
+ }
150
+ meta.push(...imageMeta);
151
+ }
152
+ if (article) {
153
+ const articleMeta = [
154
+ { property: "og:article:published_time", content: article.createdAt },
155
+ { property: "og:article:modified_time", content: article.updatedAt }
156
+ ];
157
+ if (article.author) {
158
+ articleMeta.push({ property: "og:article:author", content: article.author });
159
+ }
160
+ if (article.section) {
161
+ articleMeta.push({ property: "og:article:section", content: article.section });
162
+ }
163
+ if (article.tags && article.tags.length) {
164
+ const articleTags = article.tags.map((tag) => ({
165
+ property: "og:article:tag",
166
+ content: tag
167
+ }));
168
+ articleMeta.push(...articleTags);
169
+ }
170
+ meta.push(...articleMeta);
171
+ }
172
+ return meta;
173
+ }
127
174
  function randomComparator() {
128
175
  return Math.random() - 0.5;
129
176
  }
@@ -136,17 +183,18 @@ function getSeededRandomComparator(seed) {
136
183
  return () => seededRandom(safeSeed + index++) - 0.5;
137
184
  }
138
185
  export {
139
- isStrapiRichText as a,
140
- isStrapiPageData as b,
141
- isStrapiPageContext as c,
142
- buildGraph as d,
143
- buildOrganizationSchema as e,
186
+ buildGraph as a,
187
+ buildGameReviewSchema as b,
188
+ buildOpenGraphMeta as c,
189
+ buildOrganizationSchema as d,
190
+ buildWebpageSchema as e,
144
191
  buildWebsiteSchema as f,
145
192
  getCurrencySymbol as g,
146
193
  getEntitySchema as h,
147
- isStrapiContent as i,
148
- buildWebpageSchema as j,
149
- buildGameReviewSchema as k,
150
- getSeededRandomComparator as l,
194
+ getSeededRandomComparator as i,
195
+ isStrapiContent as j,
196
+ isStrapiPageContext as k,
197
+ isStrapiPageData as l,
198
+ isStrapiRichText as m,
151
199
  randomComparator as r
152
200
  };
@@ -1,15 +1,15 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { Flex, Container as Container$1, useColorModeValue, useToast, useClipboard, Text, IconButton, Button, Box, Stack, Card, Badge, Td, Tr, Table, Thead, Th, Tbody } from "@chakra-ui/react";
3
- import { L as Link, a as useSiteContext, I as Image, u as usePageContext } from "./index-B5WurBlm.mjs";
3
+ import { L as Link, a as useSiteContext, I as Image, u as usePageContext } from "./index-O8N4FTK9.mjs";
4
4
  import "@mdx-js/react";
5
5
  import { useTranslation } from "react-i18next";
6
6
  import { A as Animation } from "./index-BJRvnR8Q.mjs";
7
- import { a as CasinoCharacteristic, C as CasinoTableColumn } from "./index-C6A-3gBz.mjs";
7
+ import { C as CasinoCharacteristic, a as CasinoTableColumn } from "./index-HgCW5XhG.mjs";
8
8
  import { CheckIcon, CopyIcon, StarIcon } from "@chakra-ui/icons";
9
9
  import "react";
10
10
  import "react-medium-image-zoom";
11
- import { u as usePrimaryColors } from "./index-BS5T9Il4.mjs";
12
- import { b as formatNumber } from "./index-BPthShL-.mjs";
11
+ import { u as usePrimaryColors } from "./index-CKrYF12N.mjs";
12
+ import { a as formatNumber } from "./index-BVAydcbQ.mjs";
13
13
  const FacebookIcon = (props) => {
14
14
  return /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", "aria-label": "Facebook", ...props, children: [
15
15
  /* @__PURE__ */ jsx("rect", { x: "1", y: "1", width: "22", height: "22", rx: "5", fill: "none", stroke: "currentColor", strokeWidth: "2" }),
@@ -125,6 +125,53 @@ function buildGameReviewSchema(params) {
125
125
  }
126
126
  };
127
127
  }
128
+ function buildOpenGraphMeta(params) {
129
+ const { site, page, lang, content } = params;
130
+ const { article, image } = content ?? {};
131
+ const type = article ? "article" : "website";
132
+ const meta = [
133
+ { property: "og:site_name", content: site.name },
134
+ { property: "og:locale", content: lang },
135
+ { property: "og:type", content: type },
136
+ { property: "og:url", content: page.url },
137
+ { property: "og:title", content: page.title },
138
+ { property: "og:description", content: page.description }
139
+ ];
140
+ if (image) {
141
+ const imageMeta = [
142
+ { property: "og:image", content: image.url },
143
+ { property: "og:image:alt", content: image.alt }
144
+ ];
145
+ if (image.width && image.height) {
146
+ imageMeta.push(
147
+ { property: "og:image:width", content: String(image.width) },
148
+ { property: "og:image:height", content: String(image.height) }
149
+ );
150
+ }
151
+ meta.push(...imageMeta);
152
+ }
153
+ if (article) {
154
+ const articleMeta = [
155
+ { property: "og:article:published_time", content: article.createdAt },
156
+ { property: "og:article:modified_time", content: article.updatedAt }
157
+ ];
158
+ if (article.author) {
159
+ articleMeta.push({ property: "og:article:author", content: article.author });
160
+ }
161
+ if (article.section) {
162
+ articleMeta.push({ property: "og:article:section", content: article.section });
163
+ }
164
+ if (article.tags && article.tags.length) {
165
+ const articleTags = article.tags.map((tag) => ({
166
+ property: "og:article:tag",
167
+ content: tag
168
+ }));
169
+ articleMeta.push(...articleTags);
170
+ }
171
+ meta.push(...articleMeta);
172
+ }
173
+ return meta;
174
+ }
128
175
  function randomComparator() {
129
176
  return Math.random() - 0.5;
130
177
  }
@@ -138,6 +185,7 @@ function getSeededRandomComparator(seed) {
138
185
  }
139
186
  exports.buildGameReviewSchema = buildGameReviewSchema;
140
187
  exports.buildGraph = buildGraph;
188
+ exports.buildOpenGraphMeta = buildOpenGraphMeta;
141
189
  exports.buildOrganizationSchema = buildOrganizationSchema;
142
190
  exports.buildWebpageSchema = buildWebpageSchema;
143
191
  exports.buildWebsiteSchema = buildWebsiteSchema;