HtmlArea: Support attachments as links you can open in a new tab

We want to be able to link our pdf files in the same way you would other content/pages in Content Studio when inserting a link via an htmlArea field. Since we don’t want our pdf files to be opened as download links.

When we select an attachment (e.g. a pdf uploaded in Content Studio) in the “Innhold/Content” tab and have “Åpne i ny fane/Open in a new tab” checked, the link will point to the attachment’s page rather than the attachment itself, which result in an error.

Hi there.

You may solve this by implementing a controller that serves a regular page for your file (aka media).
Follow these steps:
a) define a controller “match-mapping” that will apply to your content (i.e. type=‘media:.*’),
b) implement the controller logic, presenting the page as you desire

When using the content link, any media will now be delivered as a page (rather than as the file itself). The page should present the download link, or a preview of the media.