7

Does anyone have any pointers on how to go about adding a /docs page for website documentation to a next.js app? I've looked up Docusaurus but it seems like it's already a react app itself. Is there a way to integrate it inside an existing next.js app or are there other solutions?

Many Thanks

Bhupendra
  • 1,196
  • 16
  • 39

2 Answers2

1

One idea might be to intercept the request and send the html file that docusaurus builds out, and putting all other files in the public folder.

https://medium.com/wesionary-team/render-html-file-in-pages-of-next-js-59281c46c05

Also checkout this discussion about it. https://github.com/vercel/next.js/discussions/12373

0

I have done this with React apps using express. But never with Next. At first it looks like it would be possible with multi-zone in Next but that doesn't seem to do the job. So my other recommendation would be to try to use a docs.domain.com instead and host it separately. Then you have a /docs url or a button that redirects to the doc domain instead.

Firebase has free hosting and allows you to setup multiple sites. So it should be fast to test this setup there

I'm going to actively try to get this to work with Next myself but I do not think it will work because of how they are developed. So I would do the above recommendation and if I find a workaround, I'll post an update.

user2835532
  • 113
  • 1
  • 1
  • 10
  • Please add answer if you have some solution , or else you can put it as a discussion – Goutham J.M Aug 02 '22 at 09:35
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Goutham J.M Aug 02 '22 at 09:36