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

Small feature: add optional 'origin_url' var to settings #29

Merged
merged 8 commits into from
May 29, 2018

Conversation

suprafly
Copy link
Contributor

This pull requests adds a vry small but useful update - a url
setting that overrides the site.url setting.

This is useful for two use cases:

  1. When your images are stored on different server than where your site is hosted, use the url setting to point correctly to them.

  2. In development mode, site.url is overridden by Jekyll to localhost:4000. This has the unfortunate consequence of breaking all
    Cloudinary tagged images on your site, because Cloudinary cannot fetch remotely from your localhost. Jekyll recommends that you run the site in production mode as a work around, but this has the consequence of pointing all internal links to your site's domain.

Using the url setting you can mitigate this by pointing the loudinary images to the url where they exist, while allowing your development site to still function correctly.

This pull requests adds a vry small but useful update - a `url`
setting that overrides the `site.url` setting.

This is useful for two use cases:

1. When your images are stored on different server than where your site is hosted, use the `url` setting to point correctly to them.

2. In development mode, `site.url` is overridden by Jekyll to `localhost:4000`. This has the unfortunate consequence of breaking all
Cloudinary tagged images on your site, because Cloudinary cannot fetch remotely from your localhost. Jekyll recommends that you run the site in `production` mode as a work around, but this has the consequence of pointing all internal links to your site's domain.

Using the `url` setting you can mitigate this by pointing the loudinary images to the url where they exist, while allowing your development site to still function correctly.
@nhoizey
Copy link
Owner

nhoizey commented Dec 15, 2017

Thanks for the PR, this is indeed a common need.

I didn't look the code yet, but does it mean you have to change the url setting value every time you change your build from dev to prod and vice versa?

@suprafly
Copy link
Contributor Author

suprafly commented Dec 15, 2017 via email

@nhoizey
Copy link
Owner

nhoizey commented Dec 15, 2017

Ok, so that's it, to switch from dev to prod and back to dev, I have to edit _config.yml each time. It feels to complex IMHO, for this use case.

It is nice however to be able to set a prefix for images URLs that is not the site domain, so I'll check the code and maybe merge anyway.

@suprafly
Copy link
Contributor Author

suprafly commented Dec 15, 2017 via email

@nhoizey
Copy link
Owner

nhoizey commented May 21, 2018

@suprafly do you think this covers your need: #34

@nhoizey nhoizey changed the title Small feature: add optional 'url' var to settings Small feature: add optional 'origin_url' var to settings May 29, 2018
@nhoizey
Copy link
Owner

nhoizey commented May 29, 2018

Even if the local development issue has already been resolved another way, your PR is still interesting for cases where images are located on another domain.

Thanks!

@nhoizey nhoizey merged commit 971ea70 into nhoizey:master May 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants