Links are what hold the web together. Visitors use them to move around, and search engines use them to find pages. Yet many sites write links carelessly: vague text, missing attributes, or unsafe settings. This guide covers the habits that matter.
The basic link
A link uses the anchor tag, <a>. The href attribute holds the destination. Use a relative path such as /about for pages on your own site, and a full address such as https://example.com/guide for other sites. Link to https:// addresses wherever possible, so visitors do not see security warnings.
Opening a new tab safely
Setting target="_blank" opens a link in a new tab. Older browsers let the new page reach back to the original tab through window.opener. A bad page could use this to send the first tab to a fake login page. This is called reverse tabnabbing.
You can prevent it with rel="noopener". Modern browsers now treat target="_blank" links this way by default. Adding the attribute yourself is still a harmless habit, and it covers older browsers and in-app browsers. A related value, rel="noreferrer", also stops the browser from telling the destination site where the visitor came from.
nofollow, sponsored and ugc
You can tell search engines how you relate to a link:
- sponsored: for paid links, ads and affiliate links. Google asks you to mark these.
- ugc: for links added by users, such as comments and forum posts.
- nofollow: for links you do not want to vouch for.
You can combine them, for example rel="nofollow ugc". Ordinary links to useful pages do not need any of these.
Write link text that makes sense
"Click here" and "read more" tell no one anything. People who use screen readers often jump from link to link. A list of ten "click here" links is useless to them. Search engines also use link text to understand the target page.
Write text that describes where the link goes, such as "our guide to merging PDF files". Keep it short, and let it fit naturally into the sentence.
Links to files
If a link opens a PDF, spreadsheet or archive, say so in the text, and mention the size if it is large. For example, "Price list (PDF, 2 MB)". The download attribute asks the browser to save the file instead of opening it, though it only works for files on your own site.
Common mistakes
- Links that go nowhere. An
href="#"placeholder confuses keyboard and screen reader users. Use a button if the element performs an action. - Linking to HTTP pages. Check that outside links use HTTPS.
- Tiny tap targets. Links packed close together are hard to tap on a phone. Leave space between them.
- Broken links. Check your links now and then. Pages move and sites close.
If you want to build a link or a button with the right attributes without typing them, try our Hyperlink Generator. It runs in your browser.
Examples you can copy
A link to another site that opens in a new tab: <a href="https://example.com/guide" target="_blank" rel="noopener noreferrer">Read the full guide</a>
A paid or affiliate link: <a href="https://example.com/product" rel="sponsored noopener">See the product</a>
A link to a file on your own site: <a href="/files/price-list.pdf" download>Price list (PDF, 2 MB)</a>
A link inside a comment from a visitor: <a href="https://example.com" rel="nofollow ugc">visitor's site</a>
Change the address and the text to fit your page, and keep the attributes that match the situation.
A quick link audit
Once in a while, go through your most visited pages and check every link by hand.
- Click each outside link and confirm that it still loads and still matches your text.
- Read the link text without the sentence around it. If it makes no sense alone, rewrite it.
- Look at the page on a phone and tap the links with your thumb. Each one should be easy to hit.
- Check that paid and affiliate links carry the right attribute.
A short audit every few months keeps small problems from piling up.
Good links are simple: a clear destination, honest text, and the right attributes for the situation.
Comments
No comments yet — be the first to share your thoughts.