Getting broken image in page.js react #4992
-
|
I am trying to insert an image on the website page, but the link is broken and I am not able to identify where I am going wrong. the page is this: https://labriunesp.org/pod-ri the code is this: pod-ri.js any indication of where I'm going wrong? tried |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
|
So, in the end your image is hosted at: https://labriunesp.org/img/projetos/extensao/pod-ri/logo-site.png Your code says:
In the end you end up with a bad path in the DOM Indeed this does not work: https://labriunesp.org//./img/projetos/extensao/pod-ri/logo-site.png But this works: https://labriunesp.org/./img/projetos/extensao/pod-ri/logo-site.png So, just remove the useBaseUrl call to avoid adding unnecessarily the prefix.
You can also move the image in In general, I'd recommend to use imports for various reasons (asset will be processed by webpack, a hash will be added to the name for better CDN caching, and if your import works you'll be sure to not have a broken image in your prod deploy). If you want to keep your image in |
Beta Was this translation helpful? Give feedback.
-
|
hi @slorber, I understood how to deal with images that are in static/img folder, but I'm not getting the same result with images placed in folders outside for example, on the page the first image comes from Could you tell me what I'm doing wrong? best documentation consulted: https://docusaurus.io/docs/static-assets |
Beta Was this translation helpful? Give feedback.

So, in the end your image is hosted at: https://labriunesp.org/img/projetos/extensao/pod-ri/logo-site.png
Your code says:
imageUrl: './img/projetos/extensao/pod-ri/logo-site.png',useBaseUrlwhich does not really make sense for relative paths (we never want to add baseurl because they are relative anyway... it only make sense to eventually add the baseurl "/" prefix to absolute paths starting with /In the end you end up with a bad path in the DOM
Indeed this does not work: https://labriunesp.org//./img/projetos/extensao/pod-ri/logo-site.png
But this works: https://labriunesp.org/./img/projetos/extensao/pod-ri/logo-site.png
So, just remove the useBaseUrl call to avoid adding un…