Shortcode with dynamic data variable

#1

I have a shortcode which is iterating over some data. I want to make invocation of data dynamically.

index.md

path: “path_to_file” // for another aproach

`{{% shortcode-example path="path_to_file" %}}`

shortcode-example.html

{{ $path := .Get "path" }}
{{ $data := index .Site.Data }}
{{ range $data.[variable_data] }}

I guess that I can pass path to the data through params of shortcode and after .Get it. Or via .Params of .md file if possible, how can I solve it?

0 Likes