I use CKEditor in Drupal 8. I want that every link will open in a new tab of browser. I want that the code look like this

    <a href="#" target="_blank">my link</a>

But if I use the link Button in editor I do not have choice for target blank. I only can fill in the url of link and the code looks like this

    <a href="#">my link</a>

Any idea what I have to do for changing this?


3 Answers 3


D8 Editor Advanced link module

Enhances the link Dialog in D8 CKEditor. Allows to define the following attributes:

  • title
  • class
  • id target
  • rel

enter image description here


You can use the Linkit module and add a "target" attribute at admin/config/content/linkit/manage/default/attributes/add

It has two options:

  • Selectlist with predefined targets.

Dialog with options

  • Simple checkbox to allow links to be opened in a new browser window or tab.

Dialog with checkbox

  • I prefer Linkit because it provides an easy interface for internal linking with wysiwyg editors by using an autocomplete field. Commented Jan 5, 2018 at 12:01
  • 2
    Linkit 8.x-5.x has removed support for link attributes. The module's page advises: "If you are in need for link attributes, please see D8 Editor Advanced link", as posted in chosen solution here.
    – Nick Hope
    Commented Jun 14, 2019 at 18:46

If you want every link to open in a new window, it'd be better to not use the Editor Advanced Link module, but instead add a filter to your text format that sets target=_blank on every <a>.

  • How can I do that: "add a filter to your text format that sets target=_blank on every <a>"? I don't see that kind of filter when edit a text format.
    – Saulius
    Commented Sep 22, 2016 at 14:08
  • 1
    You'd have to create one. Unless drupal.org/project/extlink already does this, it sounds like it might.
    – Wim Leers
    Commented Sep 24, 2016 at 11:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.