Data files with numbers as filename

I get the following error if I access a data file called “1945” like this

<p>{{ .Site.Data.1945.events | markdownify }}</p>

unexpected ".1945" in operand

When I rename the file to something like “y1945” everything works as expected.

Is it not possible to access data files with numbers as filenames?

Try:

{{ $year := (index .Site.Data "1934") }}
{{ $year.events | markdownify }}
1 Like