Using LD+JSON Schema to Enhance SEO for Blog Posts

Schema markup helps search engines understand your content by describing its primary purpose, in a machine-friendly way. The most recent, and in my opinion, the easiest to maintain, is ld+json, which is contained in a script tag, proving the search engines with the key data.

What does ld+json markup look like?

The best way to explain what ld+json markup looks like is with example code, based on the Article type. Below is the code for this post:

<script type="application/ld+json">
        "@context": "",
        "@type": "BlogPosting",
        "headline": "<?php the_title(); ?>",
        "datePublished": "<?php echo get_the_date(); ?>",
        <?php if (has_post_thumbnail()) : ?>
            "image": {
                "@type": "ImageObject",
                "url": "<?php the_post_thumbnail_url() ?>"
        <?php endif; ?>
        "description" : "<?php the_excerpt(); ?>"

As you can see, this is super easy, so get marking up! But you may want to double-check that your post have excerpts, otherwise description will be empty. One easy way to over come this is to use WordPress’s wp_trim_excert() to create an excerpt from the post’s content. Feel free to get in touch if you would a helping hand, as we’re seasoned WordPress developers.


2 thoughts on “Using LD+JSON Schema to Enhance SEO for Blog Posts”