Sub topic 3
Controlling Indexing with the Robots Meta Tag
Assume you know basic HTML elements, attributes, document structure, and the difference between a browser and a search engine. This chapter focuses on metadata that controls discovery, presentation, and verification.
Controlling indexing with the robots meta tag
The robots meta tag gives compliant search-engine crawlers instructions for a page. For example, noindex requests that the page not appear in search results:
<meta name="robots" content="noindex, nofollow">nofollow asks crawlers not to follow links on the page. These values are requests, not access control. They do not protect private content. Use authentication, authorization, or server configuration for that purpose.
Linking resources and canonical URLs
Use link elements for external resources and relationships:
<link rel="stylesheet" href="/styles.css">
<link rel="icon" href="/favicon.ico">
<link rel="canonical" href="https://example.com/shoes">A canonical URL identifies the preferred address when equivalent pages have multiple URLs. It helps search engines consolidate signals, but it is also a hint rather than a guaranteed redirect or indexing rule.
Ordering head content
Place encoding information early, followed by the viewport, title, description, and other metadata. Keep related links and social tags together.
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Trail Running Shoes | Example Store</title>
<meta name="description" content="Compare trail running shoes by grip and cushioning.">
<meta name="robots" content="index, follow">
<link rel="stylesheet" href="/styles.css">
<link rel="canonical" href="https://example.com/shoes">
</head>Open Graph link previews
Open Graph tags use property, not name. They provide a title, description, image, and URL to platforms that support the protocol.
<meta property="og:title" content="Trail Running Shoes">
<meta property="og:description" content="Compare lightweight trail running shoes.">
<meta property="og:image" content="https://example.com/images/shoes.jpg">
<meta property="og:url" content="https://example.com/shoes">Theme and color hints
These tags suggest browser interface and page color schemes:
<meta name="color-scheme" content="light dark">
<meta name="theme-color" content="#0b5fff">They do not automatically create a dark theme. Your CSS must respond to the selected scheme.
Checking your head
Open developer tools and inspect the rendered document. Confirm the title, meta values, link URLs, and loaded stylesheet. Then use an HTML validator and test the final public URL with search or sharing preview tools. Check that absolute social image URLs work and that noindex has not been left on a production page.
Exercise
Does a robots meta tag prevent an unauthorized visitor from reading a page?
Show answer
No. It only gives indexing instructions to compliant crawlers; enforce access on the server.