Deploying Next.js on gh-pages
Wow, this is my first page with Next.js. I'm so glad of it! 🙌
And as it is my first deploy on GitHub too, I had just a little problem with GitHub Pages.
Indeed, as you could know, GitHub Pages use Jekyll as default, and one of theirs convention is to use
_ as prefix of any folder which are used for the templating, not the final
dist. Sounds not bad like that, but Next.js also uses a folder called
_next for distributed assets.
So yeah, the first time I deployed my blog, it was so weird, no assets were available. 😱
I finally found the solution on the GitHub blog.
You simply must add an empty file called
.nojekyll in order that GitHub doesn't think you're in a Jekyll environment. Done!
By the way, if you use the excellent command line gh-pages, do not forget to use the parameter
--dotfiles to also deploy this new file.