kroxylicious / kroxylicious.github.io

kroxylicious.io org page
0 stars 8 forks source link

GitHub workflow unsets site.baseurl at build time due to unnecessary --baseurl parameter #54

Open gracegrimwood opened 4 months ago

gracegrimwood commented 4 months ago

Noting this down because it's been on my to-do list for a while and I still haven't got around to doing it:

The "Build with Jekyll" step in the GitHub workflow for the site currently overrides the baseurl variable declared in _config.yml with an empty value.

This happens because the step invokes Jekyll with the command

bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"

But the variable steps.pages.outputs.base_path is empty when the step is invoked, so the global site.baseurl is overridden with that empty value.

This is not really a problem for the production site because we don't set site.baseurl or rely on it for anything. However, for example, when testing the workflow in other repositories or attempting to demo changes to the site on a subpath of a personal GitHub pages URL, this breaks the site significantly (i.e. images, styles, and links do not resolve because site.baseurl is incorrect so the URLs are mangled at build time).

The fix is simple, we just need to remove the --baseurl "${{ steps.pages.outputs.base_path }}" portion from the Jekyll build command.