1

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.

1 Answer 1

3

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 and acknowledge you have read our privacy policy.

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