Archived topic
Link to media file
8 replies · Started by Bernhard on August 6, 2022
Hello,
is there a simple way to set the link to media file in the new image block?
It's because I start to substitute the WP image block with the GP image block and all other settings like padding, image size on different devices etc I can simply copy and paste but I do not find how to set the link to media file, beside inserting the image URL one by one.
Hi there,
select the GB Image Block, enable the Dynamic Data options, and set:
Data source: Current Post ( default value)
Image source: do not select anything
Link source: Single Image
Hi David,
this works so far, thank you :).
There is a little problem: when "dynamic data" is switched on, in the image block settings section the fields alt text and title attribute disappear. Looking into the code editor, the tags are there.
Hi Bernhard,
Yes, they disappear by default if dynamic data is enabled. The alt text is dynamically taken from the image meta.
Hi Fernando,
I made now a test and I see the title tag in the editor, but when the post is published it shows "post name image number".
In the first grid are 3 dynamically addressed posts, in the second grid a query.
https://imgur.com/a/3FlukBA
If you check the Image in the Media Library - does it contain any values for the alt and title there ?
Hi David,
yes, you can see in the screenshot made with the Gutenberg editor, when hovering over the images the title tags pop up.
I checked with the developer tools and the alt tag is there but the title tag is missing. Maybe that's the way it's meant to be. I disabled now in Rankmath the option to substitute missing title tags and it's ok for me now. Nothing pops up on hover over the image.
Thank you for your help :)
Thanks for letting us know.
I'll take a look into the missing Title Tag, and whether its something we should add a filter for.
Glad to hear its working as you require it!!