Closed aditya305 closed 1 year ago
The export const metadata
and export function generateMetadata
syntaxes only work in server components (at least for now), see #48266. So you need to do something like this
page.client.tsx
with all your logic"use client";
export default function PageClient() {
return <div>Hello, world!</div>;
}
page.tsx
// page.tsx
import PageClient from "./page.client";
export default function Page() {
return <PageClient />;
}
export const metadata = {
title: "Hello, world!",
};
sounds good! However, is there a simpler method to define the remaining SEO tags?
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Verify canary release
Provide environment information
Which example does this report relate to?
page.js, metadata
What browser are you using? (if relevant)
Chrome 113.0.5672.127
How are you deploying your application? (if relevant)
Vercel
Describe the Bug
I recently created a new Next.js project and developed a website. During this process, I discovered that the head tags are now being written using the
_export const metadata = {}_
method, including a title like this:After pushing the code and attempting to deploy it on Vercel, I encountered an issue where Vercel was unable to successfully deploy the code onto the website.
Expected Behavior
Ideally, the website should execute and deploy seamlessly, devoid of any errors. However, instead of the expected smooth deployment, I encountered some errors. To provide a better understanding of the situation, I have included screenshots of the relevant code and the error message displayed by Vercel:
These errors are hindering the successful deployment of the website on Vercel.
To Reproduce