Using Media and IMCE File Manager together on a Drupal 9 site

Insert an image with a link using IMCE File Manager (AKA, the file browser we used with Drupal 7)

For sites that expect to create links on images on a regular basis, an alternate file browser can be added for your site, providing an additional button to Insert from IMCE File Manager. This button inserts an image as a plain <img> tag that won't trigger the empty paragraph bug when a link is added to the image. This configuration is supported as a workaround and will be phased out when the bug is fixed.

Bug: Media images with links create empty paragraph tags

An unfortunate bug exists in Drupal 9 related to adding links around images inserted from the Media Library into a field with the editing toolbar: each time the editing toolbar loads, an empty paragraph tag is added after any Media image with a link. If the page is saved without deleting the empty paragraph, it will add a visible blank line in the content. Repeated edits will insert more empty paragraphs that will build up. The following actions are known to trigger this bug:

Images with Clickable Links

An image can be turned into a clickable button by adding a link to the image.

Anchor Links

An anchor link or "jump" link points to a specific point on a web page, instead of the default top of page. They are often used in tables of contents and FAQ lists.

Step 1: Create the anchors

Follow the steps to create anchors (provided by the developers of the CKEditor editing tool we use in Drupal).

Changing Menu Links

See also: Adding menu links

A “Menu” is Drupal’s term for a group of links that help visitors navigate to the pages on a website. This guide describes how to edit a link in your site’s main menu.

Forcing Links to Open in a New Window or Tab

Forcing links to open in a new window or tab is not recommended. The best-practice advice on this topic is to avoid opening new windows/tabs without warning because:

Creating and Editing Website Content

There are often multiple ways to accomplish the same task in Drupal. This guide provides steps for one way of doing tasks related to content maintenance. You may find alternate methods that you prefer.

Subscribe to RSS - links