Using shortcodes in partials

Dear all,

I’ve intended to use the wonderful shortcode by @martignoni to cloak e-mail addresses and contact information. While this works like a charm in Markdown I was wondering how shortcodes can be used in HTML partials? The reason for doing so would be to cloak e-mail addresses in, e.g. a footer where the footer is specified in its own partial.

What would be the suggested way to accomplish this in Hugo?

Thanks in advance for your thoughts and recommendations.

In addition, I’ve investigated in this forum and found 2 threads asking similar questions on how one could use a shortcode within HTML partials (How-to use shortcodes in partials?, Using shortcodes in html content - #5 by bep). Unfortunately though, I wasn’t able to resolve my challenge with the information I could find there.

Do you have any advice on how I can employ a shortcode within HTML?

Thank you so much

2 Likes

You cannot.

Create a partial that uses the same logic as the shortcode.
Then call the new partial from anywhere.

2 Likes