Docs › Text and paragraphs
Links
Add, edit and remove links; new tab, nofollow and linkRel.
Attach an address to text or an image. The link dialog also lets you open it in a new tab and tell search engines not to follow it (nofollow).
Try it
See the 82editor home page for details. Put the caret in the link to see its address with edit and remove buttons.
Code for this demo
createEditor('#editor', {
toolbar: 'bold | link unlink',
linkRel: 'ugc',
});Adding a link
- Select text and press the
linkbutton or Ctrl+K. With nothing selected, the dialog also asks for the text to show (empty: the address is used). - An address without a scheme like
example.comgetshttps://;name@example.combecomes amailto:link. - Unsafe addresses such as
javascript:are refused with a message. - The address box suggests bookmarks in the post (places with an
id) for#bookmarklinks (Bookmarks and TOC). - Addresses typed in the text become links after a space or Enter (auto link). A pasted address becomes a link too.
New tab and nofollow
"Open in a new tab" adds target="_blank" with rel="noopener noreferrer". The nofollow checkbox adds nofollow to rel. sponsored and ugc set elsewhere are kept.
rel on every link (linkRel)
For boards written by visitors, set linkRel: 'nofollow ugc'. getHTML() adds it to every http(s) link. Only nofollow, sponsored and ugc are accepted; the content being edited is not changed.
Editing and removing
- With the caret in a link, a small bar shows the address plus open, edit and remove buttons.
- Ctrl+click opens a link in a new tab;
#bookmarklinks jump to that spot in the post. unlink: with just a caret it removes the whole link; with a selection, only the selected part. The text stays.- Selecting an image and adding a link makes the whole image a link (Images).
Presets and phones
link is on the first row of every preset and of the phone toolbar. unlink is in no preset: the link bar and the dialog have remove buttons. The selection toolbar has a link button too.
Saved HTML
<a href="https://82editor.com/">82editor home page</a>
<a href="https://example.com/" target="_blank" rel="nofollow noopener noreferrer">new tab + nofollow</a>
<!-- with linkRel: 'ugc', on output -->
<a href="https://82editor.com/" rel="ugc">82editor home page</a>Options
| Name | Type | Default | Description |
|---|---|---|---|
link | toolbar item | — | Open the link dialog |
unlink | toolbar item | — | Remove a link |
linkRel | string | none | rel added to every http(s) link on output: nofollow sponsored ugc |
autoLink | boolean | true | Typed addresses become links |