choox
September 28, 2026, 12:27pm
1
Hello,
I am trying a write a very simple shortcode, its core functionality looks like this:
<!-- layouts/_shortcodes/test.html -->
<div class="some-class">
{{ .Inner }}
</div>
Now I want to render a link inside the <div> such as
{{< test >}}
[Link A]({{% relref "/books/book-1" %}})
{{< /test >}}
It does not render the link for me, and only shows the code. I tried doing {{ .Inner | Page.RenderString }} and {{ .Inner | markdownify }} but the problem persists.
Instead of <a href="/en/books/book-1/">Link A</a> my rendered output remains [Link A]({{% relref "/books/book-1" %}}).
Thank you.
To quote the docs: .Inner
Returns the content between opening and closing shortcode tags
And that is exactly what’s happening here.
If you go there and read the next section of the documentation , you’ll find the answer to your question. Check your spelling carefully!
Though I wouldn’t guarantee that RenderString handles shortcodes. OTOH, relref is not really needed anymore with a Render Hook.
irkode
September 28, 2026, 2:46pm
3
as addition
that one should error out. looks like a typo or c’n paste error. recheck the linked example
and yes RenderString handles Shortcodes.
relref checks thet the page exists. the embedded render hook not