Checklist
How did you create the site?
Generated from chirpy-starter
Describe the bug
The problem manifest itself when baseurl in the _config.yml is defined as something other than empty.
This problem affects all markdown where an <img> tag is generated. Whatever the src attributed contains, it gets the baseurl prepended twice.
This seems to happen because a final step in rendering is to pull things through the refactoring code. For <img> tags, this then results in the subsequent code in refactoring ultimately calling
{% include media-url src=<baseurl>/assets/images/Flag.png> %}
This shows that the baseurl was already applied before it got to this point. The include prepends it again.
Steps To Reproduce
- Define baseurl as "my_site" in _config.yml
- In any
.md file include (thec second variation to show this problem has nothing to do with the jekyll_picture_tag plugin):
Picture plugin: {% picture "Flag.png" --alt Flag %}
MD Image full path: 
- Observe output (formatted for clarity):
<p>
Picture plugin:
<picture>
<source srcset="/my_site/assets/images_gen/Flag-400-dd43f229f.webp 400w, /my_site/assets/images_gen/Flag-600-dd43f229f.webp 600w, /my_site/assets/images_gen/Flag-800-dd43f229f.webp 800w, /my_site/assets/images_gen/Flag-1000-dd43f229f.webp 1000w, /my_site/assets/images_gen/Flag-1600-dd43f229f.webp 1600w" type="image/webp" />
<source srcset="/my_site/assets/images_gen/Flag-400-a5c1e79ca.png 400w, /my_site/assets/images_gen/Flag-600-a5c1e79ca.png 600w, /my_site/assets/images_gen/Flag-800-a5c1e79ca.png 800w, /my_site/assets/images_gen/Flag-1000-a5c1e79ca.png 1000w, /my_site/assets/images_gen/Flag-1600-a5c1e79ca.png 1600w" type="image/png" />
<a href="/my_site/my_site/assets/images_gen/Flag-800-a5c1e79ca.png" class="popup img-link shimmer">
<img src="/my_site/my_site/assets/images_gen/Flag-800-a5c1e79ca.png" alt="Flag" loading="lazy">
</a>
</picture>
</p>
<p>
MD Image full path:
<a href="/my_site/my_site/assets/images/Flag.png" class="popup img-link shimmer">
<img src="/my_site/my_site/assets/images/Flag.png" alt="Test" loading="lazy">
</a>
</p>
- Notice that in both cases the
<img> tag was surrounded by an <a> during refactoring (fine), and the src attribute in the tag now has the baseurl value in there twice. Tags like <source> which also contain image paths are unaffected by the refactoring code, and consequently are correct.
Expected Behavior
Do not double up on the baseurl
Environment
Anything else?
No response
Checklist
How did you create the site?
Generated from
chirpy-starterDescribe the bug
The problem manifest itself when
baseurlin the_config.ymlis defined as something other than empty.This problem affects all markdown where an
<img>tag is generated. Whatever thesrcattributed contains, it gets thebaseurlprepended twice.This seems to happen because a final step in rendering is to pull things through the refactoring code. For
<img>tags, this then results in the subsequent code in refactoring ultimately callingThis shows that the baseurl was already applied before it got to this point. The include prepends it again.
Steps To Reproduce
.mdfile include (thec second variation to show this problem has nothing to do with the jekyll_picture_tag plugin):<img>tag was surrounded by an<a>during refactoring (fine), and thesrcattribute in the tag now has thebaseurlvalue in there twice. Tags like<source>which also contain image paths are unaffected by the refactoring code, and consequently are correct.Expected Behavior
Do not double up on the baseurl
Environment
Anything else?
No response