Quickly and easily deploy an Eleventy Static Site to GitHub Pages with an optional custom domain.
- Use or create a new Eleventy project and commit and push it to a GitHub repo.
- In the root folder of your Eleventy project create a new file
deploy.sh
and copy the contents into it and on the commandline runchmod +x deploy.sh
- Edit your
package.json
file adding"deploy": "./deploy.sh"
into the bottom of thescripts:
section.
- Create a new file
.gh-pages
in the root of your project containing your custom domain (withouthttps://
): e.g.your-blog.example.com
- Go to your domain providers settings and add a new DNS entry for your custom domain:
- Type:
CNAME
- Name:
your-blog.example.com
- Target:
your-github-username.github.io
- Type:
Run npm run deploy
and after a couple of minutes your Eleventy project should be live at either: https://your-github-username.github.io/your-blog or on your custom domain: https://your-blog.example.com.
Run the same command again to update.