-
Couldn't load subscription status.
- Fork 152
Allow user to set empty baseurl #97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The route I'd like to take is to change the default in Jekyll from |
Using an empty string as the default value causes all sorts of problems where you don't know if this is user-specified or not. Using an explicitly "illegal" value, like `nil`, resolves this issue. See jekyll/github-metadata#97 for more info.
|
I have a PR here: jekyll/jekyll#6137 |
|
v3.4.4 is now released with this patch! |
| let(:user_config) { { "baseurl" => "/" } } | ||
|
|
||
| it "mangles site.url" do | ||
| expect(site.config["baseurl"]).to eql("/github-metadata") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You want this case to mangle?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was the original logic.
- Scenario 1: Users incorrectly set their baseurl as
/ - Scenario 2: A sophisticated user is proxying their site and wants their baseurl to be
/despite it being a project page
I'd lean towards mangling, as in scenario 1, the user needs our help more than the user in scenario 2.
|
@parkr with 3.4.5 out, I believe this is ready for 👀. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One test change required, otherwise 👍
| Jekyll::Commands::Build.process({ | ||
| "source" => SOURCE_DIR.to_s, | ||
| "destination" => DEST_DIR.to_s, | ||
| "gems" => %w(jekyll-github-metadata), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This only works for Jekyll::VERSION >= 3.5.0.
|
@jekyllbot: merge |
Via github/pages-gem#350 (comment), it's currently not possible to set a baseurl of "" that the Gem respects.
github-metadata/lib/jekyll-github-metadata/site_github_munger.rb
Line 44 in 40a725a
The problem is that by default, Jekyll sets the baseurl to "", not nil, meaning there's no way to know if it's a user-supplied value or not.
One option would be to respect
site.github.urlorsite.github.baseurlif passed.This PR pushes up a failing test and passing tests for the current expected behavior.
If anyone has a better approach, or would like to take a pass at implementing the above, it may be a while before I am able to work on this particular PR.