I want to integrate rank math SEO tool API support for SEO.
Following this tutorial, returns full HTML ready head with good metadata and others, but the problem is, how to render it into NextJS 13 head area?
Nextjs 13 not working more with the Head component/tag.
How do you even render those tags as HTML?
Have a nice day.
2
Answers
If you’re not able to use the Next.js Head component in version 13, there are a few different approaches you could take to render head tags as HTML:
npm install --save react-helmet
, and then wrap your page content in aHelmet
component. For example:_document.js
file in yourpages
directory to customize the HTML document that is rendered for each page. You can include any necessary head tags in thehead
method of this component. For example:head
tag directly: If neither of the above options work for you, you could always include the necessary head tags directly in your page’s HTML using thehead
tag. For example:I hope one of these approaches works for you!
You can use this package to parse string into html.
Package:
html-react-parser