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.


A simple method would be to trim the extension from the filename (see this fiddle):

{{ assetsField.filename|trim('.' ~ assetsField.extension, 'right') }}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.