how to approach "/" route metadata on my bilingual website?
Answered
Nebelung posted this in #help-forum
NebelungOP
Not Nextjs part: I can't manage to get my page show up in google results. It's a page I rebuilt, and although I indexed it in google and have a sitemap I can only see the old page in search results.
The nextjs part I want to ask about my "/" route. In my app, I redirect imidiatelly to the locale "/en" or "/nl" — these are in
Right now I have such metadata for
middleware:
robots.txt
The nextjs part I want to ask about my "/" route. In my app, I redirect imidiatelly to the locale "/en" or "/nl" — these are in
app/[language]/page.tsx
. Should I have anything in metadata for app/page.tsx
? Right now I have such metadata for
app/page.tsx
, with robots index set to false because this route doesnt really exist without locale.export async function generateMetadata() {
return {
metadataBase: new URL(baseUrl),
title: 'Home',
description: 'Home page of this and that person',
robots: {
index: false,
follow: true,
},
}
}
middleware:
if (pathname === '/') {
const locale = getLocale(request)
return NextResponse.redirect(new URL(`/${locale}`, request.url), {
// 308 for permanent redirect
status: 308,
})
}
robots.txt
User-agent: *
Allow: /
Disallow: /studio
Sitemap: https://www.myurl.com/sitemap.xml
Answered by Anay-208
If you requested indexing and it doesn't show any error in robots.txt, means its alright
7 Replies
NebelungOP
Url to the page: https://www.nargesmohammadi.com/en
sitemap: https://www.nargesmohammadi.com/sitemap.xml
sitemap: https://www.nargesmohammadi.com/sitemap.xml
NebelungOP
I can’t see any metadata for the url without /en
https://socialsharepreview.com/?url=https://www.nargesmohammadi.com
https://socialsharepreview.com/?url=https://www.nargesmohammadi.com
have you checked out google search console?
NebelungOP
Yes, all routes are indexed. But the route without locale is not and I don’t know what to do about it. Right now, I can’t event see any social share previews for the url without locale
Wait since you're redirecting from / route, so it obv won't be indexed
NebelungOP
Is that how it should be done? The redirection in bilingual pages I mean. So my sitemap looks fine? I wonder why Google doesn’t want to pick it up then… it’s been a week
If you requested indexing and it doesn't show any error in robots.txt, means its alright
Answer