layout.tsx 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. import "react-grid-layout/css/styles.css";
  2. import "react-resizable/css/styles.css";
  3. import "@/styles/globals.css";
  4. import { Metadata, Viewport } from "next";
  5. import clsx from "clsx";
  6. import { Analytics } from "@vercel/analytics/react";
  7. import { Providers } from "./providers";
  8. import { siteConfig } from "@/config/site";
  9. import { fontOleoScript, fontUbuntu } from "@/config/fonts";
  10. export const metadata: Metadata = {
  11. metadataBase: new URL(siteConfig.url),
  12. title: {
  13. default: siteConfig.name,
  14. template: `%s - ${siteConfig.name}`,
  15. },
  16. description: siteConfig.description,
  17. keywords: siteConfig.keywords,
  18. authors: [{ name: siteConfig.author, url: siteConfig.url }],
  19. creator: siteConfig.author,
  20. alternates: {
  21. canonical: "/",
  22. },
  23. openGraph: {
  24. type: "website",
  25. locale: "en_US",
  26. url: siteConfig.url,
  27. siteName: siteConfig.name,
  28. title: siteConfig.name,
  29. description: siteConfig.description,
  30. },
  31. twitter: {
  32. card: "summary_large_image",
  33. title: siteConfig.name,
  34. description: siteConfig.description,
  35. },
  36. robots: {
  37. index: true,
  38. follow: true,
  39. googleBot: {
  40. index: true,
  41. follow: true,
  42. "max-video-preview": -1,
  43. "max-image-preview": "large",
  44. "max-snippet": -1,
  45. },
  46. },
  47. icons: {
  48. icon: "/favicon.ico",
  49. },
  50. };
  51. export const viewport: Viewport = {
  52. themeColor: [
  53. { media: "(prefers-color-scheme: light)", color: "white" },
  54. { media: "(prefers-color-scheme: dark)", color: "black" },
  55. ],
  56. };
  57. const jsonLd = {
  58. "@context": "https://schema.org",
  59. "@graph": [
  60. {
  61. "@type": "WebSite",
  62. "@id": `${siteConfig.url}/#website`,
  63. url: siteConfig.url,
  64. name: siteConfig.name,
  65. description: siteConfig.description,
  66. inLanguage: "en-US",
  67. },
  68. {
  69. "@type": "Person",
  70. "@id": `${siteConfig.url}/#person`,
  71. name: "Eric Wu",
  72. alternateName: "Chengxiang Wu",
  73. url: siteConfig.url,
  74. jobTitle: "Software Development Engineer",
  75. worksFor: {
  76. "@type": "Organization",
  77. name: "Amazon Web Services",
  78. },
  79. alumniOf: [
  80. {
  81. "@type": "CollegeOrUniversity",
  82. name: "University of California, Los Angeles",
  83. },
  84. {
  85. "@type": "CollegeOrUniversity",
  86. name: "Purdue University",
  87. },
  88. ],
  89. sameAs: [siteConfig.links.github, siteConfig.links.linkedin],
  90. },
  91. ],
  92. };
  93. export default function RootLayout({
  94. children,
  95. }: {
  96. children: React.ReactNode;
  97. }) {
  98. return (
  99. <html suppressHydrationWarning lang="en">
  100. <head>
  101. <script
  102. type="application/ld+json"
  103. dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }}
  104. />
  105. </head>
  106. <body
  107. className={clsx(
  108. fontUbuntu.className,
  109. "tracking-wide",
  110. fontOleoScript.variable,
  111. )}
  112. >
  113. <Providers themeProps={{ attribute: "class" }}>
  114. <div className="relative flex flex-col bg-[#f6f2f2] dark:bg-[#0b0f11] overflow-y-auto scrollbar-hide min-h-screen">
  115. <main className="container mx-auto max-w-7xl pt-10 pb-[25px] md:pt-16 flex flex-col">
  116. {children}
  117. <Analytics />
  118. </main>
  119. </div>
  120. </Providers>
  121. </body>
  122. </html>
  123. );
  124. }