Is it possible in a shortcode to compare if a data file is the same as a frontmatter variable and then range the data of each respective file based on this parameter? For example, file name is t2_01, t1_02, etc. with frontmatter variables of code: t2_01 etc. Currently, I can slice through the frontmatter variables and assign the layouts manually, but I dread how long this part will become if I add hundreds of files.
{{ with index site.Data.country.capital site.Language.Lang }}
<table>
<thead>
<tr>
</tr>
</thead>
<tbody>
{{ $file := slice }}
{{ if eq $.Page.Params.code "t2_01"}}
{{ $file = .t2_01 }}
{{ end }}
{{- range $file }}
<tr>
<td>{{ .Country }}</td>
<td>{{ .Target }}</td>
<td>{{ .Actual }}</td>
<td>{{ .Percent }}</td>
</tr>
{{- end }}
</tbody>
</table>
{{- end }}
At the same time, I am assigning a frontmatter variable per multipage that corresponds to the data file name (I am yet unsure if to do something like t2_01: true or code: t2_01 ).
In my table shortcode (see first post), I want to use one shortcode for all the tables since they share the same table head (translated with i18n) . My question is, therefore, if it is possible to match the file name and its corresponding front matter variable so that only the correct data is shown in each respective multi page, depending on the frontmatter variable, for both the original and translated pages?
Since I am translating the data, my wish is for the shortcode for the table I shared in the first to be in every page, but the data to be shown per page be only that which corresponds to the filtered condition.
I aim to have hundreds of data files, so I wanted to use only one shortcode that covers everything, rather than hundreds of different ones.
Please let me know if you need further clarification.