@windrun-huaiin/third-ui 5.12.2 → 5.12.4

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.
@@ -13,8 +13,9 @@ interface FumaPageParams {
13
13
  FallbackPage: React.ComponentType<{
14
14
  siteIcon: ReactNode;
15
15
  }>;
16
+ supportedLocales?: string[];
16
17
  }
17
- declare function createFumaPage({ sourceKey, mdxContentSource, getMDXComponents, mdxSourceDir, githubBaseUrl, copyButtonComponent, siteIcon, FallbackPage, }: FumaPageParams): {
18
+ declare function createFumaPage({ sourceKey, mdxContentSource, getMDXComponents, mdxSourceDir, githubBaseUrl, copyButtonComponent, siteIcon, FallbackPage, supportedLocales, }: FumaPageParams): {
18
19
  Page: ({ params }: {
19
20
  params: Promise<{
20
21
  locale: string;
@@ -28,8 +29,18 @@ declare function createFumaPage({ sourceKey, mdxContentSource, getMDXComponents,
28
29
  locale?: string;
29
30
  }>;
30
31
  }) => Promise<{
32
+ title: string;
33
+ description: string;
34
+ metadataBase?: undefined;
35
+ alternates?: undefined;
36
+ } | {
37
+ metadataBase: URL;
31
38
  title: any;
32
39
  description: any;
40
+ alternates: {
41
+ canonical: string;
42
+ languages: Record<string, string>;
43
+ };
33
44
  }>;
34
45
  };
35
46
 
@@ -13,8 +13,9 @@ interface FumaPageParams {
13
13
  FallbackPage: React.ComponentType<{
14
14
  siteIcon: ReactNode;
15
15
  }>;
16
+ supportedLocales?: string[];
16
17
  }
17
- declare function createFumaPage({ sourceKey, mdxContentSource, getMDXComponents, mdxSourceDir, githubBaseUrl, copyButtonComponent, siteIcon, FallbackPage, }: FumaPageParams): {
18
+ declare function createFumaPage({ sourceKey, mdxContentSource, getMDXComponents, mdxSourceDir, githubBaseUrl, copyButtonComponent, siteIcon, FallbackPage, supportedLocales, }: FumaPageParams): {
18
19
  Page: ({ params }: {
19
20
  params: Promise<{
20
21
  locale: string;
@@ -28,8 +29,18 @@ declare function createFumaPage({ sourceKey, mdxContentSource, getMDXComponents,
28
29
  locale?: string;
29
30
  }>;
30
31
  }) => Promise<{
32
+ title: string;
33
+ description: string;
34
+ metadataBase?: undefined;
35
+ alternates?: undefined;
36
+ } | {
37
+ metadataBase: URL;
31
38
  title: any;
32
39
  description: any;
40
+ alternates: {
41
+ canonical: string;
42
+ languages: Record<string, string>;
43
+ };
33
44
  }>;
34
45
  };
35
46
 
@@ -9535,7 +9535,8 @@ function createFumaPage({
9535
9535
  githubBaseUrl,
9536
9536
  copyButtonComponent,
9537
9537
  siteIcon,
9538
- FallbackPage
9538
+ FallbackPage,
9539
+ supportedLocales = ["en"]
9539
9540
  }) {
9540
9541
  const Page = function Page2(_0) {
9541
9542
  return __async(this, arguments, function* ({ params }) {
@@ -9577,17 +9578,32 @@ function createFumaPage({
9577
9578
  }
9578
9579
  function generateMetadata(props) {
9579
9580
  return __async(this, null, function* () {
9580
- const params = yield props.params;
9581
- const page = mdxContentSource.getPage(params.slug, params.locale);
9581
+ const { slug, locale } = yield props.params;
9582
+ const page = mdxContentSource.getPage(slug, locale);
9582
9583
  if (!page) {
9583
9584
  return {
9584
9585
  title: "404 - Page Not Found",
9585
9586
  description: "This page could not be found."
9586
9587
  };
9587
9588
  }
9589
+ const baseUrl = process.env.NEXT_PUBLIC_BASE_URL;
9590
+ const baseRoute = mdxSourceDir.replace("src/mdx/", "");
9591
+ const currentPath = slug ? slug.join("/") : "";
9592
+ const currentUrl = `${baseUrl}/${locale}/${baseRoute}${currentPath ? `/${currentPath}` : ""}`;
9593
+ const seoLanguageMap = {};
9594
+ console.log("supportedLocales", supportedLocales);
9595
+ supportedLocales.forEach((loc) => {
9596
+ seoLanguageMap[loc] = `${baseUrl}/${loc}/${baseRoute}${currentPath ? `/${currentPath}` : ""}`;
9597
+ });
9598
+ console.log("seoLanguageMap", seoLanguageMap);
9588
9599
  return {
9600
+ metadataBase: new URL(baseUrl),
9589
9601
  title: page.data.title,
9590
- description: page.data.description
9602
+ description: page.data.description,
9603
+ alternates: {
9604
+ canonical: currentUrl,
9605
+ languages: seoLanguageMap
9606
+ }
9591
9607
  };
9592
9608
  });
9593
9609
  }