Drupal 8: Workaround for using Metatags in Paragraphs Blocks driven pages

I have a Content Type called a Full Page, which can accommodate paragraphs of views, custom, and all sorts of blocks for layout flexibility

The issue is we seem to do not have a way or any available feature both from the Metatag modules nor Paragraph module to easily insert meta tags in a straight-forward way

Solution 1: (Partially-Solved)

Created a Paragraph Type, called it Metatag Block, included a field type called e.g. Metatag Block Text, text long

Edited the Content Type where I have the Paragraphs as Entity References, updated it to the new paragraph type Metatag Block, saved

Going back to a Full Page content item, I can now insert a Metatag Block which has a field for a text, goodie to control the length of the meta description for example.

The problem is I do not seem to have a way to hide that from the public/source display since it is part of the paragraphs field. CSS display none to hide the field can be used.

Another problem is, I thought going back to the Metatag module settings, I can add the tags assigned to a token for the paragraph metatag block but the token list is not showing anything, got stuck here. There seems to be a module for this https://www.drupal.org/project/paragraphs_summary_token, but could not seem to figure out how this works and helps.

Solution 2: Solved

Got the same content type: Full Page, with the same content items for this. Since I do not seem to have a use for the node's default Body field, and since I am heavily using paragraph blocks for both content and layout, resorted to using the body field as a placeholder for the meta tag description. In manage display, set this to hidden so it will not display publicly.

Going back to the Metatag module settings, I created a setting for the content type, and assigned the body token to the basic meta tags, OG tags, etc.

Done. Whew! This is Drupal on a good day @@

 

By: Jerome Esperanza
In:
Jerome Esperanza's picture
Jerome Esperanza

Let us help you create a practical and winning marketing strategy to boost a cost-effective online presence and search visibility here. WebMedia is a digital marketing agency in Metro Manila, Philippines with a seasoned team of experts and specialists. We specialize in web design, development, Google and general search optimization (SEO), and online marketing in general.

Leave a Comment

All fields with * are required.

Get in touch with us!

Telephone: (+63 2) 7625-6994
Mobile: (Globe) +63 945 217-3344
E-mail: info@webmedia.com.ph

start typing and press enter to search