Academic Block

HTML Sitemap & Robots Control Get Certified

HTML Sitemap vs XML Sitemap

An HTML sitemap is a regular web page that lists important links for human visitors. It improves navigation and helps search engines discover pages through internal links.

An XML sitemap is a special file written for search engines. It lists URLs (and optional metadata) so crawlers can find and prioritize your content more efficiently.

Best practice: use both — an HTML sitemap for users and an XML sitemap for search engines.

Robots Control

You can control crawlers in two main ways:

  • robots.txt – site-wide rules placed at the root of your domain
  • meta robots tag – page-level instructions inside the <head>

Practical Examples

1. Simple HTML Sitemap Page

A user-facing sitemap built with semantic HTML lists.

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Site Map – Example Website</title>
  <style>
    body { font-family: system-ui, sans-serif; max-width: 700px; margin: 40px auto; padding: 0 20px; line-height: 1.6; }
    h1 { color: #1a73e8; }
    h2 { margin-top: 1.8em; border-bottom: 1px solid #eee; padding-bottom: 6px; }
    ul { padding-left: 1.2em; }
    a { color: #1a73e8; text-decoration: none; }
    a:hover { text-decoration: underline; }
  </style>
</head>
<body>
  <h1>Site Map</h1>
  <p>Quick links to the main sections of this website.</p>

  <h2>Main Pages</h2>
  <ul>
    <li><a href="/">Home</a></li>
    <li><a href="/about">About Us</a></li>
    <li><a href="/services">Services</a></li>
    <li><a href="/contact">Contact</a></li>
  </ul>

  <h2>Blog</h2>
  <ul>
    <li><a href="/blog">All Posts</a></li>
    <li><a href="/blog/html-basics">HTML Basics</a></li>
    <li><a href="/blog/seo-tips">SEO Tips</a></li>
  </ul>

  <h2>Legal</h2>
  <ul>
    <li><a href="/privacy">Privacy Policy</a></li>
    <li><a href="/terms">Terms of Service</a></li>
  </ul>
</body>
</html>

2. Meta Robots Tag (Page-Level Control)

Use the robots meta tag when you want different rules for individual pages.

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Thank You Page (Noindex)</title>

  <!-- This page should not appear in search results -->
  <meta name="robots" content="noindex, follow">

  <!-- Common values:
       index, follow     → normal (default)
       noindex, follow   → do not show in search, but still follow links
       noindex, nofollow → do not index and do not follow links
       none              → same as noindex, nofollow
  -->
</head>
<body>
  <h1>Thank You!</h1>
  <p>Your form was submitted successfully. This page is marked noindex so it will not appear in Google search results.</p>
</body>
</html>

3. robots.txt Examples

robots.txt lives at the root of your domain (e.g. https://example.com/robots.txt). It is a plain-text file, not HTML.

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>robots.txt Examples</title>
  <style>
    body { font-family: system-ui, sans-serif; max-width: 700px; margin: 40px auto; padding: 0 20px; }
    pre { background: #f5f5f5; padding: 16px; border-radius: 6px; overflow-x: auto; }
    h2 { margin-top: 2em; }
  </style>
</head>
<body>
  <h1>robots.txt Examples</h1>

  <h2>1. Allow everything (default behavior)</h2>
  <pre>User-agent: *
Allow: /

Sitemap: https://www.example.com/sitemap.xml</pre>

  <h2>2. Block specific folders</h2>
  <pre>User-agent: *
Disallow: /admin/
Disallow: /private/
Disallow: /tmp/

Sitemap: https://www.example.com/sitemap.xml</pre>

  <h2>3. Block the entire site (use with caution)</h2>
  <pre>User-agent: *
Disallow: /</pre>

  <p><strong>Note:</strong> robots.txt is a request, not a security mechanism. Sensitive pages should also be protected with authentication.</p>
</body>
</html>

Quick Best Practices

  • Provide both an HTML sitemap (for users) and an XML sitemap (for search engines).
  • Link to the HTML sitemap from the footer of every page.
  • Use the robots meta tag for page-level control (thank-you pages, internal tools, etc.).
  • Keep robots.txt simple and test it with Google’s robots.txt Tester.
  • Never rely on robots.txt alone to hide private content.

Web Resources

1. Google : Introduction to robots.txt
2. Google : Build and submit a sitemap
3. Sitemaps.org Protocol
4. MDN : robots meta tag

Questions and Answers

+ What is the difference between an HTML sitemap and an XML sitemap? >

An HTML sitemap is a normal page for human visitors. An XML sitemap is a machine-readable file written specifically for search engine crawlers.

+ Where should robots.txt be placed? >

At the root of your domain: https://www.example.com/robots.txt.

+ When should I use noindex? >

On pages that should not appear in search results (thank-you pages, login pages, internal tools, duplicate content, etc.).

+ Does robots.txt guarantee that a page will stay private? >

No. It is only a request to well-behaved crawlers. Sensitive content must be protected with proper authentication and server-side access control.

+ Should I have both an HTML and an XML sitemap? >

Yes. The HTML version helps users and internal linking. The XML version helps search engines crawl your site more efficiently.

🧪 Test Your HTML Code

Edit the HTML code on the left and click “Run Code” to see the result on the right.

📝 HTML Code
👁️ Preview (Rendered HTML)

Click “Run Code” to see the result here.