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.

Adding HTML in Featured Image

  • #11528
    Avatar photo[anonymous]

    Hello,

    I’m just getting used to Publii and so far it’s everything that I wanted, congrats!

    I just wonder if there is any method so I can add HMTL to Credits field in post Featured Image -> (Theme Technews – free).

    The reason is simple, since I plan to use Unsplash I would really want to give a proper credit to the authors and Unsplash provide something like “Photo by Christian Lue on Unsplash

    Thank you!

    #11530
    Avatar photo[anonymous]

    Hello Bogdan,

    if you want a text field to render HTML, follow these steps:

    1. in theme folder create a “technews-override” folder (more on creating folder overrides in the documentation)
    2. in the folder create post.hbs file and paste all the code of the correspondent file in the input/themes/technews/post.hbs (or simply copy the file and paste it in the technews-override folder)
    3. find this code in the file:
      {{#checkIfAny caption credits}}
          <figcaption>
            {{caption}}
            {{credits}}
          </figcaption>                      
      {{/checkIfAny}}

      and add another couple of curly braces around credits: {{{credits}}}

    4. Now in the credits text field you write HTML and it will be rendered

    Made a short screencast: https://screenrec.com/share/pKGMurhOgZ

    Repeat the process for the template without sidebar, file name: post-alternative.hbs

    #11534
    Avatar photo[anonymous]

    Thank you! 🙂

    #11535
    Avatar photo[anonymous]

    You’re wellcome.

    I deleted the video, because I noticed that my mother-in-law was talking in the background! 😆

    #11538
    Avatar photo[anonymous]

    No problem, it was nice hearing her, she seems full of joy and happy 😀