> Faqs > Como crear un sitemap.xml para una web en 2 idiomas

Como crear un sitemap.xml para una web en 2 idiomas

Hola a todo el foro, tengo una web en 2 idiomas, que cambio el idioma, con el sistema de parametros en la url. (Si el parametro de la url esta vacia, quiero que el idioma sea ingles)

La cuestion, es que Google me dice que tengo errores de contenido duplicado, y que tengo que corregir el sitemap.

Al final del texto, hay las etiquetas canonical en el <head> de cada web ( index.php y services.php )

Hace poco, tambien he incluido el sitemap.xml en el archivo robots.txt , ya que lo vi como recomendacion.

He mirado de crear el sitemap con la IA, pero cada vez me da ejemplos diferentes, y no se cual es el correcto.

El sitemap que tengo actualmente es el siguiente, para index.php y services.php ....................

Muchas gracias por adelantado a todo el foro

<?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">
        
    <!-- ==================== INICIO / HOME ==================== -->
    <!-- Inglés -->
    <url>
        <loc>https://computronic-web.es/</loc>
        <lastmod>2025-04-11</lastmod>
        <changefreq>weekly</changefreq>
        <priority>1.0</priority>
        <xhtml:link rel="alternate" hreflang="en" href="https://computronic-web.es/"/>
        <xhtml:link rel="alternate" hreflang="es" href="https://computronic-web.es/?la=esp"/>
        <xhtml:link rel="alternate" hreflang="x-default" href="https://computronic-web.es/"/>
    </url>
    <!-- Español -->
    <url>
        <loc>https://computronic-web.es/?la=esp</loc>
        <lastmod>2025-04-11</lastmod>
        <changefreq>weekly</changefreq>
        <priority>0.9</priority>
        <xhtml:link rel="alternate" hreflang="en" href="https://computronic-web.es/"/>
        <xhtml:link rel="alternate" hreflang="es" href="https://computronic-web.es/?la=esp"/>
        <xhtml:link rel="alternate" hreflang="x-default" href="https://computronic-web.es/"/>
    </url>

    <!-- ==================== SERVICIOS ==================== -->
    
    /////////AQUI, TAMBIEN PUSE EL PARAMETRO ?la=eng PARA HACER PRUEBAS, QUE NO SE SI DEBE PONERSE O NO.
    
    <url>
        <loc>https://computronic-web.es/services.php</loc>
        <lastmod>2025-04-11</lastmod>
        <changefreq>monthly</changefreq>
        <priority>0.8</priority>
        <xhtml:link rel="alternate" hreflang="en" href="https://computronic-web.es/services.php"/>
        <xhtml:link rel="alternate" hreflang="es" href="https://computronic-web.es/services.php?la=esp"/>
        <xhtml:link rel="alternate" hreflang="x-default" href="https://computronic-web.es/services.php"/>
    </url>
    <url>
        <loc>https://computronic-web.es/services.php?la=eng</loc>
        <lastmod>2025-04-11</lastmod>
        <changefreq>monthly</changefreq>
        <priority>0.7</priority>
        <xhtml:link rel="alternate" hreflang="en" href="https://computronic-web.es/services.php"/>
        <xhtml:link rel="alternate" hreflang="es" href="https://computronic-web.es/services.php?la=esp"/>
        <xhtml:link rel="alternate" hreflang="x-default" href="https://computronic-web.es/services.php"/>
    </url>
    <url>
        <loc>https://computronic-web.es/services.php?la=esp</loc>
        <lastmod>2025-04-11</lastmod>
        <changefreq>monthly</changefreq>
        <priority>0.7</priority>
        <xhtml:link rel="alternate" hreflang="en" href="https://computronic-web.es/services.php"/>
        <xhtml:link rel="alternate" hreflang="es" href="https://computronic-web.es/services.php?la=esp"/>
        <xhtml:link rel="alternate" hreflang="x-default" href="https://computronic-web.es/services.php"/>
    </url>

</urlset>


//////////////// Index.php ////////////////


<!DOCTYPE html>
<html lang="<?=$lang['html-lang'];?>">   <------- antes era <html lang="es"> , pero ahora lo selecciona con php
<head>

  <title>CompuTronic</title>
  
  <link rel="canonical" href="https://computronic-web.es/?la=esp" />    <----- El "la=esp" no se si es correcto
  
</head>

//////////////// Services.php ////////////////


<!DOCTYPE html>
<html lang="<?=$lang['html-lang'];?>">   <------- antes era <html lang="es"> , pero ahora lo selecciona con php
<head>

  <title>CompuTronic - Services</title>

  <link rel="canonical" href="https://computronic-web.es/services.php?la=esp" />     <----- El "la=esp" no se si es correcto
  
</head>

Respuestas

Todavía no se han recibido respuestas a esta pregunta. ¿Quieres enviar la primera?