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

View Source

A rating is an evaluation on a numeric scale, such as 1 to 5 stars.

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

Summary

Types

t()

A JSON-LD map ready to be nested or rendered. String-keyed, always includes "@type" set to "Rating", 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 Rating JSON-LD map.

Types

attrs()

@type attrs() ::
  %{
    optional(:author) =>
      SEO.JSONLD.Organization.t() | map() | SEO.JSONLD.Person.t(),
    optional(:best_rating) => String.t() | number(),
    optional(:rating_explanation) => String.t(),
    optional(:rating_value) => String.t() | number(),
    optional(:review_aspect) =>
      SEO.JSONLD.StructuredValue.t() | map() | String.t(),
    optional(:worst_rating) => String.t() | number(),
    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()
  }
  | [
      author: SEO.JSONLD.Organization.t() | map() | SEO.JSONLD.Person.t(),
      best_rating: String.t() | number(),
      rating_explanation: String.t(),
      rating_value: String.t() | number(),
      review_aspect: SEO.JSONLD.StructuredValue.t() | map() | String.t(),
      worst_rating: String.t() | number(),
      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 "Rating", 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 Rating JSON-LD map.

Fields

  • :author - The author of this content or rating. Please note that author is special in that HTML 5 provides a special mechanism for indicating authorship via the rel tag. That is equivalent to this and may be used interchangeably.
  • :best_rating - The highest value allowed in this rating system.
  • :rating_explanation - A short explanation (e.g. one to two sentences) providing background context and other information that led to the conclusion expressed in the rating. This is particularly applicable to ratings associated with "fact check" markup using SEO.JSONLD.ClaimReview.
  • :rating_value - The rating for the content.

Usage guidelines:

  • Use values from 0123456789 (Unicode 'DIGIT ZERO' (U+0030) to 'DIGIT NINE' (U+0039)) rather than superficially similar Unicode symbols.
  • Use '.' (Unicode 'FULL STOP' (U+002E)) rather than ',' to indicate a decimal point. Avoid using these symbols as a readability separator.
  • :review_aspect - This Review or Rating is relevant to this part or facet of the itemReviewed.
  • :worst_rating - The lowest value allowed in this rating system.

Inherited properties

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