Google would like to see item lists marked up and in Drupal that would translate to adding JSON LD markup to Views pages.

Google's markup requirements are shown at https://developers.google.com/search/docs/guides/mark-up-listings. The list would be a type of itemListElement, with a ListItem for each item in the list.

The Metatag module has an outstanding issue about adding Views support for metatags. Once that is done we probably could piggyback on that to create the proper JSON LD markup and get it on a view.

It might only work for views that render entities (as opposed to fields). So a list of teasers or an image gallery that uses a display mode for each item in the galley, since then we have the entity available to pull more information from.

Postponed until https://www.drupal.org/node/2563647 gets in.

Comments

KarenS created an issue. See original summary.

DamienMcKenna’s picture

Status: Postponed » Active
Related issues: +#2563647: Views integration

#2563647: Views integration was committed, so this can be worked on now.

KarenS’s picture

Status: Active » Fixed

OK, I committed at least a first pass at this. I added a new ListItem object, similar to the Article, Organization, WebPage and WebSite objects.

To use it, enable the ListItem module, set up the metatags for a view to use the ListItem, provide the view name and the display machine name in the form element. Each item in the view will be displayed in the JSON LD.

It took a while to figure out how Google wanted that list configured but I finally found a way to render it that will validate in Google's structured data testing tool. Basically all Google wants is the url of each item, but I added the name as well just to make it easier to read.

This is only tested on views that display rendered content, like lists of teasers, since they include an entity for each item that we can use. I haven't tried to make any other kind of view work.

I need to put together a video or more detailed instructions about how to use all this to get the best results in Google's testing tool.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.