WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.52k stars 4.21k forks source link

Post Featured Image: Add Link Settings #46762

Open kavyagokul opened 1 year ago

kavyagokul commented 1 year ago

What problem does this address?

Right now, the block only offers the option to hyperlink the image with the post's link. It would be nice to have other media link options, such as the ones offered by the Image block: media file and attachment page.

What is your proposed solution?

It would be nice to have the option to let the visitor click on the featured image to open the actual image on a new tab, so it can be downloadable for example. The Cover block is another option to show the post's featured image, but it also doesn't offer a way to hyperlink the image.

npneeraj commented 1 year ago

@kavyagokul please assign me this feature. I will work on its source code to include this feature as required. Please share some helpful resources and the code file( html files, if any).

porg commented 1 year ago

One more reason why this feature is important

Site-wide Lightbox plugins usually consider those images as a candidate to be shown in the lightbox which link to their underlying media file or their media attachment page.

Site-wide LightBox plugins & By which criteria they pick up images

https://wordpress.org/plugins/tags/lightbox/ yields the following plugins:


Easy Fancybox (300k installations)

[…] gives you a flexible and aesthetic light box solution for just about all media links on your website […] After activation, all links to JPG, GIF and PNG images are automatically opened in the FancyBox […]

👉 Mechanism: Linked image gets picked up.


Simple Lightbox (100k installations)

Automatically activate links (no manual coding required) […] Supports WordPress image attachment links […]

👉 Mechanism(s): Link to media file, link to media page (aka “image attachment link”)


FooBox Responsive Media Lightboxes (100k installations)

Within Gutenberg, FooBox lightbox will automatically add a modal popup to images and galleries that have the “Link To” setting set to “Media File”. […] FooBox will automatically add modals to WordPress galleries, WordPress images with captions, and attachment images. […]

👉 Mechanism(s): Link to media file, attachment images (very old WordPress mechanism)


Lightbox with PhotoSwipe (20k installations)

All linked images in a post or page will be displayed using PhotoSwipe, regardless if they are part of a gallery or single images. Just make sure that you link the image or gallery directly to the media and not the attachment page (in galleries the option link=file should be set).

👉 Mechanism(s): Link to media file

porg commented 1 year ago

Should not be too much effort