How can I reuse a shortcode in Hugo within another shortcode?
I only found a way to nest shortcodes within markdown but what I want to do is to reuse a shortcode within the definition of another shortcode.
No not in the definition, but you can use nested Shortcodes.
The nested approach is the official one (as discussed here):
Nested Shortcodes
You can call shortcodes within other shortcodes by creating your own templates that leverage the
.Parent
variable..Parent
allows you to check the context in which the shortcode is being called.
See Shortcode templates.
See an illustration here: this is a workaround, and not one shortcode using another.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With