hey gang!
Trying to wrap my head around the changes in 0.146.x
I use a spinoff of jpanther’s awesome congo theme.
One of the things he does in this theme is to overload the figure shortcode with some custom logic, conditionally, falling back to the inbuilt shortcode via {{ template "_internal/shortcodes/figure.html" . }}
which obviously isn’t the thing to do anymore.
However, I’m a little confused as to the proper way forward here.
A downstream fork of congo; blowfish, has an open PR to address the problems experienced post 0.146.x. However I’m not convinced the logic there actually works for the shortcode’s fallthrough case..
(I suspect the site demo doesn’t exercise the fallback path and so it’s a bug in hiding)
… not because I eyeballed it and thought
That doesn’t look right…
…but because it doesn’t work for me
Error: error building site: render: failed to render pages: render of "wplsc/content/snippits/wplshortcodes/shortcodes/spoiler.md" failed: "wplsc/layouts/_default/single.html:131:11": execute of template failed:
template: single.html:131:11: executing "main" at <.Content>: error calling Content:
failed to render shortcode: "wplsc/content/snippits/wplshortcodes/shortcodes/spoiler.md:117:1":
failed to render shortcode "columns": "wplsc/content/snippits/wplshortcodes/shortcodes/spoiler.md:1:1":
failed to render shortcode "spoiler": "wplsc/content/snippits/wplshortcodes/shortcodes/spoiler.md:1:1":
failed to render shortcode "figure": failed to process shortcode: "wplsc/themes/congo/layouts/shortcodes/figure.html:2:5":
execute of template failed: template: _shortcodes/figure.html:2:5: executing "_shortcodes/figure.html" at <partial "shortcodes/figure.html" .>:
error calling partial: partial "shortcodes/figure.html" not found
(( BTW: I like the much more explicit failure pathing… nicely done. Much more grokable as to what’s breaking where ))
I’ve seen a few bits of guidance on this, and from what I’ve gathered the “right” way forward is, essentially:
DON’T DO THAT ANYMORE
Instead, if you wish to conditionally utilize them, Create a wrapper which encapsulates your conditional logic and them optionally invoke the internal shortcode
IE:
“mytheme/layouts/shortcodes/figure-wrapper.html
”
vs
“mytheme/layouts/shortcodes/figure.html
”
so my read on this is that overloading the embedded shortcodes is now (officially) an antipattern to be avoided.
Is that accurate? or have I misunderstood (also entirely possible, hence why I’m posting here)
Hope y’all are having a great day/night!
W