Do you want to come to Andalu-SEO?
Andalu-SEO

Sitemaps

Everything you need to know about how to create and interpret a sitemap

Sitemaps
Author:
Carlos Sánchez
Topics:
Crawling
,
International
,
LinkBuilding
Publication Date:
2026-01-08

Last Review:
2026-01-08

An SEO Sitemap will be a web file containing a list of URLs where it indicates to search engines which URLs are relevant.

Depending on the type of Sitemap, additional factors can be specified, such as the last update, whether that URL contains relevant images or videos, or even whether it has an alternative language or “regional” version.

Sitemaps are especially recommended for large websites, with a large amount of multimedia files or with poor linking. Ideally, these Sitemaps should be automated, as it is difficult to keep the Sitemap of any minimally large website up to date.

Since there are options as simple as adding a Sitemaps with the main URLs in a txt file, or a basic XML implementation, and it does not harm rankings or performance, I personally recommend always doing it (clearly in a lower order of priority, below more necessary tasks), as it is quite common for a website’s external/internal linking and architecture not to stand out for being exemplary.

General characteristics of any Sitemap

It is useful to know that you do not need to put all URLs in the same Sitemap nor do you necessarily have to do it only for robots. It is great if you can segment it into blocks to detect errors and make it useful and understandable for humans. Here is an example of what mine would look like (to see the code you can right-click and choose “view page source”, or if you are on mobile add “view-source:” before the URL).

Sitemap XML

An XML Sitemap is the most complete type of Sitemap, as it allows us to offer Google a lot of information about the characteristics of the URLs that we want to indicate to the search engine as indexable.

Basic Sitemap

In a basic XML Sitemap, we simply need to focus on placing the URLs according to the semantics of Sitemaps designed for SEO.

On a website with a standard alphabet, we must always start with this code in the .xml file to indicate the type of encoding:

<?xml version="1.0" encoding="UTF-8"?>

Having explained this, I show an example of a basic and standard sitemap. I will include only one URL so that the characteristics can be clearly seen and appreciated:

<?xml version="1.0" encoding="UTF-8"?>
<!-- If you want to add a nice style, you can use mine -->
<?xml-stylesheet href="https://carlos.sanchezdonate.com/wp-content/themes/sanchezdonate/core/css/stylesheet.xsl
" type="text/xsl"?>

<!-- you need to set the correct attribute in urlset, with the proper xmlns; for a simple sitemap this is enough: -->
<urlset
xmlns="https://www.sitemaps.org/schemas/sitemap/0.9"
>
<url>
<loc>https://carlos.sanchezdonate.com/</loc>
<lastmod>2023-05-24</lastmod>
</url>
</urlset>

Attributes

The lastmod attribute must be used with care, since from June 2023 they emphasize using lastmod only when there are significant changes on the page.

The rest of the attributes, such as changefreq or priority, are irrelevant, as Google does not read them and they can make the page heavier.

Image Sitemap

The rest of the specific sitemaps are actually like an extension of a basic Sitemap, but with the "image library" added, with the attribute and URL exactly as in the example, and with the corresponding tags inside <url>.

What is done by adding images to a sitemap is to indicate the important images present on a URL.

<?xml version="1.0" encoding="UTF-8"?>
<!-- If you want to add a nice style, you can use mine -->
<?xml-stylesheet href="https://carlos.sanchezdonate.com/wp-content/themes/sanchezdonate/core/css/stylesheet.xsl" type="text/xsl"?>
<!-- you need to set the correct attribute in urlset, with the proper xmlns; for a simple sitemap this is enough: -->
<urlset
xmlns="https://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
>
<url>
<loc>https://master-testing.com/&lt;/loc></span>
<lastmod>2023-05-24</lastmod>
<image:image>
<image:loc>https://carlos.sanchezdonate.com/wp-content/themes/sanchezdonate/images/sanchez-white-seo.svg&lt;/image:loc>
</image:image>
</url>
</urlset>

Attached is an example of an image Sitemap that you can view by right-clicking and selecting "view page source".

Attributes

The rest of the existing attributes for an image-specific sitemap have been obsolete since May 6, 2022.

Not understanding this?
If you need help with the more technical aspects, book a consultancy session with me: Get real SEO help!

Video Sitemap

It is not necessary to include the image sitemap to include the video sitemap. One extension does not depend on another.

This type of Sitemap makes sense on websites that use a lot of videos, such as TV channel sites. It is especially recommended to indicate the URLs where the main feature is the video and to combine it with structured data for video.

Recommendations for a video sitemap:

<?xml version="1.0" encoding="UTF-8"?>
<!-- If you want to add a nice style, you can use mine -->
<?xml-stylesheet href="https://carlos.sanchezdonate.com/wp-content/themes/sanchezdonate/core/css/stylesheet.xsl" type="text/xsl"?>
<!-- You need to add the correct attribute in urlset, with the correct xmlns. For a simple sitemap, this is enough:-->
<urlset
xmlns="https://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"
>
<url>
<loc>https://master-testing.com/</loc>
<lastmod>2023-05-24</lastmod>
<image:image>
<image:loc>https://carlos.sanchezdonate.com/wp-content/themes/sanchezdonate/images/sanchez-white-seo.svg</image:loc>
</image:image>
<video:video>
<video:thumbnail_loc>https://i.ytimg.com/vi_webp/f5-07hStg4A/maxresdefault.webp</video:thumbnail_loc>
<video:title>Cookies and Cache in SEO</video:title>
<video:description>Discover what cookies and cache are, how they affect a website, and how to use them to your advantage in SEO</video:description>
<video:player_loc>https://www.youtube.com/embed/f5-07hStg4A</video:player_loc>
<!-- Optional video tags -->
<video:duration>5198</video:duration>
<video:publication_date>2023-05-24</video:publication_date>
<video:family_friendly>yes</video:family_friendly>
<video:rating>5.0</video:rating>
<video:view_count>3000</video:view_count>
<video:restriction relationship="allow">ES MX US</video:restriction>
<video:platform relationship="allow">mobile</video:platform>
<video:requires_subscription>yes</video:requires_subscription>
<video:uploader>Carlos Sánchez</video:uploader>
<video:live>no</video:live>
<video:tag>cookies, cookies, cache, servers, wpo, seo, technical seo</video:tag>
</video:video>
</url>
</urlset>

Mandatory Attributes

In the official documentation, there is a detail of each and every one of these attributes.

As can be seen, there are many attributes that are required for the video sitemap to work.

Optional Attributes

News Sitemap

News Sitemaps are more complicated to implement correctly, which is why I recommend reading the instructions carefully. However, this type of Sitemap is highly crawlable by Google, as it is one of the fastest ways to get indexed.

The fastest way to index would be through the Indexing API, but it is recommended only for streaming videos and job postings, i.e., for “ephemeral indexing,” so using the Indexing API implementation could be considered Black-hat since it requires having the appropriate structured data.

In conclusion, the fastest/most efficient way to index a news article or post, besides using the Search Console inspector, is through a News Sitemap.

<?xml version="1.0" encoding="UTF-8"?>
<!-- If you want to add a nice style, you can use mine -->

<?xml-stylesheet href="https://carlos.sanchezdonate.com/wp-content/themes/sanchezdonate/core/css/stylesheet.xsl" type="text/xsl"?>

<!-- you need to add the correct attribute in urlset, with the correct xmlns, for a simple sitemap this is enough: -->


<urlset

xmlns="https://www.sitemaps.org/schemas/sitemap/0.9"

xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"

xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"

xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"
>

<url>


<loc>https://master-testing.com/</loc>

<lastmod>2023-05-24</lastmod>


<image:image>

<image:loc>https://carlos.sanchezdonate.com/wp-content/themes/sanchezdonate/images/sanchez-white-seo.svg</image:loc>

</image:image>


<video:video>


<video:thumbnail_loc>https://i.ytimg.com/vi_webp/f5-07hStg4A/maxresdefault.webp</video:thumbnail_loc>

<video:title>Cookies and Cache in SEO</video:title>

<video:description>Discover what cookies and cache are, how they affect a website, and how to use them to your advantage in SEO</video:description>

<video:player_loc>https://www.youtube.com/embed/f5-07hStg4A</video:player_loc>


<!-- Optional video tags -->


<video:duration>5198</video:duration>

<video:publication_date>2023-05-24</video:publication_date>

<video:family_friendly>yes</video:family_friendly>

<video:rating>5.0</video:rating>

<video:view_count>3000</video:view_count>

<video:restriction relationship="allow">ES MX US</video:restriction>

<video:platform relationship="allow">mobile</video:platform>

<video:requires_subscription>yes</video:requires_subscription>

<video:uploader>Carlos Sánchez</video:uploader>

<video:live>no</video:live>

<video:tag>cookies, cache, servers, wpo, seo, technical seo</video:tag>

</video:video>

<news:news>

<news:publication>

<news:name>The equivalent of the h1</news:name>

<news:language>es</news:language>

</news:publication>

<news:publication_date>2023-05-24</news:publication_date>

<news:title>Make up another title or copy the existing one</news:title>


</news:news>

</url>

</urlset>

Mandatory Attributes:

For a news sitemap to be effective, it must include these tags as required.

A news sitemap must be updated with new articles as they are published. In this specific sitemap, it makes more sense than in any other that the URL is not static.

Articles must be no older than 2 days, and after this period, the URLs must be removed from the sitemap or the tags and subtags belonging to <news:news> must be deleted

Sitemap Index

A sitemap index is a sitemap of sitemaps. Since there is a restriction on size and number of links, it is ideal for long websites. I also like it to divide the site on different sections and, when automated, to keep the sitemaps organized. Additionally, it makes error detection much easier.

This is how a Sitemap Index would look:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="wp-content/themes/sanchezdonate/core/css/stylesheet.xsl" type="text/xsl"?>
<sitemapindex
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://carlos.sanchezdonate.com/sitemap.xml</loc>
</sitemap>
<sitemap>
<loc>https://carlos.sanchezdonate.com/sitemap-posts.xml</loc>
</sitemap>
</sitemapindex>

Language Sitemap

If you want to implement a language sitemap, you must understand how hreflang work. n addition to pointing to the different language versions, it is important that they are referenced as self-referencing and that the concepts are clear, such as what x-default consists of.

Remember the guidelines common to all implementation methods. This is the most practical solution for a system of pages in different languages with different domains or even servers, as maintenance and implementation are much simpler than doing it via meta tags or servers.

This is because you only need to replace the XML files and ensure that each URL matches its alternate versions across domains.

Not all URLs need an alternate version, but for safety, Google will only consider an hreflang when it is indicated from the different versions.


This is how hreflangs work

When hosted on the same domain

<?xml version="1.0" encoding="UTF-8"?>
<urlset
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>http://hreflang.test/</loc>
<xhtml:link
rel="alternate"
hreflang="es"
href="http://hreflang.test/es"/>
<xhtml:link
rel="alternate"
hreflang="en"
href="http://hreflang.test/"/>
</url>
<url>
<loc>http://hreflang.test/es</loc>
<xhtml:link
rel="alternate"
hreflang="en"
href="http://hreflang.test/"/>
<xhtml:link
rel="alternate"
hreflang="es"
href="http://hreflang.test/es"/>
</url>
</urlset>

When using different domains

As mentioned, this is the most practical case, so each XML file must be in its language version. Here is a basic example:

Spanish format
<?xml version="1.0" encoding="UTF-8"?>
<urlset
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>http://hreflangtest.es</loc>
<xhtml:link
rel="alternate"
hreflang="en"
href="http://hreflangtest.uk/"/>
<xhtml:link
rel="alternate"
hreflang="es"
href="http://hreflangtest.es"/>
</url>
</urlset>
Format on the English domain
<?xml version="1.0" encoding="UTF-8"?>
<urlset
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>http://hreflangtest.uk/</loc>
<xhtml:link
rel="alternate"
hreflang="en"
href="http://hreflangtest.uk/"/>
<xhtml:link
rel="alternate"
hreflang="es"
href="http://hreflangtest.es"/>
</url>
</urlset>

TXT Sitemap

If you don’t want to complicate things, you can always create a .txt file (please don’t call it robots) and place it in the root folder.

This Sitemap offers very little customization, but it allows a simple list of URLs with the most important pages of the website.

This is quite useful as a temporary patch while the proper Sitemap is being programmed, thanks to its easy handling. But it is not scalable or efficient for large projects.

Feed Sitemap

If you have a blog with RSS, MRSS, or Atom 1.0, your feed can serve as a Sitemap. The advantage of Google accepting this format is that most CMSs generate it automatically and fairly well. Moreover, most articles on a website are indexable. Therefore, for a simple site, it is a great option to have a fully automated Sitemap naturally without the need for plugins (a post sitemap).

Remember not to be a genius and block the /feed/ via robots.txt as most negligent misinformers recommend if you intend to use this system.

Automating Sitemaps

As you can see, they may seem complex to update and manage efficiently, especially the news sitemap.

But no matter how complex they appear manually, if programmed and automated, it becomes a fairly simple, personalized, and scalable process.

That is, the ideal approach is to create the template and automate it, so your site processes it every time an update is received.

To do this or learn how to improve it aesthetically, I cannot explain it in a single post. But it is covered in the SEO Master's program. So if you want to become a sitemap expert, don’t hesitate.

Bibliography

If you like this article, you would help me a lot by sharing my content:
Interested in Advanced SEO Training?

I currently offer advanced SEO training in Spanish. Would you like me to create an English version? Let me know!

Tell me you're interested
You might be interested in other articles:
SEO Articles
Usamos cookies para asegurar que te damos la mejor experiencia en nuestra web. Aquí tienes nuestra política de Cookies.