# How to get current file name in Hugo without .md

> Learn how to get the current file name in Hugo without the .md extension using a short template snippet that trims it from .File.LogicalName.

Author: [Flavio Copes](https://flaviocopes.com/about/) | Published: 2022-07-17 | Topics: [Hugo](https://flaviocopes.com/tags/hugo/) | Canonical: https://flaviocopes.com/hugo-get-current-file-name/

This is the template snippet that does the job:

```
{{ trim .File.LogicalName ".md" }}
```
