Skip to content.

Hugo: baseURL set in GitHub Actions

Collaborative websites need to be forked, but if you set baseURL the forked website will load resources from the original.. Not ideal. The fix I applied to my GitHub Actions CI to work around this: jobs: deploy: runs-on: ubuntu-latest defaults: run: shell: bash steps: - name: Build 🔨 run: | hugo --baseURL https://${GITHUB_REPOSITORY%%/*}.github.io/${GITHUB_REPOSITORY#*/} This overrides the configured baseURL at build time with your GitHub account name as the subdomain and the repository as the directory. Read more →

Hosting my Hugo static website on GitHub Pages using Actions and my own domain

In a cost-saving exercise I wanted to try host my personal website on a free platform, since the code repository is hosted on GitHub, I decided to look into GitHub pages. My existing workflow combines three repositories to build the website: Hugs (Repo) - Contains my Hugo configuration and assets Blog (Repo) - Contains the blog posts Hugo-theme (Repo) - Contains the Hugo theme In order to use GitHub Pages I needed a fourth repository named after my GitHub account: joeheaton. Read more →
avatar
Joe Heaton

Email: joe@heaton.dev

Web:

Joe’s technology-focused murmurings.

Settings!