Home / Blog / JSON tools

Structured data & SEO

Google SEO JSON-LD: Keep Article Facts Consistent at Publish Time

Generate article JSON-LD from verified editorial fields, keep authors and dates aligned, and test the deployed page without promising rankings.

Treat article markup as a publishing output

For an article, useful JSON-LD starts with accurate editorial information: its headline, author, representative image and publication history. Generate these fields from the same records that supply the visible page. A separate block maintained by copying old articles is likely to drift after titles, images or author details change.

Google's Article documentation explains how Article, NewsArticle and BlogPosting can clarify article information. Choose the type that describes the page. A calculator, company profile or store category does not become a news article because a template assigns NewsArticle to every URL.

Build an example from a single article record

function articleJsonLd(article, author) {
  return {
    "@context": "https://schema.org",
    "@type": "BlogPosting",
    "@id": article.url + "#article",
    headline: article.headline,
    image: [article.image],
    datePublished: article.published,
    dateModified: article.modified,
    author: {
      "@type": "Person",
      "@id": author.url,
      name: author.name,
      url: author.url
    }
  };
}

This small function maps trusted publishing fields; it is not an input validator. Check the record before calling it. Require the URLs your own publishing system needs, confirm that the image belongs to the article and use real dates. Never fill unknown biography fields with invented credentials just to make an object look more complete.

Give the author a visible link to the same profile represented by the author URL. The author name should contain the person's name rather than a marketing slogan or a concatenation of their name and job title. Keep the publisher and the individual writer separate when they are different entities.

Preserve publication history through revisions

Keep the original publication date when editing an existing article. Update the modification date when the content is actually revised, following an editorial rule that the site can explain. A rebuild, a cache change or a new stylesheet should not automatically make every old article appear newly reviewed.

Use one stored timestamp or explicitly chosen date representation to derive the visible review date and the structured value. If a timestamp is used, include its intended timezone. Then inspect a page near a date boundary: inconsistent timezone conversion can make a card say Monday while its article says Tuesday.

Check the exact image URL and identity

An image can load successfully while still illustrating the wrong article. Compare the headline, visible cover, social sharing image and search-index thumbnail as a set. Generating files from a reused numeric identifier can accidentally associate a current title with another article's old cover.

Open the declared image URL directly and inspect its actual dimensions and content. Keep meaningful old asset URLs available when a replacement is introduced, particularly if other published pages still reference them. Updating one visible hero does not automatically update every metadata field or related-article card.

Inspect what the template actually publishes

Serialize the resulting object using a proper JSON serializer and embed it with HTML-safe handling of closing-script sequences. The JSON.stringify reference describes serialization behavior; it does not make arbitrary hand-built HTML safe. Avoid inserting raw author or title strings between JSON quotation marks.

Check for duplicate article objects emitted by a theme, a plugin and a custom component. Multiple related entities can be intentional, but contradictory headlines or dates for the same article identifier are a publishing defect. Select one owner for each record and document where changes belong.

Validate facts, syntax and search support separately

Use the local Structured Data Validator for a preliminary syntax and basic structure check. Then review the relevant Google feature test and the deployed URL. A local success does not establish crawlability, content quality, ranking improvement or a guaranteed search appearance.

Google's structured-data introduction describes markup as a way to communicate page meaning. Keep that purpose central: test two different articles, change one headline and confirm that only its generated fields change. This catches accidental shared state before it affects an entire archive.

Include an author with an apostrophe and a headline containing quotation marks in the template test. Parse the published script text back into an object and compare the resulting strings with the source record. This verifies the complete generation and embedding path, rather than only checking that the original database values look correct.