Next.js Discord

Discord Forum

Google indexing prefetched links

Unanswered
Siberian posted this in #help-forum
Open in Discord
SiberianOP
Hey, I'm seeking some help with an indexing issue. I have a nextjs app running on v14. I can see in the network tab that nextjs is making requests to prefetch links that are there on the website.

The requests next is making are all ending with _rsc={some_key}, and for some reason that I can't understand, google is indexing them. I'm looking for a way to prevent google from indexing them.

I tried setting X-Robots-Tag: noindex in middleware, but next is intentionally not leaking the _rsc search param in middleware (there's a test case for that).

Anyone experienced this?

5 Replies

Can you provide a code snippet of your html with the links in? And presumably search console where you have seen they are indexed?
SiberianOP
Here's the html, not sure if that helps by any means:
<a class="sc-85b7cbd-3 dhwrxI" href="/pb/tilbud/
/"><span class="sc-85b7cbd-4">Tilbud</span></a>

I need a sec to get the search console stuff as I'm not in charge of it.
So as it’s a link you just need to add rel=no follow and Google won’t follow it
SiberianOP
The issue is I want google to follow it. It's a valid link that should be indexed, but google would then index both /pb/tilbud/ and /pb/tilbud/?_rsc=1234 :/
American
Use canonical rels

<link rel="canonical" href="https://example.com/dresses/green-dresses" />