Link media directly to the actual file, not the media route

Last updated on
26 February 2024

Linkit supports the ability to link to media uploaded in Drupal. Since Drupal "media" are entities (like nodes or taxonomy terms), by default, they have an internal Drupal "route" to a page with the media. However, in most cases, users trying to link to media actually want to link to the underlying file. 

To make links created through Linkit's autocomplete point to the underlying file in the filesystem, do the following:

  1. Go to Configuration > Linkit (/admin/config/content/linkit).
  2. Select or create a Linkit profile.
  3. Click the "Manage matchers" tab.
  4. Click "Add matcher."
  5. Choose the "Media" matcher.
  6. Under "URL Substitution," choose "Direct URL to media."

Screenshot of media matcher with URL substitution

Help improve this page

Page status: No known problems

You can: