SEO while redirecting
Unanswered
Mugger Crocodile posted this in #help-forum
Mugger CrocodileOP
So basically I have in my layout this piece of code to redirect those unlogged / unsubscribed:
const user = await auth();
if (!user?.user.subscribed) {
return redirect("/#pricing");
}
if (!user) {
return redirect("/");
}
, but I now have the problem that crawlers can't get my metadata from those pages. I tried using middleware, but there are still problems with checking if the user's subscribed.9 Replies
@Mugger Crocodile So basically I have in my layout this piece of code to redirect those unlogged / unsubscribed: js
const user = await auth();
if (!user?.user.subscribed) {
return redirect("/#pricing");
}
if (!user) {
return redirect("/");
}, but I now have the problem that crawlers can't get my metadata from those pages. I tried using middleware, but there are still problems with checking if the user's subscribed.
Yes, so lets see if you have this rule set for
-# I'm not sure if I gave the write answer, since i didn't understood your query properly
/dashboard
, crawlers won't be able to access that page.-# I'm not sure if I gave the write answer, since i didn't understood your query properly
@Anay-208 | Ping in replies Yes, so lets see if you have this rule set for `/dashboard`, crawlers won't be able to access that page.
-# I'm not sure if I gave the write answer, since i didn't understood your query properly
Mugger CrocodileOP
so basically there's nothing you can do about it?
like if (!isBot){ redirect }?
@Mugger Crocodile like if (!isBot){ redirect }?
Yes, you can check for user agent
@Anay-208 | Ping in replies Yes, you can check for user agent
Mugger CrocodileOP
but can I use this outside of middleware?
Yes, you can get headers and check for User-Agent
but note, anyone can modify User-Agent
@Mugger Crocodile resolved?
@Mugger Crocodile ?