# Access Specific Data Using Front Matter

**URL:** <https://talk.jekyllrb.com/t/access-specific-data-using-front-matter/1046>\
**Category:** Help\
**Created:** [October 3, 2017, 5:53pm UTC](https://talk.jekyllrb.com/t/access-specific-data-using-front-matter/1046 "2017-10-03T17:53:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![frigidlight](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/frigidlight/32/503_2.png) [@frigidlight](https://talk.jekyllrb.com/u/frigidlight)\
**Post date:** [October 3, 2017, 5:53pm UTC](https://talk.jekyllrb.com/t/access-specific-data-using-front-matter/1046/1 "2017-10-03T17:53:56Z")

</div>

I’m trying to follow the example given on the Jekyll docs ([http://jekyllrb.com/docs/datafiles/#example-accessing-a-specific-author](http://jekyllrb.com/docs/datafiles/#example-accessing-a-specific-author)) to access specific values from a row of a CSV file based upon a value specified in the Front Matter. I can’t even get the example code from the docs to work.

CSV file cities.csv:

```auto
name,description
Dallas,Big City in Texas

```

index.html content:

```auto
---
city: Dallas
---

{% assign city = site.data.cities[page.city] %}
<a rel="author"
  href="https://twitter.com/{{ author.twitter }}"
  title="{{ city.name }}">
    {{ city.name }}
</a>

```

---

<div class="post-metadata">

**Author:** ![rdyar](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/rdyar/32/710_2.png) [@rdyar](https://talk.jekyllrb.com/u/rdyar)\
**Post date:** [October 3, 2017, 6:23pm UTC](https://talk.jekyllrb.com/t/access-specific-data-using-front-matter/1046/2 "2017-10-03T18:23:37Z")

</div>

do you get an error?

is author defined? if not `author.twitter` could be your problem.

---

<div class="post-metadata">

**Author:** ![mmistakes](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/mmistakes/32/2169_2.png) [@mmistakes](https://talk.jekyllrb.com/u/mmistakes)\
**Post date:** [October 3, 2017, 7:00pm UTC](https://talk.jekyllrb.com/t/access-specific-data-using-front-matter/1046/3 "2017-10-03T19:00:29Z")

</div>

Looks like `site.data.cities[page.city]` doesn’t contain any data, which is why you’re not getting anything to output.

Jekyll has a handy filter called `inspect` that you can throw onto the end of a variable to see what it contains.

```auto
{% assign city = site.data.cities[page.city] %}
{{ city | inspect }}

```

Which outputs `nil`.

To do what you want I believe you need to loop through the `site.data.cities` data file. Something like this works for me.

```auto
{% assign cities = site.data.cities %}

{% for city in cities %}

  {% if city.name == page.city %}
    <a rel="author"
      href="https://twitter.com/{{ author.twitter }}"
      title="{{ city.description }}">
        {{ city.name }}
    </a>
  {% endif %}

{% endfor %}

```
