Is it possible to use shortcodes in layouts?
In my layouts I want to use a shortcode like {{< flag >}}
but it gives me the following error:
unexpected "<" in command
My setup is that I’m generating a lot of pages which are quite “dumb”.
Here is an example:
---
title: Alfa Romeo
engine_manufacturer_id: alfa-romeo
---
The layout I’m to render these pages contain the smart stuff, by actually building the page.
First retrieving the actual data from a generated json file.
The engine manufacturer json file contains something like "country": "italy"
.
Now in another data json I can resolve italy
to the alpha2 code IT
.
So my idea was to write a shortcode where I pass the country id (italy
), resolve from the country id the alpha2 code and print something like <span class="flag-icon flag-icon-it"></span>
.
And then call the shortcode like {{< flag $engine_manufacturer.country_id >}}
But this does not seem to be an option. Any alternative to do this?