# How to Range List Data with (YAML)

**URL:** <https://discourse.gohugo.io/t/how-to-range-list-data-with-yaml/8335>\
**Category:** support\
**Created:** [September 12, 2017, 7:23am UTC](https://discourse.gohugo.io/t/how-to-range-list-data-with-yaml/8335 "2017-09-12T07:23:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![TIGA\_DUA](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/tiga_dua/32/4073_2.png) [@TIGA\_DUA](https://discourse.gohugo.io/u/TIGA_DUA)\
**Post date:** [September 12, 2017, 7:23am UTC](https://discourse.gohugo.io/t/how-to-range-list-data-with-yaml/8335/1 "2017-09-12T07:23:09Z")

</div>

Hi. all. can help me? 😀

How to implement List Data on GoHugo. with range? like

/data/features.yml

```
list:
  - title: features 1
    description: >
     Description 1
    icon: fa-comment
    
  - title: features 2
    description: >
     Description 2
    icon: fa-headphones
    
  - title: features 3
    description: >
     Description 3
    icon: fa-microphone
    
    
  - title: features 4
    description: >
      Description 4  
	icon: fa-comment-o
    
  - title: features 5
    description: >
     Description 5
    icon: fa-comment-o
    
  - title: features 6
    description: >
     Description 6
    icon: fa-comment-o

```

/themes/layouts/partial/features.html

```
    {{ range $.Site.Data.features.list }}

    <h3>{{ .Site.Data.features.list.title }}</h3>

    <span>{{ .Site.Data.features.list.icon }}</span>

    <p>{{ .Site.Data.features.list.title }}</p>

    {{end}}

```

/themes/layouts/index.html

`{{ partial "features" . }}`

thank you very much, for the hugo community. to my previous question and very helpful to me 🍻

---

<div class="post-metadata">

**Author:** ![digitalcraftsman](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/digitalcraftsman/32/4142_2.png) [@digitalcraftsman](https://discourse.gohugo.io/u/digitalcraftsman)\
**Post date:** [September 12, 2017, 7:35am UTC](https://discourse.gohugo.io/t/how-to-range-list-data-with-yaml/8335/2 "2017-09-12T07:35:50Z")

</div>

Hello @TIGA_DUA

the problem is how you access the attributes of each list item. When ranging over a list the context a.k.a. the `.` changes inside the loop.

With each iteration the current list item will be assigned to the `.` meaning that you can access the attribute of each list item like this:

```
<h3>{{ .title }}</h3>
```

---

<div class="post-metadata">

**Author:** ![TIGA\_DUA](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/tiga_dua/32/4073_2.png) [@TIGA\_DUA](https://discourse.gohugo.io/u/TIGA_DUA)\
**Post date:** [September 12, 2017, 8:09am UTC](https://discourse.gohugo.io/t/how-to-range-list-data-with-yaml/8335/3 "2017-09-12T08:09:28Z")

</div>

Hai, thanks @digitalcraftsman

Its Working but. has the following issues.

**[map[title:** Features 1 **icon:** fa-comment **description:** description 1. **]**

And another list…

---

<div class="post-metadata">

**Author:** ![digitalcraftsman](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/digitalcraftsman/32/4142_2.png) [@digitalcraftsman](https://discourse.gohugo.io/u/digitalcraftsman)\
**Post date:** [September 12, 2017, 8:12am UTC](https://discourse.gohugo.io/t/how-to-range-list-data-with-yaml/8335/4 "2017-09-12T08:12:59Z")

</div>

Is the map separate from the list in your first comment?  
`range` [works the same](https://gohugo.io/templates/introduction/#logic) for maps and arrays.

---

<div class="post-metadata">

**Author:** ![TIGA\_DUA](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/tiga_dua/32/4073_2.png) [@TIGA\_DUA](https://discourse.gohugo.io/u/TIGA_DUA)\
**Post date:** [September 12, 2017, 8:29am UTC](https://discourse.gohugo.io/t/how-to-range-list-data-with-yaml/8335/5 "2017-09-12T08:29:40Z")

</div>

Hai. @digitalcraftsman

already working, thank you for your time. it turns out there is an equation, with **features \> folders** and **features \> files**

🍻
