Hi all, I’m creating a shortcode trying to get the variable value whose name is defined in the shortcode parameter. Take a example:
/config.toml:
...
[params.store]
apple = "http://www.apple.com/"
pineapple = "http://www.pineapple.com/"
...
The shortcode I want would translate the anchor into the corresponding target link, like:
/content/sample.md:
{{< store apple >}}
{{< store pineapple >}}
replaced by:
<a href="http://www.apple.com/">Go to store now</a>
<a href="http://www.pineapple.com/">Go to store now</a>
I don’t want use if
statement to determine parameter names then get the corresponding target store link. I’d like to get value directly by parameter like:
/layout/shortcodes/store.html:
<a href="{{ .Site.Params.store.PARAMETER0 }}">Go to store now</a>
Is there any way to accomplish this? Thanks for any tips.