Closed Tamriel closed 6 years ago
Indeed, so far I have been trying to make the plugin use relative paths, in order to possibly minimize the amount of problems occurring when nested pages are renamed. AFAIK, the Markdown parser used by Grav generates every path dynamically, so it doesn't have the problem.
However, I think I've tested the trivial blog setup outlined in the steps to reproduce before, and it used to work.
Nevermind, looks like I got fooled by the Antimatter-induced header image. Issue confirmed, I guess, although I sadly cannot guarantee that it will be fixed soon, as I deem a full conversion to absolute paths insufficient, while figuring out a system to match Markdown might take time, and my free time is currently rather scarce.
Thanks for reporting!
Thanks for your explanations!
I was able to solve it by adding the following below {{ page.content }}
inside the file antimatter/templates/blog.html.twig
:
<script>
window.onload = function() {
$('img').each(function() {
var src = $(this).attr('src');
if (src.charAt(0) != '/') {
$(this).attr('src', '/blog/' + src); // prepend the path of the blog
}
});
};
</script>
Fixed in v1.2.0, hopefully, although in a way that I still consider rather suboptimal - absolute paths are now used by default and patched as a page gets modified from within the admin panel, but when a page that has children is moved or renamed, its children unfortunately do not get patched, as I believe that this cannot currently be done without significant risk of data corruption.
Nevertheless, that would be a different issue, so for the sake of clarity closing this one - You're welcome to submit a new one if the new behavior proves problematic.
Images of blog items (
partials/blog_item.html.twig
) are not visible in the blog, but when viewing a single blog item: A blog, images not visible A blog item, images visibleThis is because the generated html by this plugin is relative, e.g.
<img src="my-blog-item/an-image.png" />
. The html generated from markdown (without this plugin) has an absolute path to an image folder.Steps to reproduce:
Blog
Item
below the Blog