Closed ghost closed 8 years ago
I've made a gist which prepends site.baseurl
in front of the image url.
Take a look and let me know how bad my Ruby skills are :smile:
I borrowed from this plugin: https://github.com/jhauraw/jekyll-url-helper-filter-plugin
Thanks! I'll take a look at it, and add it to the theme if I don't run into any snags. It should make writing posts a little more intuitive
closing because after experimenting with the code I wrote, I found it wouldn't solve the problem. Your baseurl issue is related to something else. Good luck!
Thanks. The ‘baseurl’ thing is mostly related to getting the sample site to display on the gh_pages branch. Most users will want to edit _config.yml and set the baseurl to blank or ‘/‘
On Nov 17, 2015, at 10:00 AM, Nick notifications@github.com wrote:
closing because after experimenting with the code I wrote, I found it wouldn't solve the problem. Your baseurl issue is related to something else. Good luck!
— Reply to this email directly or view it on GitHub.
welp after fiddling with some code, I was able to actually get this to work with a baseurl
of /
and a liquid tags with relative urls for example:
{% fullwidth 'assets/img/123.png' 'A caption for the image' %}
So no more need for hard coded urls.
I'll fix up a pull request for you to look at.
OK I've added the pull request which fixes this issue.
The one thing I want to check is whether links to external urls still work. I have gotten tied up on some other things, and haven't had time to do any checking. Thanks for you work on this. Its great to have all these contributions!
On Nov 20, 2015, at 12:22 AM, Nick notifications@github.com wrote:
OK I've added the pull request which fixes this issue.
— Reply to this email directly or view it on GitHub.
The one thing I want to check is whether links to external urls still work.
Good point, I had forgotten that. I'll check and update my PR with necessary changes.
d65d85a adds checks for external image urls and omits baseurl if image url contains http/https
Ok! I tested and it's working well for me so far. I updated the Readme to include some examples of external image urls.
Is your baseurl issue related to this? https://github.com/jekyll/jekyll/issues/332#issuecomment-18952908 Are you sure it's your code that is causing the problem?
EDIT: I realize now that Jekyll variables are not available inside a Markdown post document, so
site.baseurl
needs to be added automatically within @clayh53's custom plugins.