DIY Free Static Blog Publishing Platform

Dec 20, 2021
Walter Manger
3 minute read
Preview of the DIY Publishing Platform

Preview of the DIY Publishing Platform

This site is generated by a static site generator (SSG) called hugo , but this guide will work with any SSG.


I wanted to be able to keep raw markdown, and any other files that may be considered private, separate from what is viewable by the public.


  1. A private Github repository to contain your raw markdown and any other assets that may or may not be considered publishable.
  2. A public Github repository to contain the statically generated output of your SSG.

Private Repository

This respository will contain all the raw markdown and any other files that may be considered private. In my case, it contains the directories that hugo expects, plus some other files that I like to have around to keep track of my writing ideas and todos.

Here’s a look at the folder structure for the repository that generates

Here are the contents of the Makefile.

.PHONY: all

HUGO := hugo

all: clean clone generate publish

	@echo "Cleaning /public"
	rm -rf $(CURDIR)/public

	@echo "Cloning public repo"
	git clone {YOUR_PUBLIC_REPO_URL} public

	@echo "Generating HUGO"
	$(HUGO) -D=false --gc --minify

	@echo "Publishing Changes"
	cd public \
	&& git config "{YOUR_GITHUB_USER_EMAIL}" \
	&& git config "{YOUR_NAME}" \
	&& git add . \
	&& git status \
	&& git commit -m "Git Push via Make" \
	&& git push -f -q https://$(DEPLOY_PAT){YOUR_GITHUB_USER}/{REPO_NAME}.git master
	@echo "Pushed to remote"

The Makefile is used by a Github Actions workflow inside of .github/workflows/generate-deploy.yml. Here’s a look at that file.

name: Hugo Generate & Deploy

      - master

    runs-on: ubuntu-20.04
      group: ${{ github.workflow }}-${{ github.ref }}
      - uses: actions/checkout@v2
          submodules: true  # Fetch Hugo themes (true OR recursive)
          fetch-depth: 0    # Fetch all history for .GitInfo and .Lastmod

      - uses: peaceiris/actions-hugo@v2
          hugo-version: '0.89.4'
          extended: true

      - name: Run Make
          DEPLOY_PAT: ${{ secrets.DEPLOY_PAT }}
        run: make

There’s a dependency on a secret named DEPLOY_PAT. This is a Personal Access Token that has permissions to commit changes to your public repository.

When changes are pushed to this private respository, the make command is executed, which executes the hugo command and commits, then pushes the generated files to your public repository.

Public Respository

This public repository is set up for Github Pages , which makes the files in this respository viewable to the public. Your static site will be available at Follow the documentation here to enable the use of a custom domain.


I like to add analytics outside of the statically generated files, that’s why I use Cloudflare . With Cloudflare, I get:

  • Speed: all these static files are cached in nodes all around the planet
  • Security: support for https
  • Modularity: the ability to drop-in functionality, such as Google Analytics

Final Thoughts

Hopefully this helps you create your own static blog publishing platform. I still have not found the technology that would increase my blogging output, but I’ll keep you posted if I do.