Over a million developers have joined DZone.

Minimal Social Meta Tags for a Blog

DZone's Guide to

Minimal Social Meta Tags for a Blog

Learn how to factor out the repetition of meta tags when sharing a blog article on a social media site by modifying Open Graph protocol.

· Web Dev Zone
Free Resource

Learn how to build modern digital experience apps with Crafter CMS. Download this eBook now. Brought to you in partnership with Crafter Software

When someone shares your blog article on a social network, odds are it will appear with some descriptive text, images, and so on. If your blog lacks explicit instructions, in many cases these properties are just guessed-at and won’t be great.

I’ve seen a lot of blog authors and template creators go too far in the other direction and add tons of redundant meta tags, which will make the page larger, heavier, and slower.

What’s the minimal necessary set of tags?

Most social media networks recognize various types of meta properties. Unfortunately, there’s a lot of redundancy amongst them. Fortunately, most of them also fall back to an open standard called the Open Graph protocol, so you can factor out the repetition.

For most blogs, and for the most popular social media for sharing informative articles (Twitter, Facebook, Google+, and LinkedIn), you need the following properties:

<meta name="og:type" content="article" />
<meta name="og:title" content="{content title, without site title}" />
<meta name="og:url" content="{permalink}" />
<meta name="og:image" content="{featured image}" />
<meta name="og:description" content="{description < 200 chars}" />
<meta name="og:site_name" content="{site title}" />

Some of these might seem redundant, but for example the URL is required for some services. In addition, for Twitter you’ll need the following:

<meta name="twitter:card" content="{desired card type}" />
<meta name="twitter:site" content="{your @username}" />

With those eight meta tags you’re all set for most content-related sharing. Other social media services, such as Pinterest, have additional tags they require, and sometimes processes you need to follow to be whitelisted.

All of the social media services have a) documentation and b) validators to preview how things will appear. Here are documentation links:

In many cases your content-sharing instructions won’t be honored until you use the validator to check it. Checking triggers and re-scraping serves as a whitelisting process for several of the networks.

Crafter is a modern CMS platform for building modern websites and content-rich digital experiences. Download this eBook now. Brought to you in partnership with Crafter Software.

meta tags ,meta data ,blog

Published at DZone with permission of Baron Schwartz, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}