layout.tsx 3.5 KB

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