Skip to content

Automated Structured Data

Structured data is an important SEO tool that helps search engines better understand, categorize, and make sense of the content you publish. It’s also a crucial piece for getting your content to appear as rich results — something that can dramatically impact your site’s engagement metrics.

That’s why JamComments will automatically build and embed structured data for the comments on your site, even integrating it with your existing “BlogPost” or “Article” entities.

Two Approachs to Automated Structured Data

In order to balance ease of configuration with robustness, JamComments takes two approaches to building & embedding structured data: client-side and server-rendered.

The Client-Side Approach

By default, JamComments will embed data for your comments with client-side JavaScript. This allows us to easily merge that data into your existing JSON-LD without you needing to configure anything. The plugin you’re using will automatically generate the data, find the nearest “BlogPost” or “Article” entity on the page, and merge it in. No work necessary, and it works in every integration.

The Server-Side Approach

Using JavaScript to embed this data is fully recognized and documented by Google. However if you’d like to maximize the accessibility of the data for other web crawlers that may not support JavaScript rendering, you can also have the JSON server-rendered.

This feature is currently only supported in the Astro integration, but will soon be rolled out to all others as well. It just requires you to give your page schema to the <JamComments schema={yourSchema}> component, rather than rendering it yourself. Your comment data will be build and merged, and then the data will be built into the page’s HTML. For more information on this approach, see the Astro integration docs.

A Glimpse of the Result

Regardless of the approach you take, here’s an example of what you’ll see after your site is built:

<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BlogPosting",
"datePublished": "2024-04-03T20:44:05.000-05:00",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "https://macarthur.me/posts/my-blog-post"
},
"headline": "My Blog Post",
"description": "My post's description.",
"image": "https://images.unsplash.com/photo-1478860409698-8707f313ee8b?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8c2VhcmNofDJ8fG1hcHxlbnwwfHx8fDE3MTIwNDE1Nzd8MA&ixlib=rb-4.0.3&q=80&w=2000",
"author": {
"@type": "Person",
"name": "Alex MacArthur",
"url": "https://macarthur.me"
},
"dateModified": "2024-04-04T14:04:42.000-05:00",
"comment": [
{
"@context": "https://schema.org",
"@type": "Comment",
"name": "Alex MacArthur",
"dateCreated": "2024-05-12T06:25:37+00:00",
"text": "Wow, great stuff!",
"discussionUrl": "https://macarthur.me/posts/my-blog-post",
"url": "https://macarthur.me/posts/my-blog-post#comment-528",
"author": {
"@type": "Person",
"name": "Alex MacArthur",
"url": "https://macarthur.me/posts/my-blog-post#comment-528"
}
}
]
}
</script>

Validating the Result

You’re highly encouraged to validate the data generated for any of your pages. Here are the best two places to start.