Next.js Discord

Discord Forum

next js version 14 and genaretaMetaData duplicated robots noindex in app folder

Unanswered
Dwarf Crocodile posted this in #help-forum
Open in Discord
Dwarf CrocodileOP
Hello, I am using the next js 14 version and the app folder. I create a static site and use staticMetaData for metadata, as in the documentation. My problem here is that although I call index,follow in the robots meta, it automatically assigns its own noindex after a while on the site. How can I solve this, my code is like this

export async function generateMetadata({ params }) {
const slug = params.slug
const dataDetail = await getDataDetail({ params });

if (dataDetail.status == 0) {
return {
title: '404 Sayfa Bulunamadı Hata',
description: 'Aramış olduğunuz sayfa bulunamadı için, sayfa 404 kodlu hataya düşmüştür.',
}
}
else {
return {
robots: {
index: dataDetail?.content?.noindex === "no" ? true : false,
follow: dataDetail?.content?.noindex === "no" ? true : false,
},
title: dataDetail?.content?.meta_title dataDetail?.content?.title,
description: dataDetail?.content?.meta_description
'E-psikiyatri',
metadataBase: new URL('https://e-psikiyatri.com'),
alternates: {
canonical: dataDetail?.content?.canonical /${slug},
},
openGraph: {
title: dataDetail?.content?.meta_title
dataDetail?.content?.title,
description: dataDetail?.content?.meta_description 'E-psikiyatri',
url: 'https://e-psikiyatri.com',
siteName: dataDetail?.content?.meta_title
dataDetail?.content?.title,
images: [
{
url: dataDetail?.content?.image '/logo.png',
width: 800,
height: 600,
alt: dataDetail?.content?.title
'E-Psikiyatri',
},
],
locale: 'tr_TR',
type: 'website',
}
}
}
}

6 Replies

Dwarf CrocodileOP
Is there anyone who can help?
Dwarf CrocodileOP
Pleaseee Help Meee 😦
@Dwarf Crocodile Hello, I am using the next js 14 version and the app folder. I create a static site and use staticMetaData for metadata, as in the documentation. My problem here is that although I call index,follow in the robots meta, it automatically assigns its own noindex after a while on the site. How can I solve this, my code is like this export async function generateMetadata({ params }) { const slug = params.slug const dataDetail = await getDataDetail({ params }); if (dataDetail.status == 0) { return { title: '404 Sayfa Bulunamadı Hata', description: 'Aramış olduğunuz sayfa bulunamadı için, sayfa 404 kodlu hataya düşmüştür.', } } else { return { robots: { index: dataDetail?.content?.noindex === "no" ? true : false, follow: dataDetail?.content?.noindex === "no" ? true : false, }, title: dataDetail?.content?.meta_title || dataDetail?.content?.title, description: dataDetail?.content?.meta_description || 'E-psikiyatri', metadataBase: new URL('https://e-psikiyatri.com'), alternates: { canonical: dataDetail?.content?.canonical || `/${slug}`, }, openGraph: { title: dataDetail?.content?.meta_title || dataDetail?.content?.title, description: dataDetail?.content?.meta_description || 'E-psikiyatri', url: 'https://e-psikiyatri.com', siteName: dataDetail?.content?.meta_title || dataDetail?.content?.title, images: [ { url: dataDetail?.content?.image || '/logo.png', width: 800, height: 600, alt: dataDetail?.content?.title || 'E-Psikiyatri', }, ], locale: 'tr_TR', type: 'website', } } } }
what do you mean by "after a while"? on first page load it doesnt have noindex but after a few minutes it automagically adds the noindex tag?
Dwarf CrocodileOP
I create my pages statically, robots index,follow in the first creation, but then after a few minutes, not after a few hours or days, it automatically assigns a noindex tag.

when I looked at the logs, the status was not defined, I think it automatically assigns noindex when the data does not come immediately, but then when the data comes, it places title etc. with its own meta tags. But since the noindex remained at the beginning, the site was both noindexed and the http status was 404.

dataDetail.status == 0 => dataDetail?.status == 0 and now it appears as 200, I will follow it for a certain period of time, I don't know what to do if there is noindex again
White-crowned Sparrow
@Dwarf Crocodile did you solve this? I'm seeing teh same behaviour.