← Back to glossary
Sitemap Glossary

What is <loc>?

The XML tag inside a sitemap that specifies the URL of a page.

The `<loc>` element is the only required child of a `<url>` entry in an XML sitemap. It contains the full, absolute URL of a page on the website. The URL must include the protocol (http or https) and must be properly encoded.

Special characters like ampersands (`&`), quotes, and angle brackets must be XML-escaped. For example, `&` becomes `&amp;`. URLs should be under 2,048 characters.

SitemapKit's extract endpoint parses the `<loc>` tag from every URL entry and returns it in the structured JSON response.

Example

<url>
  <loc>https://example.com/products/widget-a?ref=home&amp;color=blue</loc>
</url>

Work with sitemaps programmatically

SitemapKit's API lets you discover, extract, and parse XML sitemaps from any domain. Get structured JSON data with all sitemap elements including loc.

Related Terms