Next.js Discord

Discord Forum

NextJS 13 is not rendering all the content in HTML, but giving a JSON object instead

Unanswered
Checkered Giant posted this in #help-forum
Open in Discord
Checkered GiantOP
I am not sure why, but NextJS 13 is rendering static content as a JSON object (left side of the image), instead of HTML (right side of the image).

These 2 sites have the same base and I can't figure out why the one on the left has its content being served with a JSON object, while the right one is being served with the desired HTML output.

Is there any gotcha that I might be missing?

Update: on the left side I am reading the content from JSON files, while on the right side I am reading the content from markdown files. This is the only difference.

This is my next.config.js file:

const path = require('path')
const { withContentlayer } = require('next-contentlayer')

const nextconfig = {
  reactStrictMode: true,
  trailingSlash: true,
  sassOptions: {
    includePaths: [path.join(__dirname, 'styles')],
  },
  images: {
    formats: ['image/webp'],
    minimumCacheTTL: 600000,
  },
}

module.exports = withContentlayer(nextconfig)

1 Reply

Checkered GiantOP
SOLUTION: Instead of using a fragment <></> I had to use another HTML tag and the SSR is working now ✅