stevegrunwell/schemify

View on GitHub
readme.txt

Summary

Maintainability
Test Coverage
=== Plugin Name ===
Contributors: stevegrunwell
Tags: structured data, schema, json-ld
Requires at least: 4.7
Tested up to: 4.7.2
Stable tag: 0.1.0
License: MIT
License URI: https://opensource.org/licenses/MIT

Automatically generate Schema.org JSON-LD markup for WordPress content.


== Description ==

Structured data allows developers and publishers to mark up content in a way that it's easy for machines to understand. Proper use of structured data [enables third-parties like Google to parse reviews, event data, and contact information in meaningful ways](https://developers.google.com/search/docs/guides/intro-structured-data), ensuring you're getting the most "bang" out of your publishing buck.

Fortunately, the major players in the Search game, including Google, Microsoft, Yahoo!, and Yandex) came together in the early 2010s to form [Schema.org](http://schema.org/docs/about.html), a collaborative, community-driven standard for structured data.

With the major search engines and communities behind it, we're all marking up everything with appropriate structured data now, right?

Unfortunately, the process of implementing Schema.org in a site — especially one driven by dynamic content — is less than straightforward. [WordPress](https://wordpress.org), for instance, [powers roughly a quarter of the web](https://ma.tt/2015/11/seventy-five-to-go/), but implementing structured data across hundreds of thousands of themes would be a nightmare.

Or, at least it would be, if it weren't for Schemify.


= What does Schemify do? =

There are two approaches to adding structured data to a website: via the markup or [JSON for Linking Data (JSON-LD)](http://json-ld.org/).

Consider the following author information, which might appear at the bottom of a blog post:

        <div class="author">
            <img src="http://en.gravatar.com/avatar/88ea4e10ed968136228545d7112d82cb?s=200" alt="Steve Grunwell" />
            <h2><a href="https://stevegrunwell.com" rel="author">Steve Grunwell</a></h2>
            <p>Steve is the Director of Technology at Growella. When he's not working, you can find him speaking at conferences, roasting coffee, or spending time with his wife and daughter</p>
        </div>

If I wanted this information to use Schema.org markup, it would look something like this:

        <div class="author" itemscope itemtype="http://schema.org/Person">
            <img src="http://en.gravatar.com/avatar/88ea4e10ed968136228545d7112d82cb?s=200" alt="Steve Grunwell" itemprop="image" />
            <h2 itemprop="name"><a href="https://stevegrunwell.com" rel="author" itemprop="url">Steve Grunwell</a></h2>
            <p itemprop="description">Steve is the Director of Technology at Growella. When he's not working, you can find him speaking at conferences, roasting coffee, or spending time with his wife and daughter</p>
        </div>

While that may not _seem_ like a lot of work, that's still a lot of extra markup being added. Even worse, a lot of that markup might normally be generated by WordPress helper functions like [`get_avatar()`](https://developer.wordpress.org/reference/functions/get_avatar/), which means extra work to get the necessary `itemprop` attribute in place.

Fortunately, the other approach for adding structured data is much more straight-forward in a theme, as it's simply a JSON-LD object:

        <script type="application/ld+json">
        {
            "@context": "http://schema.org",
            "@type": "Person",
            "name": "Steve Grunwell",
            "url": "https://stevegrunwell.com",
            "image": "http://en.gravatar.com/avatar/88ea4e10ed968136228545d7112d82cb?s=200",
            "description": "Steve is the Director of Technology at Growella. When he's not working, you can find him speaking at conferences, roasting coffee, or spending time with his wife and daughter"
        }
        </script>

We simply generate this JSON-LD object and append it to our document's `<body>`. When Google or anyone else who supports JSON-LD structured data parses our page, they can immediately understand that Steve Grunwell is a person and determine his website, avatar, and biography.

The best part? There's no need to change the markup within our theme!

**Schemify aims to automate the generation of JSON-LD objects for content within WordPress.** Its flexible structure and reasonable defaults enables drop-in support for structured data, regardless of the WordPress theme.


== Installation ==

After uploading Schemify to your WordPress instance, activate it via the Plugins screen in wp-admin.


== Changelog ==

= 0.1.0 =
* Initial public release.