Problem with <ref> in shortcode


I created a pretty simple shortcode:

[A B C (ABC)]({{ ref "/pages/abc/" }})

Then I use the shortcode:

... The current {{<ref_pg_abc>}} user ...

I get the error:

".../content/page/pg1/": failed to render shortcode "ref_pg_abc": failed to process shortcode: "...themes/mytheme/layouts/shortcodes/ref_pg_abc.html:1:46": execute of template failed: template: shortcodes/ref_pg_abc.html:1:46: executing "shortcodes/ref_pg_abc.html" at <ref>: wrong number of args for ref: want 2 got 1

I’ve tried both {{< and {{% with no success.

Any ideas?



Hi @BigBadBaz. We cannot help you with only this info. You’ll need to share your repo, or create a minimal reproducible example and share that.

Without the < or %, you’re calling a function, not a shortcode. The function “ref” is used in the shortcode “ref”, but they are not the same thing. Try including the < or % in the source of the shortcode. If that doesn’t help, drop the < or % and read the rest of my post.

According to the documentation at, the function needs a Context. That’s the argument you’re missing

You need to work out the context that works here, I have to admit I’m not quite familiar with using that in practice. The dot should work though, try that first.

1 Like

Thank you! That was enough of a hint to get me going. For others following along:

I changed my shortcode themes/mytheme/layout/shortcodes/ref_pg_abc.html from:

[A B C (ABC)]({{ ref "/pages/abc/" }})


[A B C (ABC)]({{ ref . "/pages/abc/" }})

Which solved the ref issue, but displayed text as opposed to rendering the markdown. So I changed the markdown file content/page/pg1/ from:

... The current {{<ref_pg_abc>}} user ...


... The current {{%ref_pg_abc%}} user ...