Search code examples
facebooknext.jsmetadata

How to implement facebook verification on new Metadata of Next.js 13?


My old nextjs website had a meta with name and content in the _document file inside a head, like:

<Html>
 <head>
  <meta name='facebook-domain-verification' content:'00000000000000' />
  *more stuff...*
 </head>
</html>

I read the Next.js generateMetadata documentation and I saw a lot of pre-built meta. But I don't get how I can implement a new meta. Making a experience, I created something like the robots meta they use there:

export const metadata = {

robots: {
    index: true,
    follow: true,
    nocache: true,
    googleBot: {
      index: true,
      follow: true,
      noimageindex: true,
      'max-video-preview': -1,
      'max-image-preview': 'large',
      'max-snippet': -1,
    },
 },

*a lot of stuff ...* 

other:{
name: 'facebook-domain-verification',
content: '00000000000000000', 
},

I saw some contents saying to use "other" to place third's metadata, but I'm a little confuse.

Can you help me? Thank you :)


Solution

  • For verification NextJS implements the verification key inside metadata object like so:

    export const metadata = {
      verification: {
        google: 'google',
        yandex: 'yandex',
        yahoo: 'yahoo',
        other: {
          me: ['my-email', 'my-link'],
        },
      },
    }
    

    You can read more about metadata verification at nextjs docs