vercel / vercel/next.js

Next.js App Router ISR doesn't remove noindex meta tag on cache revalidation

Open
#71,440 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
142k
Forks
32.5k
Avg merge
2d 14h
Merged PRs (30d)
351

Description

Link to the code that reproduces this issue

https://stackblitz.com/edit/stackblitz-starters-ws74xq?file=README.md

To Reproduce
  1. Build the project and start it in production mode npm run build && npm start
  2. Open a new terminal and run the backend server npm run server
  3. Open the application on the /admin path. Click on any item in the list. Change the status to "Draft" and click on save button. If the post already has a "Draft" status then first change it to "Published" and make it "Draft" again.
  4. Copy the id of the post and go to page /posts/<id>. Refresh it until the not found page appears.
  5. Check the generated page in .next directory: cat .next/server/app/posts/<id>.html. There should be <meta name="robots" content="noindex"/> tag.
  6. Now go the the page /admin/posts/<id> and change the status to "Published" and save.
  7. Go to the page /posts/<id> and refresh it until the non-404 page appears. Run the cat .next/server/app/posts/<id>.html command in terminal again. There is still <meta name="robots" content="noindex"/> tag.
Current vs. Expected behavior

I expect Next.js to remove the robots tag on revalidation.

Provide environment information
Operating System:
  Platform: linux
  Arch: x64
  Version: Ubuntu 20.04.0 LTS Thu Oct 17 2024 22:46:17 GMT+0500 (Uzbekistan Standard Time)
  Available memory (MB): NaN
  Available CPU cores: 8
Binaries:
  Node: 18.20.3
  npm: 10.2.3
  Yarn: 1.22.19
  pnpm: 8.15.6
Relevant Packages:
  next: 14.2.8 // There is a newer version (14.2.15) available, upgrade recommended! 
  eslint-config-next: 14.2.8
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.5.4
Next.js Config:
  output: N/A
Which area(s) are affected? (Select all that apply)

Not sure

Which stage(s) are affected? (Select all that apply)

next build (local), next start (local)

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked StackBlitz reproduction and run the documented build, start, and server commands. Reproduce the Draft-to-Published transition, inspect .next/server/app/posts/.html before and after revalidation, and verify that the published page no longer contains the robots noindex tag.

Written by the indexing model from the issue text.

Assessment

Tech stack
next.js, react
Domain
performance, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.