Article JSON-LD on a Drupal Site: publisher and mainEntityOfPage Aren't What Google Asks For

By Lars Nielsen ·

Until September, this site had no structured data at all: no JSON-LD, no microdata, not even Open Graph tags. I noticed because the search-appearance report in Search Console came back completely empty in two exports in a row. I added Open Graph tags and a block of JSON-LD to every article page, including publisher and mainEntityOfPage. Compared with Google's own documentation, those two are the parts Google doesn't ask for, and the one property it does recommend that the site leaves out is the image.

What the site outputs

The theme adds the JSON-LD itself in a page-attachments hook, only on article pages, because the Metatag module installed here has no JSON-LD submodule enabled. For each article it outputs:

  • @type: TechArticle
  • headline, description (the body's summary, or a generated summary of up to 300 characters) and url
  • datePublished and dateModified, from the node's created and changed timestamps
  • mainEntityOfPage: a WebPage whose @id is the article's own URL
  • author: a Person with my name
  • publisher: an Organization named Linkhub, with the site's URL

The dates are the honest part. datePublished is the node's created time, which a Scheduler setting on this site moves to the moment an article actually goes live. dateModified is Drupal's changed timestamp, and Drupal only moves that on a save that changes at least one other field value. So the dates follow real publishing and real edits, not every save.

What Google's documentation asks for

Google's page on Article structured data is shorter than most tutorials suggest. It names three types, Article, NewsArticle and BlogPosting, and says there are no required properties. Its list of recommended properties has five entries:

  • author
  • dateModified
  • datePublished
  • headline
  • image

Neither publisher nor mainEntityOfPage is on that list. The only place the documentation mentions publisher is a note on author markup: don't put the publisher's name in the author's name, use the publisher property for that. So publisher is a reasonable place for the site's name, but it isn't something Google says it uses for articles.

What the two fields mean anyway

mainEntityOfPage comes from schema.org, not from Google. Schema.org defines it as the page (or other creative work) for which this thing is the main entity being described. Pointing it at the article's own URL says "this page is about this article", which on a page that contains exactly one article is true and adds very little.

Schema.org defines publisher as the publisher of the article in question. For a personal site, that's a judgment call: an Organization called Linkhub with my name as the Person author describes the site accurately, and costs nothing.

Neither field does harm. The point is not to remove them; it's to stop treating them as the important part.

The missing piece: an image

image is the one recommended property the site doesn't output, and Google's documentation is specific about it: images representative of the article, not logos, and crawlable and indexable. Articles published through this site's API can't contain images at all: the restricted text format they use has no img tag. So there's nothing honest to put there yet. Adding a generic logo to every article would fill the field and go against the guidance at the same time.

Results, honestly

There's no effect to report. A month after the JSON-LD went live, Search Console's search-appearance report was still empty. As far as I can tell from Google's documentation, it doesn't list TechArticle among the article types it names, so even perfect markup might not produce anything there. Structured data describes a page; it doesn't promise a feature in search results.

What it does do is describe the content in a form any consumer can read without guessing, and the parts that matter most for that are the boring ones: an accurate headline, real dates and a real author.

Leave a comment

Comments are reviewed before they appear.

Basic HTML allowed: links, emphasis, code and lists. Web addresses become links automatically.