Deploy your theme to Netlify

Thanks to this post by @anthonyfok, I can now override the theme specified in the config file by setting the environment variable HUGO_THEME in netlify.toml

[build]
  publish = "exampleSite/public"
  command = "cd exampleSite && hugo --gc --themesDir ../.."

[build.environment]
  HUGO_VERSION = "0.53"
  HUGO_THEME = "repo"
  HUGO_BASEURL = "https://vanilla-bootstrap-hugo-theme.netlify.com/"

Edit: use HUGO_BASEURL env var per tip from @kaushalmodi

2 Likes