How to Add Metatags to Headless Drupal: Dropsolid’s Guide

Dropsolid has published a new blog post on how to add metatags to the headless Drupal project. This article explains how to add meta tags to a headless Drupal project for better SEO and social media sharing. Dropsolid's guide is for Drupal sites already set up with the latest Rocketship install profile or similar version and has a Next.js website that gets its data for a node page from JSON:API.

The article explains how to expose metatag data and generate the structure for the metadata by adding a computed field to certain entities called metatag_computed using a patch and a normalizer. It also explains how to rebuild the cache in Drupal after applying the patch.

The article then shows how to add a Head component to the Next.js component with the entity data and create a separate component named EntityMetatags that takes an array of meta tags as input. The article also discusses some considerations when implementing this, such as using the Server side rendering mode for better SEO and showing the domain of the Next.js application instead of the Drupal application.

Overall, the article provides a clear and concise guide to adding meta tags to a headless Drupal project, which can improve SEO and social media sharing. Click here to read the article.

Note: The vision of this web portal is to help promote news and stories around the Drupal community and promote and celebrate the people and organizations in the community. We strive to create and distribute our content based on these content policy. If you see any omission/variation on this please let us know in the comments below and we will try to address the issue as best we can.

Related Organizations

Advertisement Here

Upcoming Events

Latest Opportunities

Advertisement Here