Answers.Body: <p>A simple method would be to <a href="https://twig.symfony.com/doc/2.x/filters/trim.html" rel="nofollow noreferrer">trim</a> the extension from the filename (see <a href="https://twigfiddle.com/ul81i9" rel="nofollow noreferrer">this fiddle</a>):</p>
  
  <pre><code>{{ assetsField.filename|trim('.' ~ assetsField.extension, 'right') }}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-21T21:55:16.370Z
Answers.LastActivityDate: 2019-07-21T21:55:16.370Z
Answers.UserDisplayName: Cue
Body: <p>How do I get an asset's filename without the extension? So if my filename is <code>my_cool_photo.jpg</code> I want to return <code>my_cool_photo</code>. Using <code>{{ entry.assetsField.one.filename }}</code> returns the name of the file with the extension included.</p>
  
Tags: <templating><assets>
Title: Get an Asset's Filename Without the Extension
ThreadText: # Get an Asset's Filename Without the Extension
  
  (Asked by: username_0 on 2019-07-19)
  
  How do I get an asset's filename without the extension? So if my filename is `my_cool_photo.jpg` I want to return `my_cool_photo`. Using `{{ entry.assetsField.one.filename }}` returns the name of the file with the extension included.
  
  **Tags:** templating, assets
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-07-21. Score: 3 | Accepted answer
  
  A simple method would be to [trim](https://twig.symfony.com/doc/2.x/filters/trim.html) the extension from the filename (see [this fiddle](https://twigfiddle.com/ul81i9)):
  
  ```
  {{ assetsField.filename|trim('.' ~ assetsField.extension, 'right') }}
  
  ```
  
  
  ---
  
  