How to implement JSON-LD Schema for your blog

Lucian GhindaLucian Ghinda
5 min read

I will concentrate on how to implement JSON-LD schema for your blog; however, you can apply the examples here to enhance your product or service website.

What is JSON-LD?

JSON-LD stands for JavaScript Object Notation for Linked Data. One use is adding it to web pages, allowing search engines or crawlers to understand the content structure and context better.

It is usually added in the <head> html element like this:

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "WebSite",
  "url": "http://example.com/"
}
</script>

Why use JSON-LD Schema in your blog

  • Your content may show up as rich snippets in search results.

  • Helps search engines to understand the data related to your blog post as you intend and with the required context.

  • It may help AI to get structured data about the context of your blog post.

  • Around 30% (source: searchenginejournal.com) of websites are using JSON-JD schema and adding it will improve your SEO results.

  • When adding sameAs attribute for your author it might improve your presence online

But there are better blog posts that describes why is good to add JSON-LD schema:

Here is a screenshot from https://www.semrush.com/blog/schema-markup:

Screenshot about why JSON-LD schema is important

Google also recommends using JSON-LD schema:

https://developers.google.com/search/docs/appearance/structured-data/intro-structured-data#supported-formats

Adding a JSON-LD schema for every page

We should start by adding a schema for every page on your blog. https://schema.org/WebSite is a schema specification that you should add on every page of your blog (remember this should be inside <script type="application/ld+json"> but to make the code highlight nicer I will only show the JSON part)

{
  "@context": "https://schema.org",
  "@type": "WebSite",
  "name": "Lucian Ghinda - Notes",
  "url": "https://allaboutcoding.ghinda.com",
  "author": {
    "@type": "Person",
    "name": "Lucian Ghinda",
  }
}

Add `url` to the author

Including an url in the author section helps identify the author's page on your website and aids search engines in recognizing the author's presence on your site, which could enhance the visibility of their content:

{
  // the other JSON-LD keys
  "author": {
    "@type": "Person",
    "name": "Lucian Ghinda",
+    "url": "https://allaboutcoding.ghinda.com/authors/lucian-ghinda"
  }
}

Add `sameAs` if you want to connect your website with other places

Utilize sameAs to show that two entities are fundamentally identical. Within the context of an author section, it links the author's profile on your website to their profiles on other platforms, such as social media or other locations where you maintain a page:

{
  // the other JSON-LD keys
  "author": {
    "@type": "Person",
    "name": "Lucian Ghinda",
    "url": "https://allaboutcoding.ghinda.com/authors/lucian-ghinda",
+    "sameAs": [
+      "https://bsky.app/profile/lucianghinda.com",
+      "https://www.linkedin.com/in/lucianghinda"
+    ]
  }
}
{
  "@context": "https://schema.org",
  "@type": "WebSite",
  "name": "Lucian Ghinda - Notes",
  "url": "https://allaboutcoding.ghinda.com",
  "author": {
    "@type": "Person",
    "name": "Lucian Ghinda",
    "sameAs": [
       "https://bsky.app/profile/lucianghinda.com",
        "https://www.linkedin.com/in/lucianghinda"
    ]
  }
}

JSON-LD Schema for inside the blog post / article

You can add multiple JSON-LD script tags in your website. You should keep the main one that is about WebSite and add inside the blog posts one about `BlogPosting` - https://schema.org/BlogPosting

<script type="application/ld+json">
{ 
  "@context": "https://schema.org",
  "@type": "BlogPosting",
  "mainEntityOfPage": {
    "@type": "WebPage",
    "@id": "https://allaboutcoding.ghinda.com/post-url"
  },
  "headline": "Why add JSON+LD to your blogpost",
  "datePublished": "2025-03-11T13:22:00+02:00",
  "dateModified": "2025-03-11T14:30:00+02:00",
}
</script>

A bit about datePublished and dateModified

Values for these two fields can be Date or DateTime. Choose one that fits you bets or that you can generate easily.

In case you usually don't update your articles, then only add `datePublished`


{ 
  "@context": "https://schema.org",
  "@type": "BlogPosting",
  "mainEntityOfPage": {
    "@type": "WebPage",
    "@id": "https://allaboutcoding.ghinda.com/post-url"
  },
  "headline": "Why add JSON+LD to your blogpost",
+  "datePublished": "2025-03-11T13:22:00+02:00",
+  "dateModified": "2025-03-11T14:30:00+02:00"
}

Then add author

You can use the same snippet as you used in the WebSite schema:

{
  // the other JSON-LD keys
  "author": {
    "@type": "Person",
    "name": "Lucian Ghinda",
    "url": "https://allaboutcoding.ghinda.com/authors/lucian-ghinda",
    "sameAs": [
      "https://bsky.app/profile/lucianghinda.com",
      "https://www.linkedin.com/in/lucianghinda"
    ]
  }
}

If you have multiple authors, then make the "author" key an array:

{
  // the other JSON-LD keys
  "author": [
    { 
      "@type": "Person", 
      "name": "Lucian Ghinda",
      // other attributes
    },  
    { 
      "@type": "Organization", 
      "name": "Short Ruby",
      // other attributes
    }  
  ]
}

JSON-LD Schema for a blog post - add publisher

The publisher key identifies the publisher of the creative work. If you have your own blog, you can list yourself as the publisher. However, if you're writing for an organization, make sure to include the organization's name instead:

{
  // the other JSON-LD keys
  "publisher": {
    "@type": "Organization",
    "name": "Short Ruby",
    "logo": {
      "@type": "ImageObject",
      "url": "https://shortruby.com/assets/logo-d8627cb3e82564f3328709589c3c1ce34b81d0afed316a0b58d27ab93bcaa9d4.png"
    }
  },
}

The final JSON-LD for the blog post

Here is how the JSON-LD schema for a blog post might look like:

{ 
  "@context": "https://schema.org",
  "@type": "BlogPosting",
  "mainEntityOfPage": {
    "@type": "WebPage",
    "@id": "https://allaboutcoding.ghinda.com/post-url"
  },
  "headline": "Why add JSON+LD to your blogpost",
  "datePublished": "2025-03-11T13:22:00+02:00",
  "dateModified": "2025-03-11T14:30:00+02:00",
  "author": {
    "@type": "Person",
    "name": "Lucian Ghinda",
    "url": "https://allaboutcoding.ghinda.com/authors/lucian-ghinda",
    "sameAs": [
      "https://bsky.app/profile/lucianghinda.com",
      "https://www.linkedin.com/in/lucianghinda"
    ]
  },
  "publisher": {
    "@type": "Organization",
    "name": "Short Ruby",
    "logo": {
      "@type": "ImageObject",
      "url": "https://www.exampleblog.com/logo.png"
    }
  }
}

Tools

There are many more variations of how to combine various items and this way communicate to a crawler or search engine what you want them to know about your blog.

Here are some tools you can use to validate your JSON-LD schema and check how Google parses rich snippets:

https://search.google.com/test/rich-results

https://validator.schema.org


If you like this article:

๐Ÿ‘ Interested in learning how to improve your developer testing skills? Join my live online workshop about goodenoughtesting.com - to learn test design techniques for writing effective tests

๐Ÿ‘‰ Join my Short Ruby Newsletter for weekly Ruby updates from the community and visit rubyandrails.info, a directory with learning content about Ruby.

๐Ÿค Let's connect on Bluesky, Ruby.social, Linkedin, Twitter where I post mostly about Ruby and Ruby on Rails.

๐ŸŽฅ Follow me on my YouTube channel for short videos about Ruby/Rails

0
Subscribe to my newsletter

Read articles from Lucian Ghinda directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Lucian Ghinda
Lucian Ghinda

Senior Product Engineer, working in Ruby and Rails. Passionate about idea generation, creativity, and programming. I curate the Short Ruby Newsletter.