This blog is forked from timlrx/tailwind-nextjs-starter-blog with very minor modifications.
Static hosting services / GitHub Pages / S3 / Firebase etc.
-
Add
output: 'export'
innext.config.js
. See static exports documentation for more information. -
Comment out
headers()
fromnext.config.js
. -
Add
unoptimized: true
to theimages
key innext.config.js
:Alternatively, to continue using
next/image
, you can use an alternative image optimization provider such as Imgix, Cloudinary or Akamai. See image optimization documentation for more details. -
Remove
api
folder and components which call the server-side function such as the Newsletter component. Not technically required and the site will build successfully, but the APIs cannot be used as they are server-side functions. -
Run
yarn build
. The generated static content is in theout
folder. -
Deploy the
out
folder to your hosting service of choice or runnpx serve out
to view the website locally.
Note: Deploying on Github pages require addition modifications to the base path. Please refer to the FAQ for more information.