jamigibbs / phantom

A minimalist, responsive portfolio theme for Jekyll with Bootstrap
http://jamigibbs.github.io/phantom/
MIT License
341 stars 410 forks source link

Featured image path breaks on pagination #5

Closed eraxeg closed 6 years ago

eraxeg commented 8 years ago

When moving to next page, image paths become relative to the page folder. For example the img src /img/image-one.jpg becomes /page2/img/image-one.jpg Since all images are stored in the img/ folder this will not work. I tried making an ugly fix by prepending the baseurl to the image src, but this does not work on local development. So I made another variable site.base_url that does not have any other function than fixing this. There is surely a better way to fix this.

jamigibbs commented 8 years ago

Thanks for reporting this. It looks like a couple of things will need to be updated in order for the images to work in the pagination.

In _config.yml, the baseurl should match the production URL without the host (e.g. /example/, not http://jekyll.github.io/example): baseurl: "/example/"

So you would access the site locally at: http://127.0.0.1:4000/example/

And in _includes/featured-image.html, the images src should be: src="{{ post.featured_image | prepend:site.baseurl }}".

Give that a try and let me know if you still have any trouble with it.