Seidor
manos ecribiendo en un ordenador

June 05, 2024

How to configure the Metatag module in Drupal 8

Meta tags may seem insignificant for a website, but they are highly relevant for SEO. The Metatag module in Drupal 8 helps us dynamically manage these meta tags interactively.

How to configure the Metatag module in Drupal 8?


With the Metatag module of Drupal 8, we can not only provide structured metadata but also customize meta tag elements. Meta elements are tags used in HTML or XHTML documents to provide structured metadata about a web page. They are part of the header section of a web page. Multiple Meta elements with different attributes can be used on the same page.

1) Configuration of the meta tags Drupal 8 for the homepage


After installing the module, we can edit the global settings at /admin/config/search/metatags and set the global configuration for the main page.

Here we will find the following fields:

  • Page Title: This snippet is not only useful for search engines but also for your users. It appears in the title bar of the web page and should not exceed 55 characters.
  • Descripción: Brief description of the website. It should not exceed 150 characters because search engines will not display more than that on the results page.
  • Abstract: Brief summary (optional). It should be less than 150 characters and as clearly descriptive as possible.
  • Palabras clave: Comma-separated list of keywords related to the website.
  • Robots: Normally, if you want to block or allow search engines to index a page or not allow search engines to show cached copies or descriptions of the page, you should edit the site's Robots.txt file. Here, you can control everything and more with the Robots meta tag by checking/unchecking the various indexing options it provides.
  • Palabras clave de noticias: Esta metaetiqueta es utilizada exclusivamente por Google News, ya que toma palabras clave separadas por comas como entradas.
  • Rights: Any details about copyright or trademarks should go here.
  • Imagen: This is also relatively new and can be useful to tell social media which image they should use with a post.
  • URL canónica: Las URL canónicas son muy útiles para tratar problemas de contenido duplicado. Esto es algo que suele ser un problema en los sitios de comercio electrónico donde las listas de productos están duplicadas en varias páginas. Metatag hace un buen trabajo manejando esto por defecto.
  • URL de enlace corto: Este elemento actúa como una alternativa a los acortadores de enlaces. En Drupal suelen ser así: <link rel = "shortlink" href = "https://www.drauta.com/blogs/node/11" />
  • Fuente original: Esta etiqueta también es algo que se le ocurrió a Google, esta vez para ayudar a identificar la fuente original del contenido. Este puede ser particularmente útil para los sitios de noticias, pero la mayoría puede ignorarlo.


2) Configuration of meta tags in Drupal 8 for a content type


Global configurations must be edited at /admin/config/search/metatags in the global Content configuration. If you want to add different meta tags for different content types, click on the "Agregar metaetiquetas predeterminadas" link in the upper left corner of the page. Select the content type to which you want to add a meta tag and click Save and configure.

3) Configure the meta tags of Drupal 8 for the display pages


Enable the "metatag: views" module, which is a submodule of the metaetiqueta module.

Edit the global settings at /admin/config/search/metatags. To add the meta tags to the view, go to the view edit screen and click on the meta tags link.

Maybe it might interest you

June 05, 2024

Translations of paragraphs in Drupal 8

Today we are doing a small tutorial to learn how to apply our translations to the paragraphs of our website in Drupal 8.

SEIDOR
June 05, 2024

Drupal Modules: Computed Fields, Fast Permission

Today we present a couple of Drupal modules that allow us to create and manage calculated fields for our content type.

SEIDOR
June 05, 2024

Licenses for free image use

When we create a new web project, we need images to make it more attractive. On many occasions, we have to opt for existing resources, but we must be careful with the rights and licenses of the images.

SEIDOR