I am using the gist shortcode in my canonical page, but this correctly generates the “User-authored JavaScript found on page” error for the AMP equivalent of my page. Meanwhile, there is an AMP tag for gists.
I suppose I need a way for a page to “know” it’s an AMP or canonical page and that it has a gist in it and then to import the appropriate JavaScript (to import JS you don’t use generates a warning in AMP) and more importantly to choose the appropriate gist rendering mechanism–the shortcode or the AMP tag.
Whether with this specific example or others that come to mind, what would you suggest would be the “best practices” for writing layouts that can handle these possibilities?
Not that I really understand what this Gist shortcode does, I wanted to chime in and say that in Hugo, shortcodes are “output format” aware, so you can have in layouts/shortcodes:
gist.html
gist.amp.html
And you will get the appropriate shortcode for the output format in question.