# Range through one data file

**URL:** <https://discourse.gohugo.io/t/range-through-one-data-file/10551>\
**Category:** support\
**Created:** [February 15, 2018, 10:24am UTC](https://discourse.gohugo.io/t/range-through-one-data-file/10551 "2018-02-15T10:24:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![inwardmovement](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/inwardmovement/32/5396_2.png) [@inwardmovement](https://discourse.gohugo.io/u/inwardmovement)\
**Post date:** [February 15, 2018, 10:24am UTC](https://discourse.gohugo.io/t/range-through-one-data-file/10551/1 "2018-02-15T10:24:40Z")

</div>

Sorry to bother with this, the solution may be easy but I can’t find it.

I have this `data/apps.yml`

```
- name: app 1
  description: blablabla 1
  url: #1
  img: img1.png
- name: app 2
  description: blablabla 2
  url: #2
  img: img2.png
- name: app 3
  description: blablabla 3
  url: #3
  img: img3.png

```

and this

```
{{ range $.Site.Data.apps }}
  <div class="card">
    <img class="card-img-top" src="{{ .Site.BaseURL }}img/{{ .img }}" alt="Card image cap">
    <div class="card-body">
      <h4 class="card-title">{{ .name }}</h4>
      <p class="card-text">{{ .description }}</p>
      <a href="{{ .url }}" class="btn btn-primary">Visit</a>
    </div>
  </div>
{{ end }}

```

but the loop doesn’t output anything, and `{{ printf "%#v" $.Site.Data.apps }}` returns `<nil>`.  
Any idea why?

---

<div class="post-metadata">

**Author:** ![Mikhail](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/mikhail/32/1138_2.png) [@Mikhail](https://discourse.gohugo.io/u/Mikhail)\
**Post date:** [February 15, 2018, 10:31am UTC](https://discourse.gohugo.io/t/range-through-one-data-file/10551/2 "2018-02-15T10:31:09Z")

</div>

> [@Trying to parse data file, Hugo is silent](https://discourse.gohugo.io/t/trying-to-parse-data-file-hugo-is-silent/10089/):
>
> I’m trying to parse this data file, called projects.yml - name: My awesome project type: Corporate website work: Wordpress - Front and backend development. text: Yoga is fun! client: Lemon Co. Ltd url: "http://www.google.com" - name: My super duper project type: Corporate website work: Wordpress - Graphics, Front and backend development. text: I love cake. client: SomethingSomething url: "http://www.facebook.com" Inside a projects.html template, I run this loop: {{ range .…

---

<div class="post-metadata">

**Author:** ![inwardmovement](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/inwardmovement/32/5396_2.png) [@inwardmovement](https://discourse.gohugo.io/u/inwardmovement)\
**Post date:** [February 15, 2018, 10:44am UTC](https://discourse.gohugo.io/t/range-through-one-data-file/10551/3 "2018-02-15T10:44:56Z")

</div>

Grrr I already read 3-4 posts on the forum about it but not the one you linked… sorry and thank you, I managed to make it work 🙂

Had to add “`apps:`” as a first line of `apps.yml` and range with `range .Site.Data.apps.apps`.

---

<div class="post-metadata">

**Author:** ![kaushalmodi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kaushalmodi/32/2567_2.png) [@kaushalmodi](https://discourse.gohugo.io/u/kaushalmodi)\
**Post date:** [February 15, 2018, 12:18pm UTC](https://discourse.gohugo.io/t/range-through-one-data-file/10551/4 "2018-02-15T12:18:13Z")

</div>

> Had to add “apps:” as a first line of apps.yml and range with range .Site.Data.apps.

It would be then `range .Site.Data.apps.apps`, right?

---

<div class="post-metadata">

**Author:** ![inwardmovement](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/inwardmovement/32/5396_2.png) [@inwardmovement](https://discourse.gohugo.io/u/inwardmovement)\
**Post date:** [February 15, 2018, 12:41pm UTC](https://discourse.gohugo.io/t/range-through-one-data-file/10551/5 "2018-02-15T12:41:31Z")

</div>

Yes I edited my answer, thank you!

---

<div class="post-metadata">

**Author:** ![Leo\_Merkel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/leo_merkel/32/3321_2.png) [@Leo\_Merkel](https://discourse.gohugo.io/u/Leo_Merkel)\
**Post date:** [February 15, 2018, 8:11pm UTC](https://discourse.gohugo.io/t/range-through-one-data-file/10551/6 "2018-02-15T20:11:51Z")

</div>

If you do that with `data.toml` it should work as expected. With YAML you need a top identifier (e. g. `section` or `app` - doesn’t matter) to range through what’s underneath.
