Core Sitemaps

Descripción

Note: This feature has been integrated into WordPress 5.5. If you run WordPress 5.5, you can freely disable this plugin.

Como se propuso originalmente en junio de 2019, este plugin de características busca integrar la funcionalidad básica de mapas del sitio XML en el núcleo de WordPress.

Puedes encontrar una explicación corta de cómo funciona este plugin plugin en esta entrada del blog del núcleo en «make».

¿Interesado(a) en colaborar con este plugin? No dudes en unírtenos en GitHub y en el canal #core-sitemaps de Slack.

Available Hooks and Filters

General:

  • wp_sitemaps_enabled – Filters whether XML Sitemaps are enabled or not.
  • wp_sitemaps_max_urls – Filters the maximum number of URLs displayed on a sitemap.
  • wp_sitemaps_register_providers – Filters the list of registered sitemap providers.
  • wp_sitemaps_init – Fires when initializing sitemaps.
  • wp_sitemaps_index_entry – Filters the sitemap entry for the sitemap index.

Providers:

  • wp_sitemaps_post_types – Filters the list of post types to include in the sitemaps.
  • wp_sitemaps_posts_entry – Filters the sitemap entry for an individual post.
  • wp_sitemaps_posts_show_on_front_entry – Filters the sitemap entry for the home page when the ‘show_on_front’ option equals ‘posts’.
  • wp_sitemaps_posts_query_args – Filters the query arguments for post type sitemap queries.
  • wp_sitemaps_posts_pre_url_list – Filters the posts URL list before it is generated (short-circuit).
  • wp_sitemaps_posts_pre_max_num_pages – Filters the max number of pages before it is generated (short-circuit).
  • wp_sitemaps_taxonomies – Filters the list of taxonomies to include in the sitemaps.
  • wp_sitemaps_taxonomies_entry – Filters the sitemap entry for an individual term.
  • wp_sitemaps_taxonomies_query_args – Filters the query arguments for taxonomy terms sitemap queries.
  • wp_sitemaps_taxonomies_pre_url_list – Filters the taxonomies URL list before it is generated (short-circuit).
  • wp_sitemaps_taxonomies_pre_max_num_pages – Filters the max number of pages before it is generated (short-circuit).
  • wp_sitemaps_users_entry – Filters the sitemap entry for an individual user.
  • wp_sitemaps_users_query_args – Filters the query arguments for user sitemap queries.
  • wp_sitemaps_users_pre_url_list – Filters the users URL list before it is generated (short-circuit).
  • wp_sitemaps_users_pre_max_num_pages – Filters the max number of pages before it is generated (short-circuit).

Stylesheets:

  • wp_sitemaps_stylesheet_css – Filters the CSS for the sitemap stylesheet.
  • wp_sitemaps_stylesheet_url – Filters the URL for the sitemap stylesheet.
  • wp_sitemaps_stylesheet_content – Filters the content of the sitemap stylesheet.
  • wp_sitemaps_stylesheet_index_url – Filters the URL for the sitemap index stylesheet.
  • wp_sitemaps_stylesheet_index_content – Filters the content of the sitemap index stylesheet.

Instalación

Instalación desde WordPress

  1. Visita Plugins > Añadir nuevo.
  2. Busca Core Sitemaps.
  3. Instala y activa el plugin «Core Sitemaps».

Instalación manual

  1. Sube toda la carpeta core-sitemaps al directorio /wp-content/plugins/.
  2. Visita Plugins.
  3. Activa el plugin «Core Sitemaps»

Preguntas frecuentes

¿Cómo puedo desactivar completamente la generación del mapa del sitio?

If you update the WordPress settings to discourage search engines from indexing your site, sitemaps will be disabled.
Alternatively, use the wp_sitemaps_enabled filter, or use remove_action( 'init', 'wp_sitemaps_get_server' ); to disable initialization of any sitemap functionality.

¿Cómo puedo desactivar los mapas del sitio en cierto tipo de objeto?

You can use the wp_sitemaps_register_providers filter to disable sitemap generation for posts, users, or taxonomies.

¿Cómo puedo desactivar los mapas del sitio en determinado tipo de contenido o categoría?

You can use the wp_sitemaps_post_types filter to disable sitemap generation for posts of a certain post type.

Por defecto, solo las entradas públicas serán representadas en el mapa del sitio.

Similarly, the wp_sitemaps_taxonomies filter can be used to disable sitemap generation for certain taxonomies.

Ejemplo: Desactivar los mapas del sitio para el tipo de contenido «page»

add_filter(
    'wp_sitemaps_post_types',
    function( $post_types ) {
        unset( $post_types['page'] );
        return $post_types;
    }
);

Ejemplo: Desactivar los mapas del sitio para la taxonomía «post_tag»

add_filter(
    'wp_sitemaps_taxonomies',
    function( $taxonomies ) {
        unset( $taxonomies['post_tag'] );
        return $taxonomies;
    }
);

¿Cómo puedo excluir ciertas entradas / taxonomías / usuarios del mapa del sitio o añadir otras personalizadas?

The wp_sitemaps_posts_query_args, wp_sitemaps_taxonomies_query_args, and wp_sitemaps_users_query_args filters can be used to modify the underlying queries. Using these queries, certain items can be excluded.

Ejemplo: Asegurar que la página con ID 42 no está incluida

add_filter(
    'wp_sitemaps_posts_query_args',
    function( $args ) {
        $args['post__not_in'] = isset( $args['post__not_in'] ) ? $args['post__not_in'] : array();
        $args['post__not_in'][] = 42;
        return $args;
    }
);

Example: Ensuring the category with ID 7 is not included

add_filter(
    'wp_sitemaps_taxonomies_query_args',
    function( $args ) {
        $args['exclude'] = isset( $args['exclude'] ) ? $args['exclude'] : array();
        $args['exclude'][] = 7;
        return $args;
    }
);

Ejemplo: Asegurar que el usuario con ID 1 no está incluido

add_filter(
    'wp_sitemaps_users_query_args',
    function( $args ) {
        $args['exclude'] = isset( $args['exclude'] ) ? $args['exclude'] : array();
        $args['exclude'][] = 1;
        return $args;
    }
);

How can I add `changefreq`, `priority`, or `lastmod` to a sitemap?

You can use the wp_sitemaps_posts_entry / wp_sitemaps_users_entry / wp_sitemaps_taxonomies_entry filters to add additional attributes like changefreq, priority, or lastmod to single item in the sitemap.

Example: Adding the last modified date for posts

add_filter(
    'wp_sitemaps_posts_entry',
    function( $entry, $post ) {
        $entry['lastmod'] = $post->post_modified_gmt;
        return $entry;
    },
    10,
    2
);

Similarly, you can use the wp_sitemaps_index_entry filter to add lastmod on the sitemap index. Note: changefreq and priority are not supported on the sitemap index.

How can I add image sitemaps?

Adding image sitemaps are not supported yet, but support will be added in the future so that plugin developers can add them if needed.

¿Cómo puedo cambiar el número de URL por mapa del sitio?

Use the wp_sitemaps_max_urls filter to adjust the maximum number of URLs included in a sitemap. The default value is 2000 URLs.

¿Cómo puedo cambiar la apariencia de los mapas del sitio XML en el navegador usando XSL?

Existe una variedad de filtros para permitirte ajustar los estilos:

  • wp_sitemaps_stylesheet_url – Filter the URL for the sitemap stylesheet.
  • wp_sitemaps_stylesheet_index_url – Filter the URL for the sitemap index stylesheet.
  • wp_sitemaps_stylesheet_content – Filter the content of the sitemap stylesheet.
  • wp_sitemaps_index_stylesheet_content – Filter the content of the sitemap index stylesheet.
  • wp_sitemaps_stylesheet_css – Filter the CSS only for the sitemap stylesheet.

¿Este plugin es compatible con los atributos `changefreq` y `priority` para mapas del sitio?

No. Esos son campos opcionales en el protocolo de los mapas del sitio y no suelen ser consumidos por los motores de búsqueda. Los desarrolladores aún pueden añadir esos campos si realmente lo desean.

¿Por qué no se muestra en el mapa del sitio la fecha de última modificación?

Los mapas del sitio XML son el primer y principal mecanismo para descubrir contenido. En la mayoría de los sitios, no es necesario mostrar la fecha en la que el contenido fue modificado por última vez.

Reseñas

Leer todas las 5 reseñas

Colaboradores y desarrolladores

Este software es de código abierto. Las siguientes personas han contribuido a este plugin.

Colaboradores

"Core Sitemaps" ha sido traducido a 15 idiomas locales. Gracias a los traductores por sus contribuciones.

Traduce "Core Sitemaps" a tu idioma.

¿Interesado en el desarrollo?

Revisa el código, echa un vistazo al repositorio SVN o suscríbete al registro de desarrollo por RSS.

Registro de cambios

Para ver el registro de cambios del plugin, por favor, échale un vistazo a la lista completa de cambios en GitHub.