Hi,
I’ve been using grav on my website for a while and, a few weeks ago, some pages stopped displaying images.
The original file is still on the server, absolutely nothing has changed.
Other pages, on the other hand, still display images properly.
I’ve tried comparing the pages going through this issue to the ones that have been operating normally, but I could not find any difference between them.
Here are two examples with broken images:
And here one in which they are working properly:
What should I do to fix that? Thank you!
Hi,
I’ve just gave a look into your code, and for your second page, here’s the HTML code for the broken image :
<figure role="group"><img src="https://privacidadeparajornalistas.org:80/home/line.png"></figure>
And on the third page, where everything’s fine, it’s more like :
<p><a rel="lightbox" href="/user/pages/02.guias/09.armazene-arquivos-forma-privada-nuvem/sync_main_page.PNG"><img alt="" src="/images/6/0/f/d/5/60fd5e256aac6b6721c2234e86e836f389e78c6a-syncmainpage.png" /></a></p>
So as you can see, you’re using relative paths in this second one.
My guess is that in the first case, you may have made a mistake in the markdown, by using an absolute link. Ex :
(my_resource)[http://my_site.com/pathto/my_resource]
)
And in the second case, you used the correct technic of Grav Streams. Ex :
(my_resource)[theme://images/my_resource]
But maybe I’m wrong.
It may be a CSS pointing failure. Also, if the first mistake I quoted is due to a template in wich you add some custom HTML with resource pointing, I suggest you to use the url()
technic to point to where you want. Ex :
<img src="{{ url('theme://images/my_resource.jpg') }}" alt="My resource" />
For <a>
links, you should compose your url like this :
<a href="{{ page.find('/desired-page/desired-subpage').url }}">...</a>
<a href="{{ base_url }}/desired-page/desired-subpage">...</a>
(this one must be verified. Here’s the online doc about it.
Thanks a lot @Romarain!
As a matter of fact, they were all using relative paths.
The second, solution
worked, though.
The thing is, the pages (both having and not having the issue) use the same template and everything in them is pretty much the same.
What further steps should I take in order to analyze what is causing this problem and be able to continue using markdown for images in all the pages?
Thank you once again.