Edit this page

GitHub Pages

By pre-rendering your pages, you can remove the need for a production server. You can then deploy your app to any static host, such as GitHub Pages.

Static hosts expect one .html file per URL. Consequently, you must pre-render all your pages, including SPA pages (the generated .html files of SPA pages have an empty <body>).

In general, you can choose between the following strategies to build and deploy:

  • Build locally and upload dist/client/ to GitHub Pages.
  • Let a GitHub action build and upload dist/client/ to GitHub Pages.
  • Let GitHub Pages build your app.

The $ vike build command generates a directory dist/client/ which contains all static assets.

We recommend using the GitHub Pages Deploy Action. For example, vike.dev uses this GitHub workflow to automatically deploy whenever a commit changes Vike's docs.

You can try out your production build locally using $ vike preview. (You can also use a local static host, for example $ serve dist/client/).

If you want your app's URLs to start at https://my-domain.com/some/path/**/* (instead of the domain root https://my-domain.com/**/*), change the Base URL to /some/path/.

For example, if you want to deploy to GitHub's domain username.github.io/repo-name/**/*, set the Base URL to /repo-name/.

⚠️

Make to sure to add an empty file .nojekyll, otherwise GitHub Pages won't serve static files starting with _.