Skip to content

Commit

Permalink
feat: restore generateMetadata function in layout for improved SEO
Browse files Browse the repository at this point in the history
  • Loading branch information
dada878 committed Jan 9, 2025
1 parent 4789269 commit c5ec4a5
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 37 deletions.
37 changes: 0 additions & 37 deletions app/cfp/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,44 +1,7 @@
import type { Metadata } from "next";
import Navbar from "./_components/navbar";
import Footer from "./_components/footer";
import { NavbarProvider } from "./_components/navbar-context";

export async function generateMetadata(): Promise<Metadata> {
const image = "https://sitcon.org/2025/og.jpg";
const title = "SITCON 2025";
const description =
"學生計算機年會(Students’ Information Technology Conference)自 2012 年發起,以學生為本、由學生自發舉辦,長期投身學生資訊教育與推廣開源精神,鼓勵學生們成為實踐者,貢獻程式碼、打造並部署服務、透過實際行動推動專案,最後將這些結晶分享出去,讓更多人能關注你認為重要的議題,打造更緊密的社群。";
const metadata: Metadata = {
title,
authors: [{ name: "SITCON" }],
keywords: "SITCON, SITCON 2025",
description,
metadataBase: new URL("https://sitcon.org/2025/"),
openGraph: {
type: "website",
locale: "zh_TW",
url: "https://sitcon.org/2025/cfp/",
title,
description,
siteName: "SITCON",
images: [
{
url: image,
},
],
},
twitter: {
creator: "@sitcontw",
site: "@sitcontw",
card: "summary_large_image",
images: image,
title,
description,
},
};
return metadata;
}

export default function RootLayout({
children,
}: Readonly<{
Expand Down
38 changes: 38 additions & 0 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,47 @@ import { GoogleTagManager } from "@next/third-parties/google";

import { config } from "@fortawesome/fontawesome-svg-core";
import "@fortawesome/fontawesome-svg-core/styles.css";
import { Metadata } from "next";
config.autoAddCss = false;

const inter = Inter({ subsets: ["latin"] });

export async function generateMetadata(): Promise<Metadata> {
const image = "https://sitcon.org/2025/og.jpg";
const title = "SITCON 2025";
const description =
"學生計算機年會(Students’ Information Technology Conference)自 2012 年發起,以學生為本、由學生自發舉辦,長期投身學生資訊教育與推廣開源精神,鼓勵學生們成為實踐者,貢獻程式碼、打造並部署服務、透過實際行動推動專案,最後將這些結晶分享出去,讓更多人能關注你認為重要的議題,打造更緊密的社群。";
const metadata: Metadata = {
title,
authors: [{ name: "SITCON" }],
keywords: "SITCON, SITCON 2025",
description,
metadataBase: new URL("https://sitcon.org/2025/"),
openGraph: {
type: "website",
locale: "zh_TW",
url: "https://sitcon.org/2025/cfp/",
title,
description,
siteName: "SITCON",
images: [
{
url: image,
},
],
},
twitter: {
creator: "@sitcontw",
site: "@sitcontw",
card: "summary_large_image",
images: image,
title,
description,
},
};
return metadata;
}

export default function Layout({ children }: { children: ReactNode }) {
const jsonLd = {
"@context": "https://schema.org",
Expand Down

0 comments on commit c5ec4a5

Please sign in to comment.