Lightbox with PhotoSwipe also supports links to external images,
Images using HTML code
The following image is a link to another website:
Also links without a visible image work:
Image using Gutenberg image blocks
This image is inserted as “Insert from URL” with a link to the media file: