freecourses.digital
Lesson progress: 0 of 3 activities done
All lessons in HTML Basics for Beginners Lesson 9.3 of 34

Module 10: Practice Project and Validation

  1. 10.1Build a simple HTML website

Canonical links, robots directives, and basic metadata

In this lesson

  • What duplicate URLs are and why canonicals help
  • Writing a rel="canonical" link
  • Meta robots: noindex, nofollow, and friends
  • hreflang and structured data basics

Short answer

A canonical link, <link rel="canonical" href="...">, tells search engines which URL is the main version when the same content appears at several addresses. The meta robots tag controls whether a page is indexed and whether its links are followed. Together with basics like hreflang and structured data, these tags help search engines index the right pages in the right way.

Duplicate URLs happen

These can all show the same page:

https://example.com/pili-tarts/
https://www.example.com/pili-tarts/
https://example.com/pili-tarts/?utm_source=facebook
https://example.com/pili-tarts/?sort=price

Search engines may see four pages. A canonical tag points them all to one preferred version, which consolidates signals like links.

The canonical tag

<link rel="canonical" href="https://example.com/pili-tarts/">
  • Put it in the head.
  • Use the full absolute URL with https.
  • Point each normal page to itself, called a self-referencing canonical.
  • Make sure the target page returns status 200 and is not set to noindex.

A canonical is a strong hint, not a command. Google can choose a different canonical if signals disagree.

Meta robots directives

<meta name="robots" content="noindex, follow">
DirectiveMeaningUse for
noindexDo not show this page in search resultsThank you pages, internal search results, test pages
nofollowDo not follow links on this pageRarely needed site-wide
noarchiveDo not show a cached copyPages with changing prices
max-snippet:50Limit snippet lengthSpecial cases

Pages are indexable by default, so you only add robots tags to change that. Important: robots.txt blocks crawling, while noindex blocks indexing. If robots.txt blocks a page, Google cannot see its noindex tag.

hreflang and structured data

<link rel="alternate" hreflang="en-PH" href="https://example.com/">
<link rel="alternate" hreflang="fil-PH" href="https://example.com/fil/">

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "Bakery",
  "name": "Mayon Bakeshop",
  "telephone": "+639171234567",
  "address": {
    "@type": "PostalAddress",
    "addressLocality": "Legazpi City",
    "addressRegion": "Albay",
    "addressCountry": "PH"
  }
}
</script>

hreflang links language versions of a page, like English and Filipino. Structured data in JSON-LD describes your business, products, FAQs, or courses using Schema.org vocabulary, which can earn rich results. Test it with Google’s Rich Results Test.

Try it: set up SEO metadata

Add a self-referencing canonical for https://example.com/thank-you/ and a meta robots tag that keeps the page out of search but lets links be followed.

Live preview

Quick quiz

1. What does a canonical tag do?
2. Which page is a good noindex candidate?
3. robots.txt blocks?
4. Which format does Google recommend for structured data?

Common mistakes

  • Canonical to a redirected or noindex page. Mixed signals make Google ignore your canonical.
  • noindex on important pages. A leftover noindex from a staging site can remove pages from Google.
  • Blocking noindex pages in robots.txt. Google cannot read a noindex it cannot crawl.
  • Relative canonical URLs. Use full absolute URLs.

Your action

Tick each item when you can do it. Your progress saves on this device.

Key terms

Canonical URL
The preferred version of a page among duplicates.
Meta robots
A tag that controls indexing and link following.
noindex
Keeps a page out of search results.
robots.txt
A file that tells crawlers which paths not to crawl.
hreflang
Links language or regional versions of a page.
Structured data
Code that describes content for search engines, often JSON-LD.

Questions beginners ask

Do I need a canonical on every page?

It is a good habit. Most SEO plugins add self-referencing canonicals automatically.

How do I check if a page is noindex?

View source and search for robots, or use Google Search Console's URL Inspection tool.

Does structured data improve rankings?

Not directly. It can earn rich results that stand out and get more clicks.

Related lessons

Need a website built or fixed while you practice? The team at Remar Digital can help.