CMS Drupal Mastering Development

image not showing on some pages with same src

I have a custom block where I have displayed an image. it’s working nicely on all pages except login and registration page. On the login page when I inspect element and add “/” in scr before the image path, the image becomes visible.

on the other pages, the image has no issue with the bellow code.

<img src="sites/default/files/media/marketplace-logo.png?fid=511">

but on the login page, it’s not displaying with the above src. and need a / before the path.

<img src="/sites/default/files/media/marketplace-logo.png?fid=511">

Why it’s working on some pages and why are not working on login page with a / in the path.

Leave an answer

Your email address will not be published. Required fields are marked *