base_url issue with images
pinggit opened this issue · comments
this work fine previously , when I use:
-
default _config.yaml
-
root of a http server as my website
![win7dos](/images/win7dos.jpg "win7dos")
now , I decided to use one of the sub-folder of the same website under root, and I already set:
BASE_PATH : http://www.mysite.com/~pings/myblog
but still my image links refers to :
http://www.mysite.com/images/picture.jpg
instead of
http://www.mysite.com/~pings/myblog/images/picture.jpg
I read issue (65)
#65
and I tried:
![win7dos](/images/win7dos.jpg "win7dos")
![win7dos]({{ BASE_PATH }}/images/win7dos.jpg "win7dos")
none of them worked...
but even if it could, still I think that makes the blog really hard to port -- do I need to modify content of every post in order for it to be migrated?
Hi:
Looks like BASE_PATH didn't get set properly.
Have you tried jekyll serve --safe
and see if it solves the problem locally?
I'll review the comments, try to repro the issue, then test and create PR.
Regarding the question:
do I need to modify content of every post in order for it to be migrated?
I think the answer is yes. Your first example uses absolute pathing. The modified example shows relative pathing. I think the answer is to always favor relative (e.g. {{ BASE_PATH }}/images/my-image.jpg
), since it works in both scenarios.
![win7dos](/images/win7dos.jpg "win7dos")
![win7dos]({{ BASE_PATH }}/images/win7dos.jpg "win7dos")
Agree with @marshallshen's comment. Looks like BASE_PATH
didn't get set properly, or wasn't included in the post(s) via {% include JB/setup %}
.
Given the age and inactivity on this issue, marking as closed for now. Feel free to reopen if you have more information or still need help.
Hi,
I got a same issue but solved it. The reason why BASE_PATH was not extracted is
missing of "jekyll.environment" in my environment, so just run "JEKYLL_ENV=production jekyll build"
was help for me.
It's bettter to add mention for it to _config.yml .
Thanks for the update.