- 🇳🇱Netherlands tinto Amsterdam
Thanks for creating this issue and providing a patch, @landsman.
The patch provided in #3 may well solve the requirement in your particular case, but I don't think it would be appropriate to add a
target="_blank"
to all file links for all Drupal users.To answer the question posed in this issue title, my guess is that there are several ways to achieve the required functionality. For example, you could copy file-link.html.twig to your custom theme and add a link attribute as follows:
<span{{ attributes }}>{{ icon }} {{ link|merge({'#attributes': {'target': '_blank'}}) }}</span>
This should open all file links in your frontend theme in a new tab. Hope this helps.
I'm changing the category for this issue to support request and marking it as closed for now. If anyone wants to discuss further, or knows a better/different approach to achieve the OP's objective, feel free to add your comments below.