@anywayseo/tools 5.10.0 → 5.11.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.
@@ -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,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-hGzNO4AL.js");
4
+ const index$1 = require("../index-DhhGhwm2.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-D-jM-cHx.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-CG7F6SYt.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-DqMBmwe5.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-B6wLLS6t.mjs";
5
5
  export {
6
6
  A as ActionButton,
7
7
  a as ArticleCard,
@@ -1,11 +1,12 @@
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, 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
+ canonical?: SeoCanonical;
9
+ hrefLangs?: SeoHrefLangs;
9
10
  }>;
10
11
  declare const Seo: FC<SeoProps>;
11
12
  export default Seo;
@@ -1,6 +1,13 @@
1
- export interface ISeoItemPlaceholders {
1
+ import { IHrefLang, ILocale, ISeo, 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<ISeo['title'] | SeoMetaItemGetter>;
10
+ export type SeoDescription = Nullable<ISeo['description'] | SeoMetaItemGetter>;
11
+ export type SeoCanonical = Nullable<string>;
12
+ export type SeoHrefLangs = IHrefLang[];
13
+ export {};
@@ -1,2 +1,2 @@
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 getSeoMetaItem<T extends SeoTitle | SeoDescription>(item: NonNullable<T>, placeholders: ISeoMetaItemPlaceholders): string;
@@ -9,7 +9,7 @@ import "./index-BJRvnR8Q.mjs";
9
9
  import "./index-RzByAgHO.mjs";
10
10
  import "@chakra-ui/icons";
11
11
  import { u as useLocalization } from "./index-DHURrUMW.mjs";
12
- import { a as isAbsolutePath, i as isRelativePath } from "./index-Bph7a3PR.mjs";
12
+ import { c as isAbsolutePath, i as isRelativePath } from "./index-DSP348cK.mjs";
13
13
  const SiteContext = createContext(null);
14
14
  const SiteProvider = ({ children, ...context }) => {
15
15
  const value = useMemo(() => context, []);
@@ -1,14 +1,18 @@
1
1
  "use strict";
2
+ const index = require("./index-C3n63_nP.js");
2
3
  const DUMMY_PAGE_TYPE = "DUMMY";
3
4
  const NavigationSlug = {
4
5
  HEADER: "header-navigation",
5
6
  FOOTER: "footer-navigation"
6
7
  };
7
8
  function isValidPath(value) {
8
- return typeof value === "string" && (value === "" || value.startsWith("/"));
9
+ return typeof value === "string" && (value === "" || index.isRelativePath(value));
9
10
  }
10
11
  function isValidType(value) {
11
- return typeof value === "string" && value !== DUMMY_PAGE_TYPE;
12
+ return typeof value === "string" && value.toUpperCase() !== DUMMY_PAGE_TYPE;
13
+ }
14
+ function isValidTitle(value) {
15
+ return typeof value === "string" && value.toUpperCase() !== DUMMY_PAGE_TYPE;
12
16
  }
13
17
  function transformNavItems(items) {
14
18
  if (!items || !items.length) {
@@ -17,7 +21,7 @@ function transformNavItems(items) {
17
21
  const transformed = [];
18
22
  items.forEach((item) => {
19
23
  var _a;
20
- if (item && item.title && isValidType(item.type) && isValidPath(item.path)) {
24
+ if (item && isValidTitle(item.title) && isValidType(item.type) && isValidPath(item.path)) {
21
25
  const isNavGroup = (_a = item.items) == null ? void 0 : _a.length;
22
26
  transformed.push({
23
27
  label: item.title,
@@ -2,12 +2,17 @@
2
2
  function buildPath(slug, parentSlug) {
3
3
  return parentSlug === "" ? slug : `${parentSlug}/${slug}`;
4
4
  }
5
+ function buildCanonicalUrl(domain, path) {
6
+ const cleanPath = path.split(/[?#]/)[0];
7
+ return `https://${domain}${cleanPath === "/" ? "" : cleanPath}`;
8
+ }
5
9
  function isRelativePath(path = "") {
6
10
  return path.startsWith("/");
7
11
  }
8
12
  function isAbsolutePath(path = "") {
9
13
  return /^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(path);
10
14
  }
15
+ exports.buildCanonicalUrl = buildCanonicalUrl;
11
16
  exports.buildPath = buildPath;
12
17
  exports.isAbsolutePath = isAbsolutePath;
13
18
  exports.isRelativePath = isRelativePath;
@@ -1,24 +1,33 @@
1
1
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
- import { useColorModeValue, Box, Text, Flex, Collapse, Button, Stack, Center as Center$1, SimpleGrid, Card, CardBody, CardFooter, CardHeader, Heading, Popover, PopoverTrigger, Portal, PopoverContent, PopoverBody, Accordion, AccordionItem, AccordionButton, AccordionIcon, AccordionPanel, LinkBox, LinkOverlay, IconButton, AbsoluteCenter, Spinner, Alert, AlertIcon, AlertTitle, AlertDescription, useDisclosure, Divider, Circle, List as List$1, ListItem, useToast, VStack, FormControl, FormLabel, InputGroup, InputLeftElement, Input, Textarea, ListIcon, TableContainer, Table as Table$1, Thead, Tr, Th, Tbody, Td, TableCaption, Tabs as Tabs$1, TabList, Tab, TabPanels, TabPanel } from "@chakra-ui/react";
2
+ import { useColorModeValue, Flex, Text, Box, Collapse, Button, Stack, Center as Center$1, SimpleGrid, Card, CardBody, CardFooter, CardHeader, Heading, Popover, PopoverTrigger, Portal, PopoverContent, PopoverBody, Accordion, AccordionItem, AccordionButton, AccordionIcon, AccordionPanel, LinkBox, LinkOverlay, IconButton, AbsoluteCenter, Spinner, Alert, AlertIcon, AlertTitle, AlertDescription, useDisclosure, Divider, Circle, List as List$1, ListItem, useToast, VStack, FormControl, FormLabel, InputGroup, InputLeftElement, Input, Textarea, ListIcon, TableContainer, Table as Table$1, Thead, Tr, Th, Tbody, Td, TableCaption, Tabs as Tabs$1, TabList, Tab, TabPanels, TabPanel } from "@chakra-ui/react";
3
3
  import { useTranslation } from "react-i18next";
4
4
  import { useMDXComponents } from "@mdx-js/react";
5
- import { u as usePageContext, I as Image, L as Link, a as useSiteContext } from "./index-ClIPWZ3z.mjs";
5
+ import { u as usePageContext, I as Image, L as Link, a as useSiteContext } from "./index-B6wLLS6t.mjs";
6
6
  import "./index-BJRvnR8Q.mjs";
7
7
  import { b as GameCharacteristic, G as GameVolatility } from "./index-RzByAgHO.mjs";
8
- import { StarIcon, CloseIcon, ViewOffIcon, ViewIcon, EmailIcon, WarningIcon, CheckCircleIcon } from "@chakra-ui/icons";
8
+ import { AtSignIcon, TimeIcon, CalendarIcon, StarIcon, CloseIcon, ViewOffIcon, ViewIcon, EmailIcon, WarningIcon, CheckCircleIcon } from "@chakra-ui/icons";
9
9
  import "react-medium-image-zoom";
10
10
  import { useRef, useState, useLayoutEffect, Fragment as Fragment$1, useMemo } from "react";
11
- import { d as SocialNetworks, L as LinkButton, R as Rating } from "./index-D9i6mZaH.mjs";
11
+ import { d as SocialNetworks, L as LinkButton, R as Rating } from "./index-DqMBmwe5.mjs";
12
12
  import { a as Heading2, H as Heading1, P as Paragraph, U as Unordered, O as Ordered } from "./index-BEjKnOZA.mjs";
13
+ import { a as buildCanonicalUrl } from "./index-DSP348cK.mjs";
13
14
  import { f as formatDate, b as formatNumber, a as getCurrentMonth, g as getCurrentYear } from "./index-BPthShL-.mjs";
14
15
  import { u as usePrimaryColors } from "./index-C1kr7Vd-.mjs";
15
16
  import { a as getSeededRandomComparator, r as randomComparator, g as getCurrencySymbol } from "./index-BeJTy4iY.mjs";
16
17
  import { t } from "i18next";
17
18
  import Markdown from "react-markdown";
18
- const ArticleMetaItem = ({ label, value }) => {
19
+ const ArticleMetaIconMap = {
20
+ date: /* @__PURE__ */ jsx(CalendarIcon, {}),
21
+ time: /* @__PURE__ */ jsx(TimeIcon, {}),
22
+ author: /* @__PURE__ */ jsx(AtSignIcon, {})
23
+ };
24
+ const ArticleMetaItem = ({ label, value, icon }) => {
19
25
  const color = useColorModeValue("gray.600", "gray.400");
20
- return /* @__PURE__ */ jsxs(Box, { children: [
21
- /* @__PURE__ */ jsx(Text, { as: "span", color, children: label }),
26
+ return /* @__PURE__ */ jsxs(Flex, { lineHeight: 6, children: [
27
+ /* @__PURE__ */ jsxs(Text, { as: "span", display: "inline-flex", alignItems: "center", gap: 1, me: 1, color, children: [
28
+ !!icon && ArticleMetaIconMap[icon],
29
+ label
30
+ ] }),
22
31
  value
23
32
  ] });
24
33
  };
@@ -30,18 +39,20 @@ const ArticleMeta = ({ createdAt, updatedAt, minutesToRead, authorName, variant
30
39
  !!publicationDate && /* @__PURE__ */ jsx(
31
40
  ArticleMetaItem,
32
41
  {
33
- label: variant === "full" ? `📅 ${t2("meta.publicationDate")}` : "📅 ",
42
+ icon: "date",
43
+ label: variant === "full" ? t2("meta.publicationDate") : "",
34
44
  value: publicationDate
35
45
  }
36
46
  ),
37
47
  !!minutesToRead && /* @__PURE__ */ jsx(
38
48
  ArticleMetaItem,
39
49
  {
40
- label: variant === "full" ? `⏳ ${t2("meta.readingTime.label")}` : "⏳ ",
50
+ icon: "time",
51
+ label: variant === "full" ? t2("meta.readingTime.label") : "",
41
52
  value: t2("meta.readingTime.count", { count: minutesToRead })
42
53
  }
43
54
  ),
44
- !!authorName && /* @__PURE__ */ jsx(ArticleMetaItem, { label: variant === "full" ? `🧑🏻‍💻 ${t2("meta.author")}` : "🧑🏻‍💻 ", value: authorName })
55
+ !!authorName && /* @__PURE__ */ jsx(ArticleMetaItem, { icon: "author", label: variant === "full" ? t2("meta.author") : "", value: authorName })
45
56
  ] });
46
57
  };
47
58
  const ONE_LINE_HEIGHT = 24;
@@ -946,30 +957,31 @@ function replacePlaceholders(text, placeholders) {
946
957
  });
947
958
  return text;
948
959
  }
949
- const Seo = ({ children, title, description, lang, hrefLangs = [] }) => {
950
- const { metadata } = useSiteContext();
951
- const { name: siteName, lang: defaultLang, seo } = metadata;
952
- const { title: defaultTitle, description: defaultDescription } = seo;
953
- const siteLang = lang || defaultLang;
960
+ function getSeoMetaItem(item, placeholders) {
961
+ if (typeof item === "string") {
962
+ return replacePlaceholders(item, placeholders);
963
+ }
964
+ return item(placeholders);
965
+ }
966
+ const Seo = ({ children, pathname, locale, title, description, canonical, hrefLangs = [] }) => {
967
+ const { metadata: siteMetadata } = useSiteContext();
968
+ const { name: siteName, lang: siteLocale, seo: siteSeo } = siteMetadata;
969
+ const { title: siteTitle, description: siteDescription } = siteSeo;
970
+ const lang = locale || siteLocale;
954
971
  const placeholders = useMemo(
955
972
  () => ({
956
973
  siteName,
957
- currentYear: getCurrentYear(siteLang),
958
- currentMonth: getCurrentMonth(siteLang)
974
+ currentYear: getCurrentYear(lang),
975
+ currentMonth: getCurrentMonth(lang)
959
976
  }),
960
- [siteName, siteLang]
977
+ [siteName, lang]
961
978
  );
962
979
  return /* @__PURE__ */ jsxs(Fragment, { children: [
963
- /* @__PURE__ */ jsx("html", { lang: siteLang }),
964
- /* @__PURE__ */ jsx("title", { children: title ? typeof title === "string" ? replacePlaceholders(title, placeholders) : title(placeholders) : defaultTitle }),
965
- /* @__PURE__ */ jsx(
966
- "meta",
967
- {
968
- name: "description",
969
- content: description ? typeof description === "string" ? replacePlaceholders(description, placeholders) : description(placeholders) : defaultDescription
970
- }
971
- ),
972
- hrefLangs.map(({ href, hrefLang }, index) => /* @__PURE__ */ jsx("link", { rel: "alternate", hrefLang, href: `https://${siteName}${href}` }, index)),
980
+ /* @__PURE__ */ jsx("html", { lang }),
981
+ /* @__PURE__ */ jsx("title", { children: getSeoMetaItem(title ?? siteTitle, placeholders) }),
982
+ /* @__PURE__ */ jsx("meta", { name: "description", content: getSeoMetaItem(description ?? siteDescription, placeholders) }),
983
+ /* @__PURE__ */ jsx("link", { rel: "canonical", href: canonical ?? buildCanonicalUrl(siteName, pathname) }),
984
+ hrefLangs.map(({ href, hrefLang }, index) => /* @__PURE__ */ jsx("link", { rel: "alternate", hrefLang, href: buildCanonicalUrl(siteName, href) }, index)),
973
985
  children
974
986
  ] });
975
987
  };
@@ -1,13 +1,17 @@
1
+ import { i as isRelativePath } from "./index-DSP348cK.mjs";
1
2
  const DUMMY_PAGE_TYPE = "DUMMY";
2
3
  const NavigationSlug = {
3
4
  HEADER: "header-navigation",
4
5
  FOOTER: "footer-navigation"
5
6
  };
6
7
  function isValidPath(value) {
7
- return typeof value === "string" && (value === "" || value.startsWith("/"));
8
+ return typeof value === "string" && (value === "" || isRelativePath(value));
8
9
  }
9
10
  function isValidType(value) {
10
- return typeof value === "string" && value !== DUMMY_PAGE_TYPE;
11
+ return typeof value === "string" && value.toUpperCase() !== DUMMY_PAGE_TYPE;
12
+ }
13
+ function isValidTitle(value) {
14
+ return typeof value === "string" && value.toUpperCase() !== DUMMY_PAGE_TYPE;
11
15
  }
12
16
  function transformNavItems(items) {
13
17
  if (!items || !items.length) {
@@ -16,7 +20,7 @@ function transformNavItems(items) {
16
20
  const transformed = [];
17
21
  items.forEach((item) => {
18
22
  var _a;
19
- if (item && item.title && isValidType(item.type) && isValidPath(item.path)) {
23
+ if (item && isValidTitle(item.title) && isValidType(item.type) && isValidPath(item.path)) {
20
24
  const isNavGroup = (_a = item.items) == null ? void 0 : _a.length;
21
25
  transformed.push({
22
26
  label: item.title,
@@ -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-B6wLLS6t.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,11 +3,11 @@ const jsxRuntime = require("react/jsx-runtime");
3
3
  const react = require("@mdx-js/react");
4
4
  require("react-i18next");
5
5
  require("@chakra-ui/react");
6
- const index$1 = require("./index-B4M1IKzL.js");
6
+ const index$1 = require("./index-D-jM-cHx.js");
7
7
  require("./index-C6MG_f24.js");
8
8
  require("./index-CBRFCYhV.js");
9
- require("react");
10
9
  require("@chakra-ui/icons");
10
+ require("react");
11
11
  const index = require("./index-DDg_PkD2.js");
12
12
  function omitProps(props, omittedKeys) {
13
13
  const result = { ...props };
@@ -10,7 +10,7 @@ require("./index-C6MG_f24.js");
10
10
  require("./index-CBRFCYhV.js");
11
11
  require("@chakra-ui/icons");
12
12
  const index = require("./index-ma-iV7GU.js");
13
- const index$1 = require("./index-DgrIJs-a.js");
13
+ const index$1 = require("./index-C3n63_nP.js");
14
14
  const SiteContext = react.createContext(null);
15
15
  const SiteProvider = ({ children, ...context }) => {
16
16
  const value = react.useMemo(() => context, []);
@@ -1,6 +1,10 @@
1
1
  function buildPath(slug, parentSlug) {
2
2
  return parentSlug === "" ? slug : `${parentSlug}/${slug}`;
3
3
  }
4
+ function buildCanonicalUrl(domain, path) {
5
+ const cleanPath = path.split(/[?#]/)[0];
6
+ return `https://${domain}${cleanPath === "/" ? "" : cleanPath}`;
7
+ }
4
8
  function isRelativePath(path = "") {
5
9
  return path.startsWith("/");
6
10
  }
@@ -8,7 +12,8 @@ function isAbsolutePath(path = "") {
8
12
  return /^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(path);
9
13
  }
10
14
  export {
11
- isAbsolutePath as a,
15
+ buildCanonicalUrl as a,
12
16
  buildPath as b,
17
+ isAbsolutePath as c,
13
18
  isRelativePath as i
14
19
  };
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  const jsxRuntime = require("react/jsx-runtime");
3
3
  const react = require("@chakra-ui/react");
4
- const index = require("./index-B4M1IKzL.js");
4
+ const index = require("./index-D-jM-cHx.js");
5
5
  require("@mdx-js/react");
6
6
  const reactI18next = require("react-i18next");
7
7
  const index$2 = require("./index-C6MG_f24.js");
8
8
  const index$3 = require("./index-CBRFCYhV.js");
9
- require("react");
10
9
  const icons = require("@chakra-ui/icons");
10
+ require("react");
11
11
  require("react-medium-image-zoom");
12
12
  const index$1 = require("./index-CVv755RW.js");
13
13
  const index$4 = require("./index-ov4J7p3D.js");
@@ -1,12 +1,12 @@
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-ClIPWZ3z.mjs";
3
+ import { L as Link, a as useSiteContext, I as Image, u as usePageContext } from "./index-B6wLLS6t.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
7
  import { a as CasinoCharacteristic, C as CasinoTableColumn } from "./index-RzByAgHO.mjs";
8
- import "react";
9
8
  import { CheckIcon, CopyIcon, StarIcon } from "@chakra-ui/icons";
9
+ import "react";
10
10
  import "react-medium-image-zoom";
11
11
  import { u as usePrimaryColors } from "./index-C1kr7Vd-.mjs";
12
12
  import { b as formatNumber } from "./index-BPthShL-.mjs";
@@ -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-D-jM-cHx.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-DhhGhwm2.js");
13
13
  const index$3 = require("./index-DDg_PkD2.js");
14
+ const index$7 = require("./index-C3n63_nP.js");
14
15
  const index$1 = require("./index-ov4J7p3D.js");
15
16
  const index$4 = require("./index-CVv755RW.js");
16
17
  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;
@@ -947,30 +958,31 @@ function replacePlaceholders(text, placeholders) {
947
958
  });
948
959
  return text;
949
960
  }
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;
961
+ function getSeoMetaItem(item, placeholders) {
962
+ if (typeof item === "string") {
963
+ return replacePlaceholders(item, placeholders);
964
+ }
965
+ return item(placeholders);
966
+ }
967
+ const Seo = ({ children, pathname, locale, title, description, canonical, hrefLangs = [] }) => {
968
+ const { metadata: siteMetadata } = index.useSiteContext();
969
+ const { name: siteName, lang: siteLocale, seo: siteSeo } = siteMetadata;
970
+ const { title: siteTitle, description: siteDescription } = siteSeo;
971
+ const lang = locale || siteLocale;
955
972
  const placeholders = react$1.useMemo(
956
973
  () => ({
957
974
  siteName,
958
- currentYear: index$1.getCurrentYear(siteLang),
959
- currentMonth: index$1.getCurrentMonth(siteLang)
975
+ currentYear: index$1.getCurrentYear(lang),
976
+ currentMonth: index$1.getCurrentMonth(lang)
960
977
  }),
961
- [siteName, siteLang]
978
+ [siteName, lang]
962
979
  );
963
980
  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)),
981
+ /* @__PURE__ */ jsxRuntime.jsx("html", { lang }),
982
+ /* @__PURE__ */ jsxRuntime.jsx("title", { children: getSeoMetaItem(title ?? siteTitle, placeholders) }),
983
+ /* @__PURE__ */ jsxRuntime.jsx("meta", { name: "description", content: getSeoMetaItem(description ?? siteDescription, placeholders) }),
984
+ /* @__PURE__ */ jsxRuntime.jsx("link", { rel: "canonical", href: canonical ?? index$7.buildCanonicalUrl(siteName, pathname) }),
985
+ hrefLangs.map(({ href, hrefLang }, index2) => /* @__PURE__ */ jsxRuntime.jsx("link", { rel: "alternate", hrefLang, href: index$7.buildCanonicalUrl(siteName, href) }, index2)),
974
986
  children
975
987
  ] });
976
988
  };
package/dist/index.cjs CHANGED
@@ -1,20 +1,20 @@
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-hGzNO4AL.js");
4
+ const index$1 = require("./index-DhhGhwm2.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-D-jM-cHx.js");
7
7
  const index$4 = require("./index-ma-iV7GU.js");
8
8
  const index$5 = require("./index-CVv755RW.js");
9
9
  const i18n = require("./i18n/index.cjs");
10
10
  const layout = require("./layout/index.cjs");
11
- const index$6 = require("./index-DXTC3R_J.js");
11
+ const index$6 = require("./index-Ca9tsjT8.js");
12
12
  const index$7 = require("./index-CBRFCYhV.js");
13
13
  const index$8 = require("./index-C6MG_f24.js");
14
- const index$9 = require("./index-CYr1ct1t.js");
14
+ const index$9 = require("./index-Ba_pXx_e.js");
15
15
  const index$a = require("./index-BfITsKAr.js");
16
16
  const index$b = require("./index-ov4J7p3D.js");
17
- const index$c = require("./index-DgrIJs-a.js");
17
+ const index$c = require("./index-C3n63_nP.js");
18
18
  const index$d = require("./index-CbuiYkSg.js");
19
19
  exports.ActionButton = index.ActionButton;
20
20
  exports.ArticleCard = index.ArticleCard;
@@ -93,6 +93,7 @@ exports.getCurrentMonth = index$b.getCurrentMonth;
93
93
  exports.getCurrentYear = index$b.getCurrentYear;
94
94
  exports.round = index$b.round;
95
95
  exports.toFixedTwo = index$b.toFixedTwo;
96
+ exports.buildCanonicalUrl = index$c.buildCanonicalUrl;
96
97
  exports.buildPath = index$c.buildPath;
97
98
  exports.isAbsolutePath = index$c.isAbsolutePath;
98
99
  exports.isRelativePath = index$c.isRelativePath;
package/dist/index.mjs CHANGED
@@ -1,18 +1,18 @@
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-CG7F6SYt.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-DqMBmwe5.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, P as P3, S as S3, u, a as a4 } from "./index-ClIPWZ3z.mjs";
4
+ import { I as I2, L as L3, P as P3, S as S3, u, a as a4 } from "./index-B6wLLS6t.mjs";
5
5
  import { u as u2 } from "./index-DHURrUMW.mjs";
6
6
  import { u as u3 } from "./index-C1kr7Vd-.mjs";
7
7
  import { DEFAULT_LANGUAGE, resources } from "./i18n/index.mjs";
8
8
  import { default as default2 } from "./layout/index.mjs";
9
- import { M } from "./index-D1gNEJUA.mjs";
9
+ import { M } from "./index-CPbWQKoT.mjs";
10
10
  import { a as a5, C as C3, b as b4, G as G2, I as I3 } from "./index-RzByAgHO.mjs";
11
11
  import { A as A2 } from "./index-BJRvnR8Q.mjs";
12
- import { b as b5, c as c3, g as g2, a as a6 } from "./index-cQqALZIW.mjs";
12
+ import { b as b5, c as c3, g as g2, a as a6 } from "./index-CJANSiM5.mjs";
13
13
  import { g as g3, a as a7, r as r2 } from "./index-BeJTy4iY.mjs";
14
14
  import { f as f2, b as b6, a as a8, g as g4, r as r3, t as t2 } from "./index-BPthShL-.mjs";
15
- import { b as b7, a as a9, i as i2 } from "./index-Bph7a3PR.mjs";
15
+ import { a as a9, b as b7, c as c4, i as i2 } from "./index-DSP348cK.mjs";
16
16
  import { D, L as L4 } from "./index-BRVKhbs6.mjs";
17
17
  export {
18
18
  A as ActionButton,
@@ -76,6 +76,7 @@ export {
76
76
  t as TermsAndConditions,
77
77
  m as Tip,
78
78
  U as UL,
79
+ a9 as buildCanonicalUrl,
79
80
  b7 as buildPath,
80
81
  f2 as formatDate,
81
82
  b6 as formatNumber,
@@ -87,7 +88,7 @@ export {
87
88
  g2 as getNavigation,
88
89
  a7 as getSeededRandomComparator,
89
90
  a6 as getSiteName,
90
- a9 as isAbsolutePath,
91
+ c4 as isAbsolutePath,
91
92
  i2 as isRelativePath,
92
93
  r2 as randomComparator,
93
94
  resources,
@@ -3,17 +3,17 @@ const jsxRuntime = require("react/jsx-runtime");
3
3
  const react = require("@chakra-ui/react");
4
4
  const reactI18next = require("react-i18next");
5
5
  require("@mdx-js/react");
6
- const index$1 = require("../index-B4M1IKzL.js");
6
+ const index$1 = require("../index-D-jM-cHx.js");
7
7
  require("../index-C6MG_f24.js");
8
8
  require("../index-CBRFCYhV.js");
9
+ const icons = require("@chakra-ui/icons");
9
10
  require("react-medium-image-zoom");
10
11
  const react$1 = require("react");
11
- const index = require("../index-DzOucsVx.js");
12
- const icons = require("@chakra-ui/icons");
12
+ const index = require("../index-DhhGhwm2.js");
13
13
  require("i18next");
14
14
  require("react-markdown");
15
15
  const index$2 = require("../index-ov4J7p3D.js");
16
- const index$3 = require("../index-DgrIJs-a.js");
16
+ const index$3 = require("../index-C3n63_nP.js");
17
17
  const Content = ({ children }) => {
18
18
  return /* @__PURE__ */ jsxRuntime.jsx(react.Box, { as: "section", py: 4, children: /* @__PURE__ */ jsxRuntime.jsx(index.Container, { children }) });
19
19
  };
@@ -2,17 +2,17 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { Box, Divider, AbsoluteCenter, useColorModeValue, Text, SimpleGrid, Flex, Menu, MenuButton, Button, HStack, Icon, MenuList, MenuItem, Popover, PopoverTrigger, PopoverContent, List, ListItem, Stack, Collapse, useDisclosure, IconButton, Heading } from "@chakra-ui/react";
3
3
  import { useTranslation } from "react-i18next";
4
4
  import "@mdx-js/react";
5
- import { L as Link, a as useSiteContext, u as usePageContext } from "../index-ClIPWZ3z.mjs";
5
+ import { L as Link, a as useSiteContext, u as usePageContext } from "../index-B6wLLS6t.mjs";
6
6
  import "../index-BJRvnR8Q.mjs";
7
7
  import "../index-RzByAgHO.mjs";
8
+ import { ChevronDownIcon, ChevronRightIcon, CloseIcon, HamburgerIcon, ChevronUpIcon } from "@chakra-ui/icons";
8
9
  import "react-medium-image-zoom";
9
10
  import { useMemo, forwardRef, useState, useEffect } from "react";
10
- import { a as Container, c as Logo, d as SocialNetworks, L as LinkButton } from "../index-D9i6mZaH.mjs";
11
- import { ChevronDownIcon, ChevronRightIcon, CloseIcon, HamburgerIcon, ChevronUpIcon } from "@chakra-ui/icons";
11
+ import { a as Container, c as Logo, d as SocialNetworks, L as LinkButton } from "../index-DqMBmwe5.mjs";
12
12
  import "i18next";
13
13
  import "react-markdown";
14
14
  import { g as getCurrentYear } from "../index-BPthShL-.mjs";
15
- import { b as buildPath } from "../index-Bph7a3PR.mjs";
15
+ import { b as buildPath } from "../index-DSP348cK.mjs";
16
16
  const Content = ({ children }) => {
17
17
  return /* @__PURE__ */ jsx(Box, { as: "section", py: 4, children: /* @__PURE__ */ jsx(Container, { children }) });
18
18
  };
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("../index-DXTC3R_J.js");
4
- const index$1 = require("../index-B4M1IKzL.js");
3
+ const index = require("../index-Ca9tsjT8.js");
4
+ const index$1 = require("../index-D-jM-cHx.js");
5
5
  exports.MdxProvider = index.MdxProvider;
6
6
  exports.PageProvider = index$1.PageProvider;
7
7
  exports.SiteProvider = index$1.SiteProvider;
@@ -1,5 +1,5 @@
1
- import { M } from "../index-D1gNEJUA.mjs";
2
- import { P, S, u, a } from "../index-ClIPWZ3z.mjs";
1
+ import { M } from "../index-CPbWQKoT.mjs";
2
+ import { P, S, u, a } from "../index-B6wLLS6t.mjs";
3
3
  export {
4
4
  M as MdxProvider,
5
5
  P as PageProvider,
@@ -0,0 +1 @@
1
+ export type Nullable<T> = T | null;
@@ -1,4 +1,5 @@
1
1
  export * from './api';
2
+ export * from './common';
2
3
  export * from './components';
3
4
  export * from './content';
4
5
  export * from './i18n';
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const index = require("../index-C6MG_f24.js");
4
- const index$1 = require("../index-CYr1ct1t.js");
4
+ const index$1 = require("../index-Ba_pXx_e.js");
5
5
  const index$2 = require("../index-BfITsKAr.js");
6
6
  const index$3 = require("../index-ov4J7p3D.js");
7
- const index$4 = require("../index-DgrIJs-a.js");
7
+ const index$4 = require("../index-C3n63_nP.js");
8
8
  const index$5 = require("../index-CbuiYkSg.js");
9
9
  exports.Animation = index.Animation;
10
10
  exports.getLocale = index$1.getLocale;
@@ -20,6 +20,7 @@ exports.getCurrentMonth = index$3.getCurrentMonth;
20
20
  exports.getCurrentYear = index$3.getCurrentYear;
21
21
  exports.round = index$3.round;
22
22
  exports.toFixedTwo = index$3.toFixedTwo;
23
+ exports.buildCanonicalUrl = index$4.buildCanonicalUrl;
23
24
  exports.buildPath = index$4.buildPath;
24
25
  exports.isAbsolutePath = index$4.isAbsolutePath;
25
26
  exports.isRelativePath = index$4.isRelativePath;
@@ -1,13 +1,14 @@
1
1
  import { A } from "../index-BJRvnR8Q.mjs";
2
- import { b, c, g, a } from "../index-cQqALZIW.mjs";
2
+ import { b, c, g, a } from "../index-CJANSiM5.mjs";
3
3
  import { g as g2, a as a2, r } from "../index-BeJTy4iY.mjs";
4
4
  import { f, b as b2, a as a3, g as g3, r as r2, t } from "../index-BPthShL-.mjs";
5
- import { b as b3, a as a4, i } from "../index-Bph7a3PR.mjs";
5
+ import { a as a4, b as b3, c as c2, i } from "../index-DSP348cK.mjs";
6
6
  import { D, L } from "../index-BRVKhbs6.mjs";
7
7
  export {
8
8
  A as Animation,
9
9
  D as DARK_THEME_COLOR,
10
10
  L as LIGHT_THEME_COLOR,
11
+ a4 as buildCanonicalUrl,
11
12
  b3 as buildPath,
12
13
  f as formatDate,
13
14
  b2 as formatNumber,
@@ -19,7 +20,7 @@ export {
19
20
  g as getNavigation,
20
21
  a2 as getSeededRandomComparator,
21
22
  a as getSiteName,
22
- a4 as isAbsolutePath,
23
+ c2 as isAbsolutePath,
23
24
  i as isRelativePath,
24
25
  r as randomComparator,
25
26
  r2 as round,
@@ -1,3 +1,4 @@
1
1
  export declare function buildPath(slug: string, parentSlug: string): string;
2
+ export declare function buildCanonicalUrl(domain: string, path: string): string;
2
3
  export declare function isRelativePath(path?: string): boolean;
3
4
  export declare function isAbsolutePath(path?: string): boolean;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@anywayseo/tools",
3
3
  "description": "Shared UI Components and Modules",
4
- "version": "5.10.0",
4
+ "version": "5.11.0",
5
5
  "keywords": [
6
6
  "react",
7
7
  "ui",