Struggling to find how to automatically insert links that are on images via the panel inside standard KirbyText.
Looked here: https://getkirby.com/docs/reference/text/kirbytags/image
And have searched the forum.
In the Panel, you can click on an image within a page entry, and edit attributes like captions, etc.
So, specifically, if I have entered a link for an image (inside the Panel), how do I make sure that it is inserted (next to the caption of the image, for example) when the
text field text is called into the page? Else why is there a Link field on images in the Panel?
(Assuming that I’m getting the Text field in the template via:
<?= $page->text()->kt() ?>)
if you use image kirbytag you have to put the link manually on the textarea:
(image: myawesomepicture.jpg link: http://flickr.com)
An alternative to the above would be to create a custom image KirbyTag by overriding the standard KirbyTag.
The link field in the
image.yml file is just an example. Contrary to the caption it is not used in the tag (might be a case for an issue in the ideas repo).
The link field is used in the
album.php template where the images are pulled in:
<a href="<?= $image->link()->or($image->url()) ?>">
<?= $image->crop(800, 1000) ?>
Okay, so as I’m understanding it, the Link field that I’m using, is only used by the
album.php template, which I’m not actually currently using.
I’ll just put links like this in a caption, instead.
That’s an option, but as I wrote above, you could override and extend the native image tag in a plugin.