After Deploying to GitHub Page Nuxt.js Site Cannot Show Images

This is my new website build by Nuxt.js. I'm so excited to use the new framework. But after deploying to the GitHub page, the site cannot show any picture.

Since the Nuxt.js automatically generates the static files like images to a new folder _nuxt/, and uses this path to show pictures. I thought maybe the underscore was the reason that caused the problem.

Then I found this article on GitHub Help: 'Files that start with an underscore are missing'.

Because of GitHub Pages uses Jekyll by default to build Pages sites. Because the way of how Jekyll works, any files or folders that start with _, ., # or end with ~ are not built.

The solution is to add a blank file named .nojekyll in the dist/ folder.

So here we go. I have a new website.

Actually, Nuxt.js automatically generates a .nojekyll file in the dist/ folder. And this file cannot manually upload to git repository.


© 2020 Made with 💖 by CY in Beijing.