SEO.JSONLD.ItemList (SEO v0.3.0-rc.0)

View Source

A list of items of any sort—for example, Top 10 Movies About Weathermen, or Top 100 Party Songs. Not to be confused with HTML lists, which are often used only for formatting.

Helper for building a Schema.org ItemList JSON-LD structure.

Summary

Types

t()

A JSON-LD map ready to be nested or rendered. String-keyed, always includes "@type" set to "ItemList", plus any camelCased field keys the caller provided (see build/1). "@context" is added at render time by SEO.JSONLD.meta/1 on the top-level node only.

Functions

Build a ItemList JSON-LD map.

Types

attrs()

@type attrs() ::
  %{
    optional(:aggregate_element) => SEO.JSONLD.Thing.t() | map(),
    optional(:item_list_element) =>
      String.t() | SEO.JSONLD.Thing.t() | map() | SEO.JSONLD.ListItem.t(),
    optional(:item_list_order) =>
      String.t()
      | :item_list_order_ascending
      | :item_list_order_descending
      | :item_list_unordered,
    optional(:number_of_items) => integer(),
    optional(:additional_type) => String.t() | URI.t(),
    optional(:alternate_name) => String.t(),
    optional(:description) => SEO.JSONLD.TextObject.t() | map() | String.t(),
    optional(:disambiguating_description) => String.t(),
    optional(:identifier) =>
      String.t() | URI.t() | SEO.JSONLD.PropertyValue.t() | map(),
    optional(:image) =>
      URI.t() | String.t() | SEO.JSONLD.ImageObject.t() | map(),
    optional(:main_entity_of_page) =>
      SEO.JSONLD.CreativeWork.t() | map() | URI.t() | String.t(),
    optional(:name) => String.t(),
    optional(:owner) =>
      SEO.JSONLD.Organization.t() | map() | SEO.JSONLD.Person.t(),
    optional(:potential_action) => SEO.JSONLD.Action.t() | map(),
    optional(:same_as) => URI.t() | String.t(),
    optional(:subject_of) =>
      SEO.JSONLD.Event.t() | map() | SEO.JSONLD.CreativeWork.t(),
    optional(:url) => URI.t() | String.t()
  }
  | [
      aggregate_element: SEO.JSONLD.Thing.t() | map(),
      item_list_element:
        String.t() | SEO.JSONLD.Thing.t() | map() | SEO.JSONLD.ListItem.t(),
      item_list_order:
        String.t()
        | :item_list_order_ascending
        | :item_list_order_descending
        | :item_list_unordered,
      number_of_items: integer(),
      additional_type: String.t() | URI.t(),
      alternate_name: String.t(),
      description: SEO.JSONLD.TextObject.t() | map() | String.t(),
      disambiguating_description: String.t(),
      identifier: String.t() | URI.t() | SEO.JSONLD.PropertyValue.t() | map(),
      image: URI.t() | String.t() | SEO.JSONLD.ImageObject.t() | map(),
      main_entity_of_page:
        SEO.JSONLD.CreativeWork.t() | map() | URI.t() | String.t(),
      name: String.t(),
      owner: SEO.JSONLD.Organization.t() | map() | SEO.JSONLD.Person.t(),
      potential_action: SEO.JSONLD.Action.t() | map(),
      same_as: URI.t() | String.t(),
      subject_of: SEO.JSONLD.Event.t() | map() | SEO.JSONLD.CreativeWork.t(),
      url: URI.t() | String.t()
    ]

t()

@type t() :: %{required(String.t()) => term()}

A JSON-LD map ready to be nested or rendered. String-keyed, always includes "@type" set to "ItemList", plus any camelCased field keys the caller provided (see build/1). "@context" is added at render time by SEO.JSONLD.meta/1 on the top-level node only.

Functions

build(attrs)

@spec build(attrs()) :: t()

Build a ItemList JSON-LD map.

Fields

  • :aggregate_element - Indicates a prototype of the elements in the list that is used to hold aggregate information (ratings, offers, etc.).
  • :item_list_element - For itemListElement values, you can use simple strings (e.g. "Peter", "Paul", "Mary"), existing entities, or use ListItem.

Text values are best if the elements in the list are plain strings. Existing entities are best for a simple, unordered list of existing things in your data. ListItem is used with ordered lists when you want to provide additional context about the element in that list or when the same item might be in different places in different lists.

Note: The order of elements in your mark-up is not sufficient for indicating the order or elements. Use ListItem with a 'position' property in such cases.

  • :item_list_order - Type of ordering (e.g. Ascending, Descending, Unordered). One of: :item_list_order_ascending, :item_list_order_descending, :item_list_unordered.
  • :number_of_items - The number of items in an ItemList. Note that some descriptions might not fully describe all items in a list (e.g., multi-page pagination); in such cases, the numberOfItems would be for the entire list.

Inherited properties

Additional properties are available through the inheritance chain. See each ancestor's docs for its properties: