[SOLVED] Using single data file from multiple data files

I have two json files under data folder, i.e. data/education.json and data/experience.json. In template how would I get only one data file to use, the documentation says to use the filename without an extension like:

{{ range .Site.Data.education }}
       {{ .title }}
{{ end }}

but this doesn’t work but using

{{ range $.Site.Data }}
     {{ . }}
{{ end }}

prints out both the file together, another alternative is to create folders and move these into their respective ones, i.e. data/education/education.json and data/experience/experience.json.

Can it be done without creating an extra folder?


This section of the docs should help: https://gohugo.io/templates/data-templates/#example-accessing-named-values-in-a-data-file

I have tried that, but its not working

The example I linked to does not use range to access the data file, unlike the code you posted above. Did you try it the way it was described?

hmmm… for some reason it works if the file name is in title case as in Education.json