Skip to content
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

How to deal with differing site roots between environments? #760

Closed
ariofrio opened this issue Jan 15, 2013 · 3 comments
Closed

How to deal with differing site roots between environments? #760

ariofrio opened this issue Jan 15, 2013 · 3 comments

Comments

@ariofrio
Copy link

When I run jekyll --server my site is available at http://localhost:4000/, but when I deploy to GitHub Project Pages, it's available at http://username.github.com/projectname/.

This means that I cannot use absolute URLs when referring to stylesheets and other resources. Relative URLs break when the same layout is used by e.g. index.html and 2012/01/01/happy-new-year.html. What is the-accepted/a-good way of adding stylesheets and other resources to a GitHub Project Pages repository?

Cross-posted from Stack Overflow.

@why-el
Copy link

why-el commented Jan 15, 2013

I used something like {{site.url}}/some_relative_path to solve these issues. Site.url will evaluate to whatever current root is.

@parkr
Copy link
Member

parkr commented Jan 17, 2013

@why-el nailed it. Use site.url. You can set it with baseurl in your _config.yml.

@parkr parkr closed this as completed Jan 17, 2013
@ljvasey
Copy link

ljvasey commented Feb 22, 2014

This article in the official Jekyll docs deals with how to set up your _config.yml and your local server to work perfectly with Github pages.

It has very clear and simple instructions about how to avoid this exact issue :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants