How to print link text in twig? I've attached file to a node with Media module. I have custom templates/file/file-link.html.twig file, which is rendering the download link with {{ link }} tag.

{{ devel_dump(link) }} outputs this:



I need to print File name as pure text without any link rendering for some cases.

I've tried {{ link.text }}, {{ link.text.string }} and other options, but none of them gave me what I wanted.
Maybe this is a render array and you need to use link['#text'] here (sorry if I'm on the wrong track).

Edit: If {{ link.text }} worked on subsequent tries, then my answer is definitely wrong, and the reason for your problem was probably related to caching or something.