Hi, I have just finished moving my website from Wordpress to Hugo and hit an small issue that I cannot work out. I would like to control the formatting of internal links using a shortcode inside another shortcode, this is my code:
{{% half_text %}}
Starting with a barrel half
Make up a wooden frame to fit the outside of the half barrel and screw together at the corners. This stage is similar to my
{{< text_link “Recycled Barrel Planter” “recycling-plastic-barrel-as-a-planter” “My recycled barrel planter build” >}}
Screw the barrel to the frame around the inside as shown.
{{% /half_text %}}
Using this the link text is converted to markdown. If I change the outer %% to <> the link renders correctly but I lose the markdown formatting for the rest of the text.
If I then add {{ .Inside | markdownify }} to the half_text shortcode the link text is changed back to markdown.
I have searched docs, topics and google but cannot find a solution, any pointers would be really appreciated
Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.
If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.
Use a markdown render hook instead of a shortcode for your link. This allows you to use the standard markdown syntax for links: [Link Text](Destination "Title").
markdown (do not use {{% %}} notation)
{{< half_text >}}
Some **bold** and *emphasized* markdown.
[Recycled Barrel Planter](recycling-plastic-barrel-as-a-planter "My recycled barrel planter build")
{{< /half_text >}}
layouts/shortcodes/half_text.html (use .Page.RenderString instead of markdownify)