# Unable to retrieve collection front matter values correctly

**URL:** <https://talk.jekyllrb.com/t/unable-to-retrieve-collection-front-matter-values-correctly/7823>\
**Category:** Help\
**Created:** [November 19, 2022, 7:49am UTC](https://talk.jekyllrb.com/t/unable-to-retrieve-collection-front-matter-values-correctly/7823 "2022-11-19T07:49:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lizhaozhi](https://avatars.discourse-cdn.com/v4/letter/l/bbe5ce/32.png) [@lizhaozhi](https://talk.jekyllrb.com/u/lizhaozhi)\
**Post date:** [November 19, 2022, 7:49am UTC](https://talk.jekyllrb.com/t/unable-to-retrieve-collection-front-matter-values-correctly/7823/1 "2022-11-19T07:49:12Z")

</div>

Update 1:

The issue remains unresolved, but I think Jekyll is rendering another page which has identical conetent as the publications page. The other page is press releases. It’s odd that it appears to me Jekyll is not rendering publications entirely but it has elements such as tags which only exist in the press releases page.

* * *

I’m encountering an issue with regard to the retrieval of front matter values in collection items.

I created a collection called `publications`. I wish to use it to store information about some PDFs I created. The configuration of `publications` is straightforward as below

```auto
collections:
   publications:

```

The file structure is as follows:

```auto
_publications
  item1.md
  item2.md

```

Inside item1, item2, … itemN, I have the following front matter data:

```auto
---
title: "Report 1"
name: "Report1.pdf"
---

```

I created a page to list the data from these items:

```auto
---
layout: page
---
{% for item in site.publications %}
  <a href="/{{ item.name }}">
    <h1>{{ item.title }}</h1>
  </a>
{% endfor %}

```

With this setting, I have no trouble getting the file titles. However, the links are WRONG. For instance, clicking on Report 1 should open `/Report1.pdf`; instead, I was directed to `/publications/item1.html`.

Could someone from the community help me to diagnose what is the cause of this error and how do I fix it?

---

<div class="post-metadata">

**Author:** ![chuckhoupt](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/chuckhoupt/32/523_2.png) [@chuckhoupt](https://talk.jekyllrb.com/u/chuckhoupt)\
**Post date:** [November 19, 2022, 1:38pm UTC](https://talk.jekyllrb.com/t/unable-to-retrieve-collection-front-matter-values-correctly/7823/2 "2022-11-19T13:38:03Z")

</div>

The variable “`name`” is [automatically set for each page by Jekyll](https://jekyllrb.com/docs/variables/#page-variables), so you can’t override it. You should be able to use a custom variable like `filename`, `pdfname`, etc.

---

<div class="post-metadata">

**Author:** ![lizhaozhi](https://avatars.discourse-cdn.com/v4/letter/l/bbe5ce/32.png) [@lizhaozhi](https://talk.jekyllrb.com/u/lizhaozhi)\
**Post date:** [November 19, 2022, 2:02pm UTC](https://talk.jekyllrb.com/t/unable-to-retrieve-collection-front-matter-values-correctly/7823/3 "2022-11-19T14:02:10Z")

</div>

Thanks for the response @chuckhoupt. I’ve tried `filename` but that didn’t work either.

在 2022-11-19 21:48:05，“Chuck Houpt via Jekyll Talk” [notifications@jekyllrb.discoursemail.com](mailto:notifications@jekyllrb.discoursemail.com) 写道：

---

<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:** [November 19, 2022, 5:00pm UTC](https://talk.jekyllrb.com/t/unable-to-retrieve-collection-front-matter-values-correctly/7823/4 "2022-11-19T17:00:35Z")

</div>

can you share a link to your repo?

what do you see if you look at the \_site folder? is there a publications folder?

I’d get rid of the url and just output plain text so it is easier to see what it is doing. Maybe add the path to the loop to see what it is.
