#Help Needed: Issue with Excessive API Calls Due to Canonical and Hreflang Links in Next.js 14

2 messages · Page 1 of 1 (latest)

sand cargo
#

Hi everyone,

I’m facing an issue with my Next.js 14 project related to canonical and hreflang links. When I access a page, Next.js is prefetching the same page for all locales, resulting in unnecessary fetch requests for each language.

For example, when I visit http://localhost:3000/en/cities/6, I see fetch requests for French, Arabic, Hindi, Chinese, and English versions of the page. Here’s a snippet of the logs:
Fetching cities for locale fr
Fetching cities for locale ar
Fetching cities for locale hi
Fetching cities for locale zh
Fetching cities for locale en

upbeat ibexBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)