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 Links in Post templates

  • #4639
    Avatar photo[anonymous]

    Hello everyone,

    I’m enjoying using Publii, however I have a bit of an issue when trying to use post templates. When I have a link in the normal editor like:

    
    
    

    It works as intended. However, if I put the same code in a post template, the link doesn’t work anymore. It’ll just add #INTERNAL_LINK#/post/16 to the url of the page you are on. How can I fix this?

    Thanks everyone for the help!

    #4640
    Avatar photoBob

    Where exactly do you paste the link – to the post-template.hbs file?

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

    Where exactly do you paste the link – to the post-template.hbs file?

    A post template that I made myself called post-TEMPLATE_1_1 and added to config.json. It all works too, just the link in the post template doesn’t.

    #4642
    Avatar photoBob

    please be precise: do you paste this link to post-TEMPLATE_1_1 or to a post with an assigned post template?

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

    please be precise: do you paste this link to post-TEMPLATE_1_1 or to a post with an assigned post template?

    Inside the post template itself, not in a post where the post template is assigned to. (Links in a post with this post template do still work as intended). Thanks for the replies so far by the way!

    #4644
    Avatar photoBob

    This way it won’t work, when you use an internal link into post content, Publii parses it to the requested link.
    If you want to use a link into .hbs file you should use, for example,

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

    This way it won’t work, when you use an internal link into post content, Publii parses it to the requested link.

    If you want to use a link into .hbs file you should use, for example,

    Thank you, i’ll look into these!

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

    This way it won’t work, when you use an internal link into post content, Publii parses it to the requested link.

    If you want to use a link into .hbs file you should use, for example,

    I changed it into the following and it seems to work, just want to make sure i didn’t do anything wonky with this: