Most link problems are invisible to the people who build the site. The menu works, the buttons respond and every page opens when you click. But a crawler does not click. It reads the HTML, looks for <a> elements with an href attribute and follows those. When a link exists only as a JavaScript click handler, a clickable div or a # placeholder, the page behind it can stay undiscovered, and every signal that link could have carried is lost.
This guide covers the HTML side of link SEO. It is built on Google Search Central’s own link best practices and on what we see when we audit and build websites. (Looking for Ahrefs, the SEO platform with the similar name? Read our guide to Ahrefs instead.)
What does a href mean in SEO?
<a href> is the HTML code for a link. The <a> element (the anchor element) creates the link, the href attribute (short for hypertext reference) holds the destination URL, and the text between the tags is the anchor text people click. For SEO, it is the one link format Google reliably crawls.
<a href="https://viralistic.nl/seo">our SEO approach</a>
Google states that it uses links “as a signal when determining the relevancy of pages and to find new pages to crawl.” That gives every <a href> two jobs. It is a path that lets Googlebot discover a URL, and it is context: the anchor text and the words around it tell Google what the destination is about. Links also feed canonicalization, because Google consolidates signals such as links to duplicate URLs into the version it picks as canonical.
The href can hold more than a web address. A full URL such as https://viralistic.nl/seo or a path such as /seo leads to a page. A hash with an id, such as #pricing, jumps to a section of the same page. mailto: opens an email and tel: starts a call. Only the first two point to another page a crawler can visit.

Other attributes refine the link. rel describes your relationship with the destination, target controls where it opens, download asks the browser to save a file instead of opening it and hreflang names the language of the linked page. The ones that matter for SEO are covered below.
A href SEO basics: which links can Google crawl?
Google can generally only crawl a link if it is an <a> element with an href attribute that resolves to a real URL. Links in other formats are mostly not parsed. Google also says it cannot reliably extract URLs from anchor elements without an href, or from other elements that only act as links through script events.
<!-- Google can crawl these -->
<a href="https://example.com/shoes">Shoes</a>
<a href="/products/shoes">Shoes</a>
<a href="/products/shoes" onclick="trackClick('shoes')">Shoes</a>
<!-- Google cannot reliably crawl these -->
<a onclick="goTo('/products/shoes')">Shoes</a>
<span href="/products/shoes">Shoes</span>
<a href="javascript:goTo('shoes')">Shoes</a>
<div onclick="location.href='/products/shoes'">Shoes</div>
In the first group the destination sits in the href, where a crawler can read it without running any code. In the second group the destination only appears when a script runs after a click.
JavaScript links and onclick handlers
An onclick handler can sit on top of a real link. Track clicks, open a menu or animate a transition with JavaScript, but keep a real URL in the href so the link still works for crawlers and for anyone whose script fails to load. This matters most on single-page apps, where frameworks sometimes render navigation as buttons or as elements with a router attribute. Google’s JavaScript SEO guidance asks for real <a href> links and for the History API instead of fragments for routing. Software companies whose marketing site runs on a single-page framework are especially exposed, as our guide to SEO for software companies explains.
Always check the rendered HTML, not your component code. The URL Inspection tool in Google Search Console shows the HTML exactly as Googlebot rendered it.
Hash links and fragments
A fragment such as #pricing jumps to a section on the same page. That is useful for readers, but Google generally does not support fragments as separate URLs. Do not use href="#" as navigation with the real destination hidden in a script, and do not load different content behind fragment URLs. If a view deserves to rank, it deserves its own path.
Where does anchor text fit in an a href link?
Anchor text is the clickable text between the opening and closing tags, and it tells people and Google what the destination is about. Good anchor text is descriptive, reasonably concise and relevant to both pages. Google calls “click here”, “read more”, “website” and “article” too generic, because they say nothing about the destination.
<!-- Too generic -->
Want to show up in AI answers? <a href="/help/astro/ai-search">Click here</a>.
<!-- Descriptive -->
Read our guide on how to <a href="/help/astro/ai-search">get cited by AI search</a>.
From the HTML side, two rules matter most. Never leave a link empty: for image links Google uses the image’s alt text as the anchor text, and for an empty <a> element it can fall back on the title attribute. And keep keywords natural, because cramming them into anchor text is keyword stuffing under Google’s spam policies. What anchor text is, the main types and what a natural profile looks like are covered in our guide to anchor text.
How do internal links help SEO?
Internal links are how Google and your visitors find their way through your site. Google’s guidance is direct: “Every page you care about should have a link from at least one other page on your site.” A page that nothing links to (an orphan page) depends on your sitemap to be found, and it gets none of the context that internal anchor text provides.

What we check in an internal linking audit:
- Every important page is reachable through plain
<a href>links, within a few clicks of the homepage. - Navigation, footers and breadcrumbs render as HTML links, not as script-driven menus.
- Links point straight to the final, canonical URL. Google recommends linking to the canonical URL rather than a duplicate, and every redirect in between is a detour.
- Related articles link to each other in the body text, where the anchor text carries the most context.
On the Astro sites we build, links are rendered into static HTML at build time, so crawlers see them without running any JavaScript. Our Astro SEO guide shows how titles, canonicals and internal links work on those sites.
When should you use nofollow, sponsored and ugc?
Use the rel attribute when you need to tell Google something about your relationship with the page you link to. For ordinary links you vouch for, add nothing. Google recognises three values for this:
| rel value | Use it for | Example |
|---|---|---|
sponsored | Ads, paid placements and other compensated links | A paid review or an affiliate link |
ugc | Links inside user-generated content | Comments and forum posts |
nofollow | Links you do not want to endorse, when the other values do not fit | Citing a source you do not trust |
Google introduced sponsored and ugc in September 2019 and has treated all three values as hints, not strict commands, ever since. For crawling and indexing, nofollow became a hint on 1 March 2020. You can combine values, such as rel="ugc nofollow", and existing nofollow links on paid placements remain acceptable, although Google prefers sponsored.
<a href="https://partner.example.com/offer" rel="sponsored">Partner offer</a>
<a href="https://visitor-site.example.com" rel="ugc nofollow">Visitor's website</a>
We see two mistakes often. The first is adding nofollow to every external link. Google advises using it only when you do not trust the source. Linking out to good sources is normal and can support trust, for example when you cite where a fact comes from. The second is adding nofollow to your own internal links, which are how your own pages get found. For pages within your own site that crawlers should skip, Google points to a robots.txt disallow rule instead.
On our own site, partner links carry rel="sponsored noopener" automatically, so nobody has to remember it link by link.
Do links that open in a new tab need rel noopener?
target="_blank" opens a link in a new tab. That is a user experience choice. Google’s link guidance does not mention it, and the rel values Google reads for SEO are sponsored, ugc and nofollow.
rel="noopener" is a security instruction for the browser. It stops the new tab from getting access to your page through window.opener. According to MDN, modern browsers already apply that behaviour to target="_blank" links automatically, so adding noopener yourself is a harmless safeguard. rel="noreferrer" goes further and hides the referring page, which means the site you link to usually sees the visit as direct traffic instead of a referral from you.
<a href="https://example.com/annual-report.pdf" target="_blank" rel="noopener">
Annual report (PDF, opens in a new tab)
</a>
Use new tabs sparingly. W3C accessibility guidance recommends warning people in advance when a link opens a new window, so nobody loses their place.
Absolute or relative URLs: which is better for SEO?
For ordinary links, both work. Google’s own examples of crawlable links include absolute URLs (https://example.com/shoes) and relative paths (/products/shoes). Relative internal links are shorter and survive a domain change. Absolute links stay unambiguous when your content is copied or syndicated elsewhere.
The rule changes for the elements in your <head>. Google recommends absolute URLs in rel="canonical". Relative paths are supported there, but they can cause problems, for example when a test site gets crawled. Hreflang is stricter: alternate URLs must be fully qualified, including https://. Google gives https://example.com/foo as correct and //example.com/foo or /foo as wrong.
Whatever you choose, be consistent. Pick one host (with or without www), one protocol (https) and one trailing slash convention, and link to exactly that version every time. Viralistic sites, for example, use URLs without a trailing slash, and every internal link follows that pattern. Each mismatch costs a redirect.
Hreflang and canonical: link elements, not a href
Hreflang and canonical look like links, but they live in <link> elements in the <head>, not in <a href> links in the page body. They tell Google how pages relate to each other rather than giving visitors something to click.
Hreflang
Google accepts three equivalent ways to mark language and region versions of a page: <link rel="alternate" hreflang> elements in the head, HTTP headers or your XML sitemap. Each version must list itself and every other version, the annotations must point both ways (Google ignores them otherwise), and an x-default catches everyone whose language you do not serve.
<link rel="alternate" hreflang="en" href="https://viralistic.nl/seo">
<link rel="alternate" hreflang="nl" href="https://viralistic.nl/nl/seo">
<link rel="alternate" hreflang="de" href="https://viralistic.nl/de/seo">
<link rel="alternate" hreflang="x-default" href="https://viralistic.nl/seo">
HTML also allows an hreflang attribute on a normal <a href>, for example in a language switcher. That is valid HTML and describes the language of the linked page, but it is not one of the three methods Google lists for localized versions. Our own site uses both: the language switcher carries hreflang on its <a> links, and the head carries the full set of <link rel="alternate"> elements with absolute URLs and an x-default. The head is what tells Google which version to show.
Canonical
A rel="canonical" link element tells Google which URL you prefer when the same content is reachable at several addresses, for example with tracking parameters. Google only accepts it in the <head>, recommends an absolute URL and advises a self-referencing canonical on the preferred page itself. If you use hreflang, each canonical should point to a page in the same language. And keep it stable: set the canonical in the HTML and do not let JavaScript change it.
<link rel="canonical" href="https://viralistic.nl/seo">
Your canonicals and your internal links should agree. If the canonical names one URL and your menu links to another, you are giving Google two answers to one question.
Which href tool should you use to check your links?
No single href tool catches everything, so we combine a few. We use SEO tools such as Ahrefs in our audits, alongside Google’s own data.
| Tool | What it shows | Good to know |
|---|---|---|
| Google Search Console | URL Inspection shows the HTML Googlebot rendered; the Links report shows your most-linked pages and common link text | Free, and the only view from Google itself |
| Screaming Frog SEO Spider | Crawls your site like a search engine: broken links, redirect chains, anchor text, nofollow, canonicals and hreflang | Free for up to 500 URLs per crawl; JavaScript rendering needs a paid licence |
| Ahrefs Site Audit | Crawls your site and flags more than 170 technical SEO issues, including link problems | Free for verified sites in Ahrefs Free; more in our Ahrefs guide |
| Semrush Site Audit | Internal link issues such as broken links, nofollow internal links and missing anchor text | Part of the Semrush platform |
| W3C Link Checker | Checks the links on a page, or part of a site, for errors and redirects | Free, simple, no account needed |
| Browser developer tools | Inspect an element to see whether a link is a real <a href> | Compare view source with the rendered page |
Start with Search Console and one crawler. Fix broken links and redirect chains first, then look at anchor text and orphan pages. If Ahrefs is your crawler, our guide on how to use Ahrefs walks through Site Audit step by step.
How do links affect AI search?
AI search runs on the same links. Google says its generative AI features, such as AI Overviews and AI Mode, are rooted in its core Search ranking and quality systems, and it asks site owners to keep content crawlable. Those features retrieve pages from the Search index and fan a question out into related queries. A page that is hard to discover is hard to retrieve.
Other AI crawlers are less capable than Googlebot. In a December 2024 study with MERJ, Vercel found that none of the major AI crawlers it measured rendered JavaScript, including OpenAI’s GPTBot, OAI-SearchBot and ChatGPT-User, Anthropic’s ClaudeBot and PerplexityBot. Google’s Gemini was the exception, because it uses Googlebot’s infrastructure. The ChatGPT and Claude crawlers also spent more than a third of their fetches on 404 pages. Crawler behaviour changes over time, but the lesson holds: links that only exist after JavaScript runs may be invisible to these systems, and broken links waste the attention they do give you.
In practice, render your main content and navigation as HTML, on the server or at build time, and keep every important link a plain <a href> with a real URL. Fix broken internal links and keep redirects to a single hop. Descriptive anchor text then tells any reader of the page, human or machine, where a link goes.
Our guide on how to get cited by AI search covers the rest of the picture, from crawler access to consistent facts. If you are comparing providers, our overview of GEO services shows what good AI visibility work includes.
A quick a href SEO checklist
- Every link is an
<a>element with anhrefthat resolves to a real URL. - No navigation depends on
onclick,javascript:URLs or#placeholders. - Anchor text is descriptive, concise and never empty, and image links have alt text.
- Every page you care about has at least one internal link pointing to it.
- Internal links go straight to the canonical URL, without redirects.
sponsoredon paid and affiliate links,ugcon user content,nofollowonly where you do not vouch for the destination.- New tabs only where they help the reader, with
noopenerand a visible notice. - Canonical and hreflang sit in the
<head>with absolute URLs. - A crawl with a link checker shows no broken links and no redirect chains.
How we help
A href SEO is where technical SEO and good writing meet, and they often break during a redesign or migration without anyone noticing until traffic drops. Viralistic reviews link structure as part of our SEO and AI search work. We crawl your site, check what Google and AI crawlers can actually reach, and fix the structure, anchors and rel values that hold your pages back. When we build a site in Astro or Webflow, crawlable links and clean canonicals are part of the foundation from day one. See our webdesign approach, or get in touch if you want a second pair of eyes on your links.
Frequently asked questions
What is the use of href in SEO?
The href attribute holds the destination URL of a link, and it is what makes the link crawlable. Google generally only follows links that are <a> elements with an href, and it uses them to discover new pages and to understand what those pages are about through the anchor text. Without an href, a link may work for visitors but carries no value for search.
What does href stand for?
Href stands for hypertext reference. It is the attribute of the <a> element that holds the address a link points to: a full URL, a path on your own site or, with a hash, a section of the same page. In <a href="/contact">, the destination is /contact. Without an href, the browser has nowhere to go.
What is the difference between a href and anchor text?
The href is the destination of a link, written in the code. The anchor text is the visible, clickable wording between the tags. In <a href="/seo">our SEO approach</a>, /seo is the href and “our SEO approach” is the anchor text. Google needs the first to follow the link and reads the second to understand the destination.
What happens if an anchor tag has no href?
An <a> element without an href is not a link Google can reliably follow. It may still work in the browser if JavaScript handles the click, but crawlers do not click, so the destination stays hidden from them. Google lists this pattern as not recommended. Put a real URL in the href and keep any JavaScript as an extra layer on top.
How does good anchor text help SEO?
Good anchor text tells people and Google what the linked page is about before anyone clicks. Descriptive, concise anchors help Google understand the destination and help readers decide whether to follow the link. Generic phrases like “click here” waste that context, and stuffing keywords into anchors violates Google’s spam policies. Write each anchor as a short, natural description of the page.
Does opening a link in a new tab affect SEO?
No. Opening a link in a new tab with target="_blank" is a user experience choice, and Google’s link guidance does not treat it as a ranking factor. Modern browsers apply noopener behaviour to these links automatically, and adding rel="noopener" yourself is a harmless safeguard. Tell readers the link opens a new tab, and keep new tabs for documents and external references.
Do backlinks still work for SEO?
Yes. Google still describes links as a signal for judging the relevance of pages and for finding new pages to crawl. What counts are links from relevant, trustworthy sites in a natural context, as our guide to link building explains. Buying links to manipulate rankings is link spam, so paid links need rel="sponsored" or nofollow.
Is a href the same as Ahrefs?
No. <a href> is the HTML code that creates a link on a web page. Ahrefs is a commercial SEO platform for backlink analysis, keyword research and site audits, and its name echoes that code. Many people search for one and mean the other. If you are comparing SEO tools rather than writing HTML, read our guide to Ahrefs.
Written by
Founder of Viralistic and official n8n Ambassador
Marrallisa leads strategy, design, search and automation for premium brands from Amsterdam. She has trained teams at Volkswagen and speaks at n8n and Anthropic events. Want to talk through your situation? Book a call with her directly.