Page.name returns empty

I have been spinning my wheels for a long time trying to finish my website/blog template. For some reason, whenever I try to access page.name, it does not return anything. Other page variables such as page.url work as expected. Simply inserting this in an md file returns empty:

{{ page.name }}

I have no plugins installed other than debug.rb. It may be that a template I am using is causing the problem, but I don’t see any code assigning to the “name” variable. How should I go about getting to the bottom of this issue?

You can see what attribute values are set for current page by using the inspect filter:

<pre>
{{ page | inspect }}
</pre>

Thank you, that was a helpful clue. In the whole object that is dumped, there is no property called “name”. This did help me notice the property called “slug”, which I could probably use for my purposes, but I would still like to understand how “name” could be missing.

Can’t say when there’s nothing to look at…
If the source was in a public repository somewhere like GitHub, one could clone it locally and dig deeper…

I’m also currently getting the same issue: page.name is blank and undefined. In my case, it appears to be populated correctly for most general pages, but not for pages inside a custom collection. (Jekyll 4.2.0)

I realized I can use page.slug instead, which is basically the same, just without the file extension, although it’s possible that slug may be different to name in some circumstances - I haven’t tested it thoroughly as yet.