Download
We're evolving to serve you better! This current forum has transitioned to read-only mode. For new discussions, support, and engagement, we've moved to GitHub Discussions.

Link in caption

  • #6741
    Avatar photo[anonymous]

    Hello,

    Is it possible to insert a link in the caption of a photo?

    Thanks in advance.

    #6743
    Avatar photoBob

    Yeap, you can do that, just put the link in the caption, and modify the theme files ‎⁨(Documents ▸ ⁨Publii⁩ ▸ ⁨sites⁩ ▸ ⁨YOUR_SITE ▸ ⁨input⁩ ▸ ⁨themes⁩ ▸ ⁨YOUR_THEME) as follow:

    {{caption}} or {{credits}}

    to

    {{{caption}}} or {{{credits}}}

    To preserve your custom code and prevent it being overwritten the next time the theme is updated, please ensure that you have created override files; these are, essentially, copies of the existing theme files that are stored separately from the main theme fileshttps://getpublii.com/dev/theme-overrides/

    #6746
    Avatar photo[anonymous]

    Hello,
    Thank you.

    I very sorry, but I don’t know in which file to make this replacement… I searched for that string but did not find an exact match.

    #6751
    Avatar photo[anonymous]
    [anonymous] wrote:

    Hello,

    Thank you.

    I very sorry, but I don’t know in which file to make this replacement… I searched for that string but did not find an exact match.

    @clac1 You should be able to edit

    {{caption}}
    {{credits}}

    in the “index.hbs” and “post.hbs” files. If your theme has other templates, you’ll find that code there too. Not sure if the “amp-” files have to be edited as well, but I would just in case.

    #6798
    Avatar photo[anonymous]

    Hello,

    I looked in the “index.hbs” and “post.hbs” files, there is no

    {{caption}} or {{credits}}

    I found only

    {{caption}}
    {{credits}}

    Is it the statements to modify ?

    Another question : to insert the link in caption, should I go in the html code or is there any way via the User Interface ?

    Thanks for your help!

    #6799
    Avatar photo[anonymous]

    Yes, that’s the statement to modify, as outlined in my reply.

    To insert the hyperlink, highlight the text of the caption in the Post Editor and hit CTRL+K.

    #6800
    Avatar photo[anonymous]

    Thank you!

    I tried it and it is OK for single image, but it seems to be not possible to add a ling in captions for images in a gallery… ?

    #6804
    Avatar photo[anonymous]
    [anonymous] wrote:

    Thank you!

    I tried it and it is OK for single image, but it seems to be not possible to add a ling in captions for images in a gallery… ?

    I just tested it on my end: click on the gallery, and add the following HTML code in the respective “Image caption” field of the “Insert/Edit Gallery” dialog box:

    caption text

    Of course, replace ” https://website.com ” with the link and “caption text” with your caption.

    #6805
    Avatar photo[anonymous]

    I’m not sure why the comment engine added “nofollow”, but you can ignore that. Just add an < a > tag.

    #6806
    Avatar photo[anonymous]

    Hello,

    Yes, it works!

    Thanks a lot.