Skip to content
Browse all guides

Issue #130 · standard

Issue 130

What is this issue?

This issue checks whether your web pages include a <link rel="sitemap"> tag in the HTML head section that points to your XML sitemap location.

A passing implementation includes a link tag in the <head> section that explicitly declares the location of your XML sitemap:

Example of correct implementation:

<link rel="sitemap" type="application/xml" href="/sitemap.xml" />

This tag helps search engines and other crawlers discover your sitemap directly from the HTML source, providing an additional method of sitemap discovery beyond the traditional /sitemap.xml URL and the Sitemap: directive in robots.txt.

Why does it matter?

Including a <link rel="sitemap"> tag in your HTML head provides several SEO benefits:

  • Enhanced discoverability: While most search engines check for /sitemap.xml automatically, the link tag provides an explicit signal about your sitemap location, ensuring it's found even if standard methods fail.

  • Crawler efficiency: Some crawlers and SEO tools check the HTML head for sitemap references, which can speed up the discovery process.

  • Multiple discovery paths: Having your sitemap discoverable through multiple methods (direct URL, robots.txt, and HTML head) creates redundancy and increases the likelihood that all search engines will find it.

  • Comprehensive SEO: This is a relatively simple addition that demonstrates attention to technical SEO detail, contributing to a well-optimized website.

While this is not a critical issue (search engines will typically find your sitemap through other methods), implementing it shows technical SEO maturity and can help ensure complete indexation of your site.

Resolving this issue improves your SEO health score by demonstrating comprehensive technical optimization and providing additional pathways for search engines to discover your content.

How to fix it

Follow these steps to add the sitemap link tag to your HTML:

  1. Identify your sitemap URL: Determine the correct path to your XML sitemap (typically /sitemap.xml or /sitemap_index.xml).

  2. Add the link tag to your HTML head: Place the following line inside the <head> section of your HTML document:

    <link rel="sitemap" type="application/xml" href="/sitemap.xml" />
    
  3. Adjust the href value if needed: If your sitemap is located at a different path, update the href attribute accordingly:

    <link
      rel="sitemap"
      type="application/xml"
      href="/path/to/your/sitemap.xml"
    />
    
  4. For multiple sitemaps: If you have multiple sitemaps, you can include multiple link tags:

    <link rel="sitemap" type="application/xml" href="/sitemap-pages.xml" />
    <link rel="sitemap" type="application/xml" href="/sitemap-images.xml" />
    
  5. Verify implementation: Use View Page Source or browser developer tools to confirm the tag appears correctly in the rendered HTML.

Note: This tag should be present on all pages of your website for consistency, though it's most important on the homepage.

Examples

Example 1: Correct Implementation

Scenario: A properly configured page with sitemap link tag.

Correct State (Passes):

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <link rel="sitemap" type="application/xml" href="/sitemap.xml" />
  <title>Page Title</title>
</head>

Example 2: Missing Sitemap Link Tag

Scenario: Page has no sitemap link tag in the head.

Problematic State (Fails):

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <title>Page Title</title>
</head>

Why it fails: Search engines and crawlers won't discover the sitemap through this HTML discovery method.

Corrected State (Passes):

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <link rel="sitemap" type="application/xml" href="/sitemap.xml" />
  <title>Page Title</title>
</head>

Example 3: Multiple Sitemaps

Scenario: Site has multiple sitemaps for different content types.

Correct State (Passes):

<head>
  <link rel="sitemap" type="application/xml" href="/sitemap-pages.xml" />
  <link rel="sitemap" type="application/xml" href="/sitemap-images.xml" />
  <link rel="sitemap" type="application/xml" href="/sitemap-videos.xml" />
  <title>Page Title</title>
</head>

Example 4: Sitemap at Non-Standard Location

Scenario: Sitemap is located at a non-standard path.

Correct State (Passes):

<head>
  <link rel="sitemap" type="application/xml" href="/feeds/sitemap.xml" />
  <title>Page Title</title>
</head>

Note: The href attribute should point to the actual location of your sitemap file.

Example 5: Sitemap Link on Homepage

Scenario: Sitemap link is most important on the homepage.

Correct State (Passes):

<!-- Homepage (https://example.com/) -->
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <link rel="sitemap" type="application/xml" href="/sitemap.xml" />
  <title>Home - Example Site</title>
</head>

Note: While it's best to include the sitemap link on all pages, it's most critical on the homepage since that's often the first page crawled.

How PixyScan detects this

PixyScan performs the following checks to detect this issue:

  1. HTML parsing: The crawler extracts the <head> section from the page's HTML content.

  2. Link tag search: It looks for a <link> tag with the attribute rel="sitemap".

  3. Attribute validation: If the tag is found, PixyScan checks for:

    • The presence of an href attribute (should point to the sitemap URL)
    • The optional type="application/xml" attribute (recommended for clarity)
  4. Pass/Fail determination:

    • Passes: If a <link rel="sitemap"> tag is present in the HTML head section with a valid href attribute
    • Fails: If no <link rel="sitemap"> tag is found in the HTML head

The detection is straightforward: the crawler simply checks for the existence of this specific link tag in the head section. It does not validate whether the sitemap file actually exists at the specified location (that would be a separate check).

References