Template
Add site metadata and serve favicon from public/
Moving favicon.ico out of app/ bypasses Next's metadata image loader, which fails to read the .ico in sandboxed runtimes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
a6f0b33934
commit
d9f80f6221
+33
-2
@@ -1,9 +1,40 @@
|
|||||||
import type { Metadata } from "next";
|
import type { Metadata } from "next";
|
||||||
import "./globals.css";
|
import "./globals.css";
|
||||||
|
|
||||||
|
const siteName = "Next.js Template";
|
||||||
|
const siteDescription =
|
||||||
|
"A Next.js 16 starter with Tailwind CSS and shadcn/ui, ready to deploy on Vercel.";
|
||||||
|
|
||||||
|
// Absolute origin behind `metadataBase`, so Open Graph images resolve to full
|
||||||
|
// URLs. Vercel injects VERCEL_PROJECT_PRODUCTION_URL on deployed builds.
|
||||||
|
const siteUrl =
|
||||||
|
process.env.NEXT_PUBLIC_SITE_URL ??
|
||||||
|
(process.env.VERCEL_PROJECT_PRODUCTION_URL
|
||||||
|
? `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`
|
||||||
|
: "http://localhost:3000");
|
||||||
|
|
||||||
|
// Routes only set their own `title`; the template appends the site name.
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
title: "Create Next App",
|
metadataBase: new URL(siteUrl),
|
||||||
description: "Generated by create next app",
|
title: {
|
||||||
|
default: siteName,
|
||||||
|
template: `%s — ${siteName}`,
|
||||||
|
},
|
||||||
|
description: siteDescription,
|
||||||
|
// Served from public/ so it bypasses the metadata image loader.
|
||||||
|
icons: { icon: "/favicon.ico" },
|
||||||
|
openGraph: {
|
||||||
|
type: "website",
|
||||||
|
siteName,
|
||||||
|
title: siteName,
|
||||||
|
description: siteDescription,
|
||||||
|
url: "/",
|
||||||
|
},
|
||||||
|
twitter: {
|
||||||
|
card: "summary_large_image",
|
||||||
|
title: siteName,
|
||||||
|
description: siteDescription,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function RootLayout({
|
export default function RootLayout({
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
Reference in New Issue
Block a user