Unable to retrieve collection front matter values correctly

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


The file structure is as follows:


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

title: "Report 1"
name: "Report1.pdf"

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

layout: page
{% for item in site.publications %}
  <a href="/{{ item.name }}">
    <h1>{{ item.title }}</h1>
{% 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?

The variable “name” is automatically set for each page by Jekyll, so you can’t override it. You should be able to use a custom variable like filename, pdfname, etc.

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 写道:

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.