-
Notifications
You must be signed in to change notification settings - Fork 326
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
Fixes Image Sources #459
Fixes Image Sources #459
Conversation
What is "Resolved root path"? |
I'm guessing @manikmagar is referring to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good to me 👍
Thanks @jonbullock. Yes I meant |
|
||
HtmlUtil.fixImageSourceUrls(fileContent, config); | ||
|
||
String body = fileContent.get(Attributes.BODY).toString(); | ||
|
||
assertThat(body).contains("src=\"http://www.jbake.org/blog/2017/05/first.jpg\""); | ||
assertThat(body).contains("src=\"http://www.jbake.org/../../../blog/2017/05/first.jpg\""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm. I would have expected the url without the Attributes.ROOTPATH here.
|
||
assertThat(body).contains("src=\"http://www.jbake.org/../../../blog/2017/05/first.jpg\""); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here. it's a strange looking url. as long as the site.host is present do we really need to append the rootpath here? the uri is relative to the website root already, isn't it?
|
||
String body = fileContent.get(Attributes.BODY).toString(); | ||
|
||
assertThat(body).contains("src=\"../../../blog/2017/05/first.jpg\""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will only work for the first_post.html file. if it is an post shown with content on the index page the url would be wrong openening the file directly from a browser. on the index page it should be blog/2017/05/first.jpg
.
Changed so root path isn't used anymore.
Changed so root path isn't used anymore.
Changed so root path isn't used anymore.
Merged in #459 and addressed code review suggestions - take 2
Merged in manually as part of #535 |
Fixes #440 and #455
http://
orhttps://
./
. Eg.CompileOnSave.png
->../../2011/05/CompileOnSave.png
,./CompileOnSave.png
->../../2011/05/CompileOnSave.png
but/CompileOnSave.png
->/CompileOnSave.png
img.path.prepend.host
(defaulttrue
, otherwise it will not be backward compatible) decides ifsite.host
should be prepended to image source with Point 2 above. When set to false,site.host
will not be appended. [this along with addition root path should solve Option to generate relative image links in output #440 ]