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
site.baseurl behaviour specific to GitHub Pages #350
Comments
Interesting. For a project site, should it have a baseurl locally? @parkr any strong feelings one way or the other? |
@MattiSG GitHub Pages is now powered by Jekyll 3.3, so you should be able to rely on |
I guess the expected behaviour here would be:
We don't add this value unless when |
@MattiSG Your repo seems to be missing a If you added a CNAME file, GitHub could figure out the |
Reverse-proxying it so we can serve it over HTTPS from a custom domain.
|
I have a similar use case. I'm using CloudFront as a reverse proxy CDN for the application, with the marketing portions of the site pointing to github pages. Would very much like an option _config.yaml to override this behaviour. The default behaviour makes perfect sense for the normal usage. |
We've been bitten by this again. The |
To confirm, the issue is that Jekyll GitHub Metadata should respect |
@benbalter Yes, that would be an out for us. (It may have undesirable side effects I haven't thought of.) Should I create an issue there? This is the relevant line. |
@Morendil that would be the relevant line, but my reading is that it shouldn't inject the baseurl if it is explicitly set as |
Correct - I'm reproducing this locally with |
Opened jekyll/github-metadata#97 with a failing test and more details about what's going on and our constraints. |
Closing in favor of jekyll/github-metadata#97. |
This is now fixed. If you set your baseurl to |
Hi @benbalter I've just stumbled to This is the relevant config I'm using:
Locally everything is fine, however, when deployed to What should be the proper config in this case. I've added some dummy tags to show the values or
Locally:
GitHub
As a temporary solution, I've set |
This is the proper solution. See https://help.github.com/articles/setting-up-your-github-pages-site-locally-with-jekyll/#step-2-install-jekyll-using-bundler for instructions on how to replicate production settings locally. See http://ben.balter.com/jekyll-style-guide/config/#baseurl (and the linked post) for more information on |
Other people said setting baseurl = "" fixed their problem, but that did not work for me (github/pages-gem#350)
Hi @benbalter, I'm really perplexed as this move from "/" to "" for my github pages blog broke the entire production and I didn't see this mentioned in any place. I'm sure this was my mistake but well, I got my blog crippled for a couple of hours and I was just leaving this here for a rant. Are you sure that |
@dottorblaster (and those that 👍'd)... would love to learn more about your hosting setup and why this would break a site. Are you proxing from a top-level domain to a subpath on GitHub Pages? If so, how are you acomplishing it? How does the
See http://ben.balter.com/jekyll-style-guide/config/#baseurl. Base URL was intended to represent a subpath, not
I'm not sure when you'd use it. I'd suggest using the
Re-reading https://github.com/jekyll/github-metadata/pull/97/files#diff-165b64b2f6bce98447b6c550f3205ad9L45 and https://github.com/jekyll/github-metadata/pull/97/files#r122748605, I think we may have misread the original logic (and didn't have adequate test coverage for this case). There's three potential baseurl values with clear intentions:
I understand now that the metadata change, along with the upstream default change had some unintended consequences. I'd love to learn more about how you're using GitHub Pages and the |
@benbalter an org I worked with has a project on a CNAME'd bare domain. https://github.com/OpenTechSchool/www.opentechschool.org/ Since ANY subpage will always have a slash prefixing it, I assumed setting If I have a subpage, instead of writing Now thanks to this change I will be removing the After all, when you visit |
due to weirdness with github/pages-gem#350
This bug was hard to trace down because it renders fine locally. I discovered the cause here: github/pages-gem#350. I tested everything with the changes introduced and they seem to work. However, I am not certain that the Disqus integration is truly working.
… }}/ in all pages
@benbalter to try to give you a more concrete example of how the story here is hard to figure out. First of all, in my permalink: /blog/:title/ Because of this, I need URLs to all use I have a website that was previously self-hosted at
What needs to happen is that I haven't tried the third case yet, but here's what happens in the first two:
Notice that the proposed solution of prefixing Instead, as far as I can tell, the only correct solution is to not set <base href="{{ site.baseurl }}/" /> to the site. I've also now tested that this works with the I wish this was documented somewhere since (seemingly) this is the kind of setup a decent number of people have. Now that I know how to configure it correctly, it doesn't seem so bad, but the process of figuring out exactly what to put where took a decent amount of trial and error! |
Followed this to fix the 404 html file github/pages-gem#350
GitHub will change site.baseurl to ''. Apparently the "right" way to do things is to use the relative_url filter. Background: github/pages-gem#350
I'm not super clear on why this was necessary or why it isn't a problem on the real builds for prod. github/pages-gem#350 looks likely to be relevant. I didn't dig too far.
This issue affects
What did you do (e.g., steps to reproduce)
baseurl
to''
in the_config.yml
.What did you expect to happen?
{{ site.baseurl }}
to be expanded to nothing.What happened instead?
{{ site.baseurl }}
was expanded to the name of the built GitHub repo.Additional information
Context: betagouv/beta.gouv.fr@a8280a4
The problem is that an empty
baseurl
is overridden on GitHub Pages, but not a non-empty one.The behaviour is not exactly the same as specifying a
--baseurl
in the build options, as specifying it like that overrides any config value, even a non-empty one.For example, before this commit, everything worked fine:
{{ site.baseurl }}
was set, and expanded, to/
with the website still being properly served.The text was updated successfully, but these errors were encountered: