How can I avoid code repetition between shortcodes and partials?

I have the very same working code in both directories. Obviously, this isn’t ideal …
Is there a way to come round this?

Stupid me, just include the partial in the shortcode!

1 Like

That’s how I do it :wink:

If I remember well, just pay attention about indentation in your partial.
Flatten the code helps avoiding rendering issues.

https://discourse.gohugo.io/t/0-60-0-goldmark-html-indentation-in-partial-shortcode-wrapped-in-pre-code/22019

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.