Tried upgrading to Contentlayer2 today because:

  1. Rendering the different pages (especially hubs /projects for e.g) and the individual posts took too long
  2. Solution seemed elegant - one config file, typed frontmatter with custom fields, etc

Immediately ran into several problems:

  1. Contentlayer has long since been deprecated
  2. Contentlayer2 seems like a plug-and-play update but after a wrong misstep with npm update I kept encountering:
A React Element from an older version of React was rendered. This is not supported. It can happen if:
- Multiple copies of the "react" package is used.
- A library pre-bundled an old copy of "react" or "react/jsx-runtime".
- A compiler tries to "inline" JSX instead of using the runtime.

There were no solutions to this.

  1. Did not understand the error Error: Page missing param in "generateStaticParams()", which is required with "output: export" config. Ended up removing output: export.
  2. Took a while to understand how contentLayer handled fields. If you want custom slugs and urls, use a different field e.g. customSlug for slug; link instead of url and custom fields to point to slug and url because that's what's used for routing, etc.
  3. I also tried using next-mdx-remote but it was asking me to turn the slug pages into client-side rendered components so that defeats the purpose

In the end, given how my website layout is pretty much decided and will be content-rich, I am migrating to Astro.