The docs say you can define a custom document at pages/_document.js.
But is there any way to make two pages that use different custom documents?
You need to have a single pages/_document.js and you can then check the URL before rendering to change the HTML you're going to render.
That makes of a lot more sense than what I was imagining
@sergiodxa this sounds like an excellent approach!
Can you give a simple example of this?
I can get _document.js to identify URL (query, pathname) on first load, but struggling with _document.js identify when the Routes are changed.
Thanks!
_document.js is only rendered once on the server, all navigation using is client side.
This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.
Most helpful comment
You need to have a single
pages/_document.jsand you can then check the URL before rendering to change the HTML you're going to render.