-
Notifications
You must be signed in to change notification settings - Fork 18
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
Conversation
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.
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 |
They way I have it set is just as an override. So if you set the url
option, then it takes precedence over the site.url setting. It falls back
to site.url if it is not set.
…On Dec 15, 2017 16:46, "Nicolas Hoizey" ***@***.***> wrote:
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?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#29 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAf8xwBU1t_Yl7TQaMdz5NpYZMhLUBARks5tAj_jgaJpZM4Q-VVm>
.
|
Ok, so that's it, to switch from dev to prod and back to dev, I have to edit 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. |
I'm trying to imagine the use case where someone might want to set a
different base domain for dev and prod, but it feels like that use case is
actually quite complex. Two different image sources?
I mean, if the images are remote then you will never really want to use
localhost because cloudinary wouldn't be able to fetch. And of the images
are not remote, then you wouldn't want to use localhost because they will
always be stored on the cloudinary cdn.
The only instance I can imagine is if you wanted to, say, use two different
cdns - one dev and one prod, but that seems like a complex use case.
Just can't see how you would ever want to use localhost at all, which is
what dev does by default here due to Jekyll.
…On Dec 15, 2017 20:49, "Nicolas Hoizey" ***@***.***> wrote:
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.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#29 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAf8x-iGtvPWTZzrKiihmb03Y6Be7j7Vks5tAnjZgaJpZM4Q-VVm>
.
|
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! |
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:
When your images are stored on different server than where your site is hosted, use the
url
setting to point correctly to them.In development mode,
site.url
is overridden by Jekyll tolocalhost:4000
. This has the unfortunate consequence of breaking allCloudinary 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.