Headless CMS: Blog content loses styling in Nextjs frontend

  • Unknown's avatar

    Hello everyone. I am reaching out to the community for support.

    I’m consuming WordPress API as a headless CMS in a React project. After displaying the content/body of a post, it loses the default styling from WordPress for paragraphing, indentation, line spacing and line height between paragraphs, spacing between an in-content image etc.

    I used the dangerouslySetInnerHTML attribute in the div tag where I output the data. But it didn’t do the trick. I also used an npm package called sanitize-html to clean up the default WordPress HTML possible conflict.

    Please, what am I missing?

    Additional info: my WP is installed on the AWS Lightsail server instance and Nextjs is on Vercel.

    The blog I need help with is: (visible only to logged in users)

  • Unknown's avatar

    We can’t help as that site isn’t running on the wordpress.com platform. You must find yourself a solution for these experimantel things.

  • The topic ‘Headless CMS: Blog content loses styling in Nextjs frontend’ is closed to new replies.