Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

base_url issue with images #144

Closed
pinggit opened this issue Apr 16, 2013 · 5 comments
Closed

base_url issue with images #144

pinggit opened this issue Apr 16, 2013 · 5 comments
Assignees
Milestone

Comments

@pinggit
Copy link

pinggit commented Apr 16, 2013

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?

@marshallshen
Copy link
Collaborator

Hi:
Looks like BASE_PATH didn't get set properly.
Have you tried jekyll serve --safe and see if it solves the problem locally?

@groundh0g
Copy link
Collaborator

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")

@groundh0g groundh0g self-assigned this Feb 28, 2015
@groundh0g
Copy link
Collaborator

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.

@groundh0g groundh0g added this to the v 0.4.0 milestone Mar 15, 2015
@henrich
Copy link

henrich commented May 16, 2015

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 .

@groundh0g
Copy link
Collaborator

Thanks for the update.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants