How to get the filename of a page

Hi guys,

I’m trying to get the filename of a page. My best attempt so far is:

{% set page_filename = page.filePath()|slice(page.path()|length)|ltrim('/') %}

Do you know any other way to achieve this? AFAIK, there is not any inbuilt function, like, exposed trough the page object to do this.

Thank you very much for your time and congratulations for your remarkable work.

You can get the same with page.template, but without .md. E.g. on a page, it will return item


Perfect ! Thank you very much.