I'm working on a website and I want to follow all of the best practices for linked data.
I'm using JSON-LD and Schema.org to provide semantic metadata about the content of the page, but there doesn't appear to be any way to specify the tag on the page that contains the main content (rather than the nav bar, footer, etc.).
The site has multiple content types (articles, videos, recipes, etc.) and I'd like to make it easy for computers to be able to parse out the content. What is the right way to do this?
Instead of saying "the main content is in that HTML element"¹, you could provide the entities that are the main content.
With the
mainEntity
property, you convey which are the primary entities on theWebPage
. And within these entities, you provide their content in suitable properties (depending on the type). For example:If it’s an
Article
, you can provide the article body in thearticleBody
property.If it’s an
ImageObject
, you can provide the image’s URL in thecontentUrl
property.…
¹ Something similar would be possible with the
mainContentOfPage
property, which takesWebPageElement
entities as value. ButWebPageElement
doesn’t allow you to point to an HTML element, you would still have to provide the actual content via suitable properties. Anyway, I recommend not to usemainContentOfPage
(see my issue).