I’m trying to add google search console to my nextjs13 app website, but their method of verifying is through a meta tag, and I don’t know how to add metatag in nextjs13 app directory
I tried using the new api generateMetadata from https://nextjs.org/docs/app/api-reference/functions/generate-metadata but it seems they only work for some specific tags, like title, description, og, etc, my meta tag ‘google-site-verification’ does not work with this approach.
How can I add this metatag?
2
Answers
I was able to resolve exporting a const metadata in my page.tsx, and use the 'other' field like this
the type Metadata in imported from next, import type {Metadata} from 'next'
You have to do it exactly this way:
code:
export const metadata: Metadata = { robots: { index: false, follow: false }, title: 'Title', description: 'your description', verification: { google: 'your verification content', }, };
Example Image: