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

Fix #211, wordpressdotcom import assets URLs #212

Merged
merged 1 commit into from Aug 16, 2015

Conversation

Projects
None yet
4 participants
@gynter
Contributor

gynter commented Jul 24, 2015

Currently URLs created for downloaded images in assets_folder are not prepended with slash therefore images are being linked as relative URLs i.e /2012/03/16/assets/myimage.jpg instead of the correct absolute ones /assets/myimage.jpg.

The fix also adds support for site.baseurl which means the images will also be linked correctly when serving site from custom base URL.

More info in forums.

@@ -30,7 +30,7 @@ def self.download_images(title, post_hpricot, assets_folder)
images.each do |i|
uri = i["src"]
i["src"] = assets_folder + "/" + File.basename(uri)
i["src"] = "{{ site.baseurl }}/%s/%s" % [assets_folder, File.basename(uri)]

This comment has been minimized.

@parkr

parkr Jul 24, 2015

Member

What do you think about:

i["src"] = "{{ \"/#{File.join(assets_folder, File.basename(uri))}\" | prepend: site.baseurl }}"

?

@parkr

parkr Jul 24, 2015

Member

What do you think about:

i["src"] = "{{ \"/#{File.join(assets_folder, File.basename(uri))}\" | prepend: site.baseurl }}"

?

This comment has been minimized.

@gynter

gynter Aug 10, 2015

Contributor

Sorry, this notification went missing somehow for me.

Yes, that would make more sense and it's a platform indenpendent way. I'll fix the PR tomorrow evening (EEST).

@gynter

gynter Aug 10, 2015

Contributor

Sorry, this notification went missing somehow for me.

Yes, that would make more sense and it's a platform indenpendent way. I'll fix the PR tomorrow evening (EEST).

@danbernier

This comment has been minimized.

Show comment
Hide comment
@danbernier

danbernier Aug 10, 2015

Contributor

👍 I saw this same problem.

I also saw some kind of "redirect not permitted" errors; looks like WordPress asset URLs are sent through a 302. I haven't thoroughly checked it out yet though.

Contributor

danbernier commented Aug 10, 2015

👍 I saw this same problem.

I also saw some kind of "redirect not permitted" errors; looks like WordPress asset URLs are sent through a 302. I haven't thoroughly checked it out yet though.

parkr added a commit that referenced this pull request Aug 16, 2015

@parkr parkr merged commit 39ea7d0 into jekyll:master Aug 16, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

parkr added a commit that referenced this pull request Aug 16, 2015

@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.