It’s really easy to host your Hugo site with GitHub Pages, just use GitHub Actions for Hugo.

Flow diagram

This is how it works:

|files| /archetypes, /content, /static, /themes, config.toml| -+ [branch] main] -> (trigger) Build)
                                                                                    |
                                                                                    *
|files| /assets, /categories, /img, /page, /tags, index.html, 404.html, index.xml, sitemap.xml|
                                                                                        |
                                                                                        +
                                                                                [branch] gh-pages]
                                                                                            |
                                                                                            *
                                                                                    /site.github.io/

Notes

Don’t forget to change your GitHub Pages settings to

  • Branch: gh-pages
  • Directory: / (root)