Skip to content

not-found.tsx will appear with two duplicate robots tags #79529

Open
@GreedyWhale

Description

@GreedyWhale

Link to the code that reproduces this issue

https://github.com/GreedyWhale/nextjs-meta-bug

To Reproduce

  1. npx create-next-app@latest

√ What is your project named? ... my-app
√ Would you like to use TypeScript? ... No / Yes
√ Would you like to use ESLint? ... No / Yes
√ Would you like to use Tailwind CSS? ... No / Yes
√ Would you like your code inside a src/ directory? ... No / Yes
√ Would you like to use App Router? (recommended) ... No / Yes
√ Would you like to use Turbopack for next dev? ... No / Yes
√ Would you like to customize the import alias (@/* by default)? ... No / Yes

  1. create not-found.tsx file
import type { Metadata } from "next"

export const metadata: Metadata = {
  title: 'My Blog',
  description: '...',
  robots: {
    index: false,
    follow: false
  }
}

export default function NotFound() {
  return (
    <div>
      <div>
        <h2>Not Found</h2>
        <p>Could not find requested resource</p>
      </div>
    </div>
  )
}
  1. pnpm run dev
  2. Visit http://localhost:3000/xxxx
  3. Open your browser's debugging tool to view the html code

Image

Current vs. Expected behavior

Hopefully there is only one <meta=“robots”> tag

Provide environment information

- package.json

{
  "name": "my-app",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev --turbopack",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "react": "^19.0.0",
    "react-dom": "^19.0.0",
    "next": "15.1.8"
  },
  "devDependencies": {
    "typescript": "^5",
    "@types/node": "^20",
    "@types/react": "^19",
    "@types/react-dom": "^19",
    "postcss": "^8",
    "tailwindcss": "^3.4.1",
    "eslint": "^9",
    "eslint-config-next": "15.1.8",
    "@eslint/eslintrc": "^3"
  },
  "packageManager": "[email protected]+sha256.79a98daa90248b50815e31460790f118c56fe099113370826caa0153be6daba5"
}

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

Not sure

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

next dev (local)

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions