shuding / nextra

Simple, powerful and flexible site generation framework with everything you love from Next.js.
https://nextra.site
MIT License
11.67k stars 1.26k forks source link

Duplicate Home Page URLs: `/` and `/index` Both Accessible #3264

Open AntoineKM opened 3 weeks ago

AntoineKM commented 3 weeks ago

When using Nextra to create a home page, an /index.mdx file is required to define the content. This setup results in two accessible URLs leading to the same content:

This duplication can be confusing and may lead to potential SEO issues or unwanted behavior.

Steps to Reproduce

  1. Create a new Nextra site or use an existing one.
  2. Add an index.mdx file to define the home page content.
  3. Access the home page via both https://nextra.site/ and https://nextra.site/index.

Expected Behavior

Only one URL should be accessible for the home page content, preferably https://nextra.site/.

Actual Behavior

Both https://nextra.site/ and https://nextra.site/index show the same home page content, leading to duplicate content accessibility.

Suggested Solution

Consider implementing a redirect or a mechanism to ensure that only one URL (e.g., https://nextra.site/) is accessible for the home page, and the other URL (https://nextra.site/index) is redirected or results in a 404 error.

dimaMachina commented 1 week ago

I think it’s an upstream issue from Next.js? Should be fixed with app router migration in Nextra 4