Adding inline links

How to add links within text fields.

Before you start

If content already exists on Mass.gov, it's best to link to that content rather than recreate a similar version. This helps make sure that content is always up to date since it's the single source of truth. It also helps the content's Search Engine Optimization (SEO) since it's not competing with similar pages.

If the content is owned by another author, try reaching out to them if you need information updated or revised.

Overview

You can add inline links within any rich text editor while creating or editing content on Mass.gov.

Inline links have 2 parts: the anchor text, or words that can be clicked; and the URL, or web address, that those words link to.

Note: This resource is about linking to HTML content. Check out our Linking to documents article for more info about working with documents and other types of files.

Choosing anchor text for your link

Good anchor text is an important part of accessibility and searchability. Avoid using “click here” or other non-specific language. Instead, try to explain where you’ll go if you click the link, matching the title of the destination page if possible.

Example:

SNAP benefits, formerly the food stamps program, are part of a federal program to help people with limited means pay for food. You can find out if you are eligible for SNAP benefits online or by calling the Department of Transitional Assistance’s (DTA) helpline at (877) 382–2363.

Learn more about link text in our style guide.

Linking to a Mass.gov page

1. Select and highlight your anchor text. 2. Click the “Add link” button on the editor toolbar.

3. Type the page title into the URL field. 4. Select the page you want to link from the drop-down menu. 5. Click “Save.”

Linking to an external page

  1. Copy the URL of the page you want to link to.

  2. Select and highlight your anchor text.

  3. Click the “Add link” button on the editor toolbar.

  4. Paste the link you copied in step 1.

  5. Click “Save.”

Linking to friendly URLs

Sometimes it makes sense to showcase friendly URLs on Mass.gov content, such as an inline link in the body of a press release.

Doing so isn’t as simple as typing that short web address into the URL field, however. If you do that, clicking the friendly URL text on your page will generate an error message due to a broken link.

You can use either of these approaches when filling in the URL field to ensure your link works:

  • Type in the friendly URL, but make sure you have “https://” before the “www” (e.g., https://www.mass.gov/friendlyurls)

  • Type in the friendly URL starting at the forward slash (e.g., /friendlyurls)

In either situation, your friendly URL (e.g., mass.gov/friendlyurls) can be used as the link text visible to page visitors.

We don’t recommend putting the long web address that the friendly URL leads to in the URL field. This is because if you change the friendly URL’s target page then visitors won’t be taken to the right place when they click on the hyperlinked friendly URL.

Was this article helpful?

Tell us what you think button