Skip to content

Same post shown twice in the blog list #8536

@Zwyx

Description

@Zwyx

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

Description

I noticed one of my blog posts showing twice in the main blog list. One time rightfully, the other time taking the spot of another post. I managed to get a minimal setup to reproduce it:

image

Reproducible demo

https://stackblitz.com/edit/github-bmgrpn

Steps to reproduce

From a fresh Docusaurus install, empty the blog folder and create the two folders and files that are in it now.

On the website, in the blog, there are two posts: Post 1 and Post 2. We can see them in the list of recent posts. However, Post 1 is not present in the main list, and Post 2 is present twice:

We also notice this React error in the console:

react-dom.development.js?ac89:67 Warning: Encountered two children with the same key, `/blog/post2`. Keys should be unique so that components maintain their identity across updates.

Note: it is still possible to build the site with yarn build, the error won't be present in the output.

Other observations:

  • Renaming any of the two blog post folders (simply changing one character) fixes the issue (it looks like hashes colliding, so I tinkered in docuHash in docusaurus-utils/src/hashUtils.ts but it didn't do anything conclusive).

  • Changing the 4th line of the Post 2 index.mdx file from tags: [tag] to tags: [] makes now Post 1 being present twice instead of Post 2:

Expected behavior

No duplicate post.

Actual behavior

See above.

Your environment

Self-service

  • I'd be willing to fix this bug myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn error in the Docusaurus core causing instability or issues with its executionstatus: accepting prThis issue has been accepted, and we are looking for community contributors to implement this

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions