My blog project has two output formats for articles, html and text. I’ve therefore created two variants of a figure shortcode, figure.html and figure.text. My HTML site renders okay, using the html shortcode for pages and lists, but for my feeds, it sometimes renders figure in the feed using the figure.html and sometimes using figure.text. It’s pretty annoying when it uses figure.text.
This leads me to a few questions:
How does Hugo determine which shortcode template to use, html or text?
Is there a way I can force it to use one in one context, and another in another?
Failing that, do I just need to stick with html until there is more output format support for shortcodes?
If I renamed it, it would work, because the shortcode name would be different. But I made them this way because I’d like to have the shortcode emit HTML in HTML contexts and plain text in other contexts (though I know that shortcodes don’t really support that right now).
Still, I suppose that’s they way to deal with it until shorcodes support output formats.
It somehow hadn’t occurred to me to create a shortcode for the feed format. I guess because the plain text output format doesn’t use the figure.text variant, either. But I’ll give it a try and see what happens.
Long term would be nice to have some control over the format for a particular use of the content. The JSONFeed template, for example, emits both HTML and text. Would be nice if, in in entry.text, I could call .Content.Text or something to indicate which output format in a particular context.