N1ED Blog

Link widget: extra options

15 June 2023

In N1ED, link creation is facilitated by a special widget called Link. Like the built-in Link plugins in CKEditor and TinyMCE, the Link widget lets you insert hyperlinks into your content and provides a UI to create and edit them.

In the widget settings on the sidebar, you can see the standard options for adding a link:

  • "Text" - title for the link,
  • "URL" - to link external resources,
  • "Open in" - this option allows you to set where to display the linked URL: this tab (default state), new tab target="_blank", or current frame target="_self".

The widget gives you extra options such as adding CSS classes, styles and attributes.

Link settings
Default link settings

If you are using Bootstrap in your website theme, you can style your links with Bootstrap by using the "Style with Bootstrap" option. When you select this option, the link remains a link but gains an additional attribute role="button".

Link styled with Bootstrap
Link as Bootstrap button

What the hyperlink points to?

The HTML element (or anchor element), with its href attribute, creates a hyperlink to web pages, files, email addresses, locations on the same page, or anything else a URL can address.

URL

The URL that the hyperlink points to.

Link URL
Link URL

Link to a file

To insert a link to a file, use the Browse/Upload buttons. In the first case, the Flmngr will open to select a file already uploaded to the file manager. In the second case, a system dialog window will open to choose a file from your computer.

In the URL field, a URL to the file will be automatically generated, such as:

<a href="https://mydomain.com/files/file.pdf">File</a>
Link to a file
Link to PDF file

Email address

When selecting email, the Set e-mail link dialog will open. In the E-mail field, specify the email address. After inserting the link, the href attribute will appear as:

<a href="mailto:name@email.com">Email</a>

Optionally, you can also set the Subject and Body of the email and pass them inside the href attribute, for example:

<a href="mailto:name@email.com?subject=Title%20of%20email&body=Some%20text">Email</a>

This is especially useful when you need to create a link to an email address with a pre-filled inquiry on the page.

Link to a email

Telephone number

In the Set phone dialog that opens, specify the phone number, and you will receive a link in the following format:

<a href="tel:123-456-7890">Phone</a>
Link to a phone number

Link to a section of a page

If you have anchors created on the current page, such as within headers like <h2 id="anchorname">Header</h2> or other parts of the page, you can link to the desired section. To do this, select the Anchor button and choose the corresponding ID in the dialog that opens.

Anchor dialog

Anchors are particularly useful in longreads and landing pages for better navigation through the document. If there are no anchors on the page, this button will be disabled.

How to create a linking image?

To make a picture a link in HTML, you can wrap the <img> element inside an <a> element. When users click on the image, they will be taken to the URL specified in the <a> element's href attribute. Here's an html example:

<a href="https://example.com">
    <img src="https://example.com/image.jpg" alt="Description of the image">
</a>

This functionality is already provided and fully automated in N1ED, so you don't have to write your own code. To create a linking image, use the Wrap with link action for the selected picture.

Linking image
Creating a linking image

You can wrap not only images with a link. The same can be done with other widgets, such as icons (Font Awesome, Bootstrap Icons).

Icon wraped with link
Icon wraped with link

To remove a link, switch back to the Link widget and use the Unlink action, or x button on the sidebar.

Remove link
Removing a link