Static site generator create new opportunities for streamlined workflow. For Hugo, I created two git repositories, once for the blogs’ source and one for the static output. I then checked them out, first the source repository normally: git clone https://<path-to-source-repo>.git. Then I cloned the output repository inside the source repo as a sub-module: git submodule add https://<path-to-output-repo>.git public. The “public” folder in this case was directly inside
With this done I can edit the source repo, add new blog posts or make style changes. Then, running the hugo command outputs into the sub-module. Committing the top level repository does not commit the output, which is what we want. Instead, you change the directory to the sub-module’s folder and then run git commands there to affect the sub-module’s repository.
This is very useful as we can then use this output repository to automatically publish to a git aware cloud provider, avoiding the manual upload/update step via FTP or other mechanisms.