The sitemap is one of the main files related to the structure of our website, as they help search engines to better understand the organization of the site and, therefore, to crawl it more easily. A key aspect when we work SEO strategies on our website. So, let’s discover how to create an XML sitemap, as well as the different questions and doubts that may arise.

como crear sitemap xml

What is it and why do you need to create an XML sitemap?

The sitemap are the files through which we provide information to search engines about the structure of the website. From the main pages, blogs or categories, to images and videos, as well as the relationships between them.

With these files we help the robots to crawl the website in a more efficient way, since we “give them” in a structured way how the website is organized. So they will know which pages are more and less relevant, as well as recent changes, among others.

It will be very important to create a properly optimized sitemap, otherwise it may harm the visibility of the pages in the results.

When is it necessary to create a sitemap for a website?

En general, si una página web contiene pocas páginas y están enlazadas adecuadamente entre ellas, los motores de búsqueda ya podrán rastrearlas. Aun así, crear un sitemap XML para una web pequeña, siempre y cuando esté correcto, es una acción que simplemente puede beneficiar a la visibilidad web.

Asimismo, en sitios web muy grandes, como comercios electrónicos o webs multilingües, será recomendable incluir sitemaps XML en el sitio web, con la finalidad de dar a los robots mayor facilidad de rastreo de las páginas y archivos. 

El sitemap de una página web se encuentra en la raíz del dominio, igual que pasaba con el archivo robots.txt: www.miweb.com/sitemap.xml

Difference between XML sitemap and HTML sitemap

Encontramos diferentes formatos de sitemaps, como por ejemplo los sitemaps xml, el más utilizado, ya que está enfocado a facilitar el rastreo de los robots en el sitio web. 

El sitemap XML está creado con el objetivo de facilitar a los robots de búsqueda el rastreo del sitio web, poniendo a su disposición los apartados con la estructura del sitio, así como las diferentes URLs.

como crear sitemap xml wordpress

On the other hand, the HTML sitemap is aimed at facilitating the reading of the web structure to the users, providing a section with most or all of the main pages of the website, among others.

How to create an XML Sitemap?

There are several options for creating an XML sitemap for a website. There are many third-party online tools that automatically create it for you, such as XML Sitemap Generator or Screaming Frog

sitemap xml creacion

On the other hand, in the most used CMS, such as WordPress, you can also create XML sitemaps automatically using different SEO plugins, such as Rank Math or Yoast SEO. As we see in the case of Rank Math, your sitemap.xml page is automatically configured, classified by content type (pages, categories, posts…).

crear sitemap xml organizacion web

To modify this file you can do it from Rank Math > Site Map Settings, and in this section you will be able to edit the different maps of your website depending on the content.

configurar sitemap xml rank math

Finally, you can also check out other options to generate sitemaps for your site

Static or dynamic sitemaps

Depending on the option you choose, you can create static or dynamic XML sitemaps. Static sitemaps are edited manually and are most often used in pages where the content does not change periodically. This option is not very recommendable, if we don’t have all the technical knowlodge and the time, in case we cannot be sure that they will be updated every time we create new content. On the other hand, dynamic sitemaps are automatically updated every time we create or delete a page of the website, a better option if we have a website with content that is updated frequently.

Report to Google: submit the sitemap to Google Search Console

When we have a sitemap on the web, we must inform Google correctly about it. Using Google Search Console we can send our sitemap to Google to be used during the crawling process of the website.

To submit the sitemap to Google, we need to log in to Google Search Console Sitemaps > Enter the URL of the website sitemap and submit it. And then all our sitemaps will be included.

enviar sitemap xml google

Including the Sitemap in the Robots.txt file

Include your sitemap in the robots.txt file is a good SEO practice, especially if you have not submitted it in Google Search Console, as well as for other crawlers (bing…).

For more information, see How does Google crawl and interpret the robots.txt file? 

Sitemaps of other types of content

As mentioned above, you can not only create XML sitemaps of website pages, but also sitemaps of images, videos or news, in order to be properly indexed and facilitate crawling by Google. 

Image Sitemaps

Image sitemaps have the function of facilitating Google’s crawling of the website’s images so that they appear in its image gallery. It is advisable to use this option in web pages where the visibility of images in results is of interest to achieve quality traffic.

Video Sitemaps

In this case, video sitemaps are used to help Google discover and interpret the video files on the website. These sitemaps are used on websites where audiovisual content is of special relevance, for example, if we show tutorials or recipes, as a mechanism to get conversions on the website.

News Sitemaps

Finally, we can create news sitemaps on the website. This practice is basically used in newspapers and magazines, since it allows to show news in Google News.

To know more: questions and answers on how to create an optimized xml sitemap

Also, surely if you create or already have a sitemap on your website, you will have several questions. What happens when we remove a URL from our website in the sitemap? Does it affect if I have a website in different languages? Below, we will answer some of the most frequently asked questions.

How do I indicate in the sitemap that I have a website with more than one language?

If we have websites in different languages, the first thing to know is that WordPress plugins, as well as other online generators, create XML sitemaps easily adapted. So it will not be something that will take us a lot of work. Also, we should always check that they are configured correctly.

So, what we should know is that there are two main methods of implementing multilingual sitemaps, which is advisable to define and choose in relation to the type of international strategy we have previously chosen for our website, either by main generic domain or by country domains.

Learn more about how to develop an international SEO strategy.

Thus, if we have the web by subfolders according to regions or languages, we will include the sitemap in each subfolder, for example: www.myweb.com/en/sitemap.xml or in www.myweb.com/es-es/sitemap.xml, as we have explained in previous cases.

For example, in case you want to differentiate between English and Spanish sitemaps:

multilingual sitemap xml

What happens when I do a 301 or 302 redirect in the sitemap?

We make 301 redirects (permanent redirects) when we want to pass all the authority from one URL to another in a permanent way. On the other hand, 302 redirects are used when they are temporary. So… How do redirects affect the sitemap? Do we have to update it or is it done automatically?

To facilitate web crawling and indexing it is recommended that a sitemap only includes valid pages. So if we can avoid including redirected URLs it will be more understandable for the engines.

In general, with plugins installed these URL changes are updated automatically. Also, it will not be necessary to resubmit the sitemap in Google Search Console if the changes that have been made are punctual.

Are 404 pages included in the sitemap?

404 pages should never be included in an XML sitemap, it will not do us any good! And as we have said before, the sitemap should only include URLs that we want search engines to index. So having pages with 404 errors only hurts the visibility of our website, as well as the user experience.

In general, with plugins installed these URL changes are updated automatically. Also, it will not be necessary to resubmit the sitemap in Google Search Console if the changes that have been made are punctual.

error 404 principales errores seo

Will an XML sitemap index all the URLs of my website in Google?

An XML sitemap is a file that will help robots to understand the structure of the web site and thus facilitate crawling and indexing. Also, it does not mean that all the URLs that appear in the XML sitemap will be indexed. The pages must have quality content, be linked… In order to be indexed correctly in search engines, and not only included in the sitemaps.

ejemplo pagina no indexada sitemap xml

What happens if we have XML Sitemaps with more than 50,000 URLs?

El límite máximo de URLs por sitemap es de 50.000URLs. Por lo que… ¿Qué haremos si tenemos más? Tal y cómo indicaba la solución es generar más de un archivo sitemap por web. Los cuales puedes enviar individualmente mediante Google Search Console o crear un fichero índice de sitemaps, en el cual puedes incluir múltiples archivos de sitemaps. Entonces, será suficiente que en Google Search Console, solo envíes este índice.

The maximum limit of URLs per sitemap is 50,000URLs. So… What do we do if we have more? As Google pointed out the solution is to generate more than one sitemap file per website. You can submit them individually through Google Search Console or create a sitemap index file, in which you can include multiple sitemap files. Then, it will be enough that in Google Search Console, you only submit this index.

Should a canonical URL be included in the XML Sitemaps?

The canonicals tags (rel=”canonical”) define the home page of URLs with duplicate or very similar content. With these tags we will indicate the main version and, at the same time, we will set the pages with the canonical tag to “no index”. From here, to the answer to our question: should we include canonical URLs in the XML sitemap? No! Since, as we have commented, we are only interested in including crawlable URLs for the search engines.

Read more about the canonical tag in our blog: How to avoid duplicate content on a website?

In summary, in our XML sitemap we should include interesting content to be crawled, since we want it to be visible to users, as well as indexable pages with a 200 code. Pages with quality content that can help us to get organic traffic.

Would you like more information on how to create an XML Sitemap?

If you want more details on how to create an XML sitemap for your website correctly, please contact us using the form on the web page