skip to Main Content

So I know that to block Pinterest on my site I need to embed this in my site’s header <meta name="pinterest" content="nopin" />, but I’m not sure how to do that in Next 13 using the new exported metadata object format? Looked at the documentation for that object but couldn’t figure it out.

export const metadata = {
  title: "Create Next App",
  description: "Generated by create next app",
};

EDIT (April 18th):
I’m not sure why it seemed to be working before, but adding the meta tag as suggested by Mathieu (and the documentation) doesn’t seem to actually work.

I have this in my root layout file and pinterest pinning option still appears on my site

export const metadata = {
  other: { pinterest: "nopin" },
};

2

Answers


  1. it seems you just have to put your piece of code in your layout.js or page.js, like this :

    export const metadata = {
      ...[Your previous meta data, like title, description,...]
      pinterest: "nopin"
    };
    
    Login or Signup to reply.
  2. to add custom metadata, you can use other category:

    export const metadata = {
      other: { pinterest: "nopin" },
    };
    

    next build will generate this metadata:

    <meta name="pinterest" content="nopin"/>
    

    More information here: https://beta.nextjs.org/docs/api-reference/metadata#other

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search