Next.js App Router ISR doesn't remove noindex meta tag on cache revalidation
Open
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
- Build the project and start it in production mode
npm run build && npm start - Open a new terminal and run the backend server
npm run server - Open the application on the
/adminpath. 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. - Copy the id of the post and go to page
/posts/<id>. Refresh it until the not found page appears. - Check the generated page in
.nextdirectory:cat .next/server/app/posts/<id>.html. There should be<meta name="robots" content="noindex"/>tag. - Now go the the page
/admin/posts/<id>and change the status to "Published" and save. - Go to the page
/posts/<id>and refresh it until the non-404 page appears. Run thecat .next/server/app/posts/<id>.htmlcommand 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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