Hi,
I was wondering if there is a way to get the filename of a data file.
I have this structure:
- root
- data
- folder
- file1.toml
- file2.toml
- file3.toml
- etc
in my code i wanted to range the filename of the toml files like this:
{{ range $i, $e := .Site.Data.folder }}
{{ .File.LogicalName }}
{{ end }}
but it doesn’t work.
it prints the filename (instead of the index number) if I write it like this:
{{ range $i, $e := .Site.Data.folder }}
{{ $i }}
{{ end }}
and that’s pretty confusing.
don’t know if it’s a bug, because if I use the $i
version in other pages it prints the number and not the filename.
can someone help me please?
thank you!
yeshe