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 e.g.page.fileName(), 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 item.md page, it will return item

@flaviocopes
page.template

Perfect ! Thank you very much.