Shortcode for accessing site data

In data/icons.yaml I have the following:

info:                <i class="fas fa-book"></i>
assignment:          <i class="fas fa-check"></i>
optional-assignment: <i class="fas fa-flask"></i>

I use the following shortcode to select one of the icons:

{{ safeHTML (index .Site.Data.icons (.Get 0))}}

From my markdown content I can now include on of the icons as follows.

The is the information icon: {{% icon info %}}

Is there a way similar ot the param shortcode to access site data from markdown or do I need to create my own shortcode?

Is there a way to write a generic shortcode to access arbitrary site data?

Hi,

I’m not sure what you are asking here. What kind of input do you expect + what kind of output?

Your example shortcode here seems to do that: access site data [1] from markdown [2].