Unable to read data files in template

Hi Everyone.

I have been trying to read a simple data file and it I am not sure what I am missing

the data file is named africa.yml and it contains data like this

country:
    - name: Algeria
    - name: Angola
    - name: Cameroon
    - name: Comoros

I tried to read that in a index.html template by doing this

<ul>
{{ range $.Site.Data.africa.country }}
<li>
	<input class="material-icons" type="checkbox" />
	<label>{{ .name }}</label>
	</input>
</li>
{{ end }}
</ul>

But it never showed up, no matter what I tried. I tried renaming it to a .yaml instead of .yml etc. I am simply clueless, please help.

I am sorry to have posted an incorrect title first. Now I have corrected the same

I have added the content to a repo in bitbucket
git clone https://yesiknowjava@bitbucket.org/yesiknow/thinkahead_bitbucket.git

Also I created a new hugo project and that reads the data files just fine. Something seems to block this project for some reason.

I fixed the issue. I had another yaml file in the folder which had incorrect syntax.
So once I fixed the other yaml file, this started working

It would be helpful if hugo could tell where the issue is …instead of silently working.
I will try to add this as a feature request.

Are you running hugo server with the --verbose switch? That sometimes gives better hints…

Hi Rick,

Sorry for the late reply.

When it errors it can show more details. In my case there were no errors. It silently fails in the sense the data did not show up.

Having a valid yaml / json / toml is the developers duty. But not having one, he should be shown an indication of the corrupt data files. Not showing any errors is not helping.

Any chance this feature can get added to hugo : Erroring out on incorrect data files

Thanks for your time.

I can’t answer whether the devs will add it, but, it is not bad to have better errors so maybe make a github issue.