Best JSON-LD practices: using multiple [removed] elements?

前端 未结 2 1303
梦如初夏
梦如初夏 2020-11-29 00:06

I\'m curious about the best practice for applying JSON-LD onto a site for schema.org.

If I have a page with an Article and I also want to define W

2条回答
  •  情歌与酒
    2020-11-29 00:35

    It’s valid. You can have as many data blocks (= script elements) as you wish.

    A possible benefit of using only one script element: it allows to make relationships between multiple items easier (e.g., should you decide to use hasPart or mainEntity), as you simply have to nest the items.
    But making these relationships is of course also possible when using separate data blocks, by referencing the URI of the item with @id (thanks, @ Gregg Kellogg).

    (For reference, adding two or more top-level items in a single script is possible with @graph.)

提交回复
热议问题