how to add noindex in metadata on nextjs 13?
Asked Answered
X

2

6

How to add noindex in metadata on nextjs 13?

Tried to add to "noindex: true" with no success here:

export const metadata = {
  title: "Website title",
  description:
    "My description",
};
Xeres answered 25/2, 2023 at 12:8 Comment(0)
U
9

In Next.js 14, you set it via metadata as follows:

export const metadata = {
  title: "Website title",
  description: "My description",
  robots: {
    index: false,
    follow: false,
  },
};
Ultimo answered 23/2 at 22:17 Comment(1)
X
8
export const metadata = {
  robots: {
    index: false,
    follow: true,
    nocache: true,
    googleBot: {
      index: true,
      follow: false,
      noimageindex: true,
      'max-video-preview': -1,
      'max-image-preview': 'large',
      'max-snippet': -1,
    },
  },
};

https://beta.nextjs.org/docs/api-reference/metadata#robots

Xeres answered 25/2, 2023 at 12:24 Comment(1)
This is wrong, see my answer below.Ultimo

© 2022 - 2024 — McMap. All rights reserved.