layout.tsx 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. images: [
  31. {
  32. url: "/og-image.png",
  33. width: 1200,
  34. height: 630,
  35. alt: siteConfig.name,
  36. },
  37. ],
  38. },
  39. twitter: {
  40. card: "summary_large_image",
  41. title: siteConfig.name,
  42. description: siteConfig.description,
  43. images: ["/og-image.png"],
  44. },
  45. robots: {
  46. index: true,
  47. follow: true,
  48. googleBot: {
  49. index: true,
  50. follow: true,
  51. "max-video-preview": -1,
  52. "max-image-preview": "large",
  53. "max-snippet": -1,
  54. },
  55. },
  56. icons: {
  57. icon: "/favicon.ico",
  58. },
  59. };
  60. export const viewport: Viewport = {
  61. themeColor: [
  62. { media: "(prefers-color-scheme: light)", color: "white" },
  63. { media: "(prefers-color-scheme: dark)", color: "black" },
  64. ],
  65. };
  66. const jsonLd = {
  67. "@context": "https://schema.org",
  68. "@graph": [
  69. {
  70. "@type": "WebSite",
  71. "@id": `${siteConfig.url}/#website`,
  72. url: siteConfig.url,
  73. name: siteConfig.name,
  74. description: siteConfig.description,
  75. inLanguage: "en-US",
  76. },
  77. {
  78. "@type": "Person",
  79. "@id": `${siteConfig.url}/#person`,
  80. name: "Eric Wu",
  81. alternateName: "Chengxiang Wu",
  82. url: siteConfig.url,
  83. jobTitle: "Software Development Engineer",
  84. worksFor: {
  85. "@type": "Organization",
  86. name: "Amazon Web Services",
  87. },
  88. alumniOf: [
  89. {
  90. "@type": "CollegeOrUniversity",
  91. name: "University of California, Los Angeles",
  92. },
  93. {
  94. "@type": "CollegeOrUniversity",
  95. name: "Purdue University",
  96. },
  97. ],
  98. sameAs: [siteConfig.links.github, siteConfig.links.linkedin],
  99. },
  100. ],
  101. };
  102. export default function RootLayout({
  103. children,
  104. }: {
  105. children: React.ReactNode;
  106. }) {
  107. return (
  108. <html suppressHydrationWarning lang="en">
  109. <head>
  110. <script
  111. type="application/ld+json"
  112. dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }}
  113. />
  114. </head>
  115. <body
  116. className={clsx(
  117. fontUbuntu.className,
  118. "tracking-wide",
  119. fontOleoScript.variable,
  120. )}
  121. >
  122. <Providers themeProps={{ attribute: "class" }}>
  123. <div className="relative flex flex-col bg-[#f6f2f2] dark:bg-[#0b0f11] overflow-y-auto scrollbar-hide min-h-screen">
  124. <main className="container mx-auto max-w-7xl pt-10 pb-[25px] md:pt-16 flex flex-col">
  125. {children}
  126. <Analytics />
  127. </main>
  128. </div>
  129. </Providers>
  130. </body>
  131. </html>
  132. );
  133. }