Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Support shortcode per output format #3220
#2828 handles the technical grits of handling multiple output formats in Hugo.
But it deliberately ignores a problem that is especially relevant in the AMP world: Special
So, while I believe we must accept that, in short term, Blackfriday and friends are good old HTML renderers, Hugo will have to do better in this area.
And then there are two options:
The first one may be both fast and possible, but it would be hard to maintain for other than simple AMP image replacements.
So, it is shortcodes.
Of course, in Hugo we render the content once and reuses that for the different output formats. We want to keep on doing that because it is ... fast ...
But, luckily, the way shortcodes are architected, it is possible to do a reprocessing of the shortcodes only, and only a subset of them if needed.
So, my suggestion is that we come up with a way to have multiple versions of the same shortcode. The first that comes to mind:
The idea that we do re-expansion/evaluation of the shortcodes only for the pages and the shortcodes that have alternative representations, which should not hurt the performance in the normal use cases.
The naming convention above isn't really that important, but as this is by no means a trivial change, we REALLY need to think that this is a GREAT IDEA.