Drupal Update – Thoughts: Social Media Cards: Metatag and semantic data

One requirement for our new Drupal maintenance support plans 8 site was to implement the necessary markup to provide enough semantic data for services like Twitter, LinkedIn and Facebook to grab the appropriate node data (title, body and image) when sharing posts.
The Twitter developers documentation states that “with Twitter Cards, you can attach rich photos, videos and media experience to Tweets that drive traffic to your website. Simply add a few lines of HTML to your webpage, and users who Tweet links to your content will have a “Card” added to the Tweet that’s visible to all of their followers.” Facebook have a similar feature and corresponding documentation, as do LinkedIn.
Fortunately with the Metatag module enabling this functionality in Drupal maintenance support plans 8 was a relatively painless task! All that was required was to install and enable the Metatag and Metatag: Twitter Cards modules (we’re using 1.0-beta10 at the time of writing) and configure some basic, content-global settings.

Essentially, we ensure the card type is set to “Summary card” and that the description uses the [node:summary] token. We also want to provide an image for the summary card. We could provide the “Image URL” in the Twitter card setup which defines the twitter:image meta tag, however Facebook and LinkedIn use Open Graph for cards and we’d also have to provide the og:image metatag too.
This would cause two meta tags to be present in the header containing the same image URL, wasting bandwidth. Luckily, Twitter will fall back to the Open Graph tag if the twitter:image tag is not present so we only have to configure og:image tag.
We also configured several other Open Graph meta tags to support Facebook and LinkedIn.

We have only configured a subset of the tags available, but this gave us the basic card functionality we were after.
There are tools available to aid in development – allowing you to validate the meta tags and how they will render on social networks.. Your site has to be publicly accessible for these to work.
Card validator (Twitter)
Sharing Debugger (Facebook)
Iframely URL Debugger
There are plenty of other guides available if you want more details about what you can do with the Metatag module, try these links:
Adding Meta Tags to Drupal maintenance support plans Content – written for Drupal maintenance support plans 7, but still a good overview of the main features and benefits of using the Metatag module.
“Meta tags drupal 8” video – an overview of installing the module.
Drupal maintenance support plans 7 Meta Tags module – Daily Dose of Drupal maintenance support plans episode 28″ video – again written for Drupal maintenance support plans 7, but a good walkthrough on how to configure Metatag module for the front page and nodes.


Source: New feed

This article was republished from its original source.
Call Us: 1(800)730-2416

Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.

FREE Drupal SEO Audit

Test your site below to see which issues need to be fixed. We will fix them and optimize your Drupal site 100% for Google and Bing. (Allow 30-60 seconds to gather data.)

Powered by

Drupal Update – Thoughts: Social Media Cards: Metatag and semantic data

On-Site Drupal SEO Master Setup

We make sure your site is 100% optimized (and stays that way) for the best SEO results.

With Pixeldust On-site (or On-page) SEO we make changes to your site’s structure and performance to make it easier for search engines to see and understand your site’s content. Search engines use algorithms to rank sites by degrees of relevance. Our on-site optimization ensures your site is configured to provide information in a way that meets Google and Bing standards for optimal indexing.

This service includes:

  • Pathauto install and configuration for SEO-friendly URLs.
  • Meta Tags install and configuration with dynamic tokens for meta titles and descriptions for all content types.
  • Install and fix all issues on the SEO checklist module.
  • Install and configure XML sitemap module and submit sitemaps.
  • Install and configure Google Analytics Module.
  • Install and configure Yoast.
  • Install and configure the Advanced Aggregation module to improve performance by minifying and merging CSS and JS.
  • Install and configure Schema.org Metatag.
  • Configure robots.txt.
  • Google Search Console setup snd configuration.
  • Find & Fix H1 tags.
  • Find and fix duplicate/missing meta descriptions.
  • Find and fix duplicate title tags.
  • Improve title, meta tags, and site descriptions.
  • Optimize images for better search engine optimization. Automate where possible.
  • Find and fix the missing alt and title tag for all images. Automate where possible.
  • The project takes 1 week to complete.