Skip to content

Pages jekyll publishing workflow results in incorrect baseurl #1673

@bertptrs

Description

@bertptrs

In the starter template for publishing a jekyll-based site to Github pages using the new Actions infrastructure, it shows how you can autodetect the correct publishing URL:

- name: Setup Pages
id: pages
uses: actions/configure-pages@v1
- run: bundle exec jekyll build --baseurl ${{ steps.pages.outputs.base_path }} # defaults output to '/_site'

As the comment suggests, this results in just "/" for the main site published to a domain (e.g. example.com) and to something like /subfolder/ for subprojects.

This is not what Jekyll expects; in fact the default configuration has baseurl be the empty string: https://jekyllrb.com/docs/configuration/default/

If you have a site that uses baseurl as a prefix to support separate deployments, the URLs generated will now start with two leading slashes rather than function as expected.

I see two ways to resolve this:

  1. update the "Setup pages" action to reflect the correct baseurl which would be a breaking change, or
  2. change the starter workflow, doing one or both of the following
    • Add a note that --baseurl … needs to be left out for a main site, or
    • Remove the --baseurl from the example altogether, make another workflow for subprojects specifically

I probably missed a cleaner solution, but this would at least work.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions