Answers.Body: <p>Have you checked out some of the examples here? <a href="https://nystudio107.com/blog/annotated-json-ld-structured-data-examples" rel="nofollow noreferrer">Annotated JSON-LD Structured Data Examples</a> -- specifically the <strong>devMode.fm Episode Page</strong> example shows adding an array of "actors" and "mentions" to the RadioEpisode type.</p>
  
  <p>The key concept is that anything that can be a schema.org type can also be an array of that type as well.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-30T16:14:17.033Z
Answers.LastActivityDate: 2019-10-30T16:14:17.033Z
Answers.UserDisplayName: andrew.welch
Answers.Body: <p>I hadn't seen those examples but it is bookmarked now.</p>
  
  <p>I've adapted your example as below and it's all working. Thanks @andrew.welch</p>
  
  <pre><code>{% set performersArray = [] %}
  {% for block in entry.performers .all() %}
    {% set performersArray = performersArray | merge([seomatic.jsonLd.create({
        'type': block.performerType,
        'name': block.performerName,
    }, false)]) %}
  {% endfor %}
  {% do mainEntity.performer(performersArray) %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-30T17:50:56.553Z
Answers.Text: excellently done!
Answers.UserDisplayName: andrew.welch
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-30T16:36:30.720Z
Answers.LastActivityDate: 2019-10-30T16:36:30.720Z
Answers.UserDisplayName: Tim Print
Body: <p>I am adding <a href="https://developers.google.com/search/docs/data-types/event" rel="nofollow noreferrer">event schema</a> to an entry page. I have offer and date properties working well based on <a href="https://nystudio107.com/blog/tips-for-using-seomatic-effectively" rel="nofollow noreferrer">https://nystudio107.com/blog/tips-for-using-seomatic-effectively</a></p>
  
  <p>This is working for offers</p>
  
  <pre><code>{% if entry.soldOut == '1' %}
    {% set availability = 'http://schema.org/SoldOut' %}
  {% else %}
    {% set availability = 'http://schema.org/InStock' %}
  {% endif %}
  {% set offersJsonLd = seomatic.jsonLd.create({
      'type': 'Offer',
      'price': entry.eventPrice,
      'priceCurrency': 'GBP',
      'validFrom': entry.postDate|date("Y-m-d"),
      'url': entry.url,
      'availability': availability,
  }, false) %}
  {% do mainEntity.offers(offersJsonLd) %}
  </code></pre>
  
  <p>I can't work out the correct approach for performers though. I have a Matrix field for performers with two fields performerType and performerName</p>
  
  <p>I have tried this</p>
  
  <pre><code>{% set performerJsonLd = seomatic.jsonLd.create(
    {% for block in entry.performers .all() %}
      {
      'type': block.performerType,
      'name': block.performerName,
      },
    {% endfor %}
    false) %}
  {% do mainEntity.performer(performerJsonLd) %}
  </code></pre>
  
  <p>and</p>
  
  <pre><code>{% set performersAndTypes %}
    {% for block in entry.performers .all() %}
      {
        '@type': '{{ block.performerType }}',
        'name': '{{ block.performerName }}',
      }{% if not loop.last %},{% endif %}
    {% endfor %}
  {% endset %}
  {% set performerJsonLd = seomatic.jsonLd.create(
    performersAndTypes,
    false) %}
  {% do mainEntity.performer(performerJsonLd) %}
  </code></pre>
  
  <p>but get errors for both. </p>
  
  <p>What would the correct approach be to get this working?</p>
  
Tags: <plugin-seomatic>
Title: How to add multiple performers to event schema with seomatic
ThreadText: # How to add multiple performers to event schema with seomatic
  
  (Asked by: username_0 on 2019-10-30)
  
  I am adding [event schema](https://developers.google.com/search/docs/data-types/event) to an entry page. I have offer and date properties working well based on <https://nystudio107.com/blog/tips-for-using-seomatic-effectively>
  
  This is working for offers
  
  ```
  {% if entry.soldOut == '1' %}
    {% set availability = 'http://schema.org/SoldOut' %}
  {% else %}
    {% set availability = 'http://schema.org/InStock' %}
  {% endif %}
  {% set offersJsonLd = seomatic.jsonLd.create({
      'type': 'Offer',
      'price': entry.eventPrice,
      'priceCurrency': 'GBP',
      'validFrom': entry.postDate|date("Y-m-d"),
      'url': entry.url,
      'availability': availability,
  }, false) %}
  {% do mainEntity.offers(offersJsonLd) %}
  
  ```
  
  I can't work out the correct approach for performers though. I have a Matrix field for performers with two fields performerType and performerName
  
  I have tried this
  
  ```
  {% set performerJsonLd = seomatic.jsonLd.create(
    {% for block in entry.performers .all() %}
      {
      'type': block.performerType,
      'name': block.performerName,
      },
    {% endfor %}
    false) %}
  {% do mainEntity.performer(performerJsonLd) %}
  
  ```
  
  and
  
  ```
  {% set performersAndTypes %}
    {% for block in entry.performers .all() %}
      {
        '@type': '{{ block.performerType }}',
        'name': '{{ block.performerName }}',
      }{% if not loop.last %},{% endif %}
    {% endfor %}
  {% endset %}
  {% set performerJsonLd = seomatic.jsonLd.create(
    performersAndTypes,
    false) %}
  {% do mainEntity.performer(performerJsonLd) %}
  
  ```
  
  but get errors for both.
  
  What would the correct approach be to get this working?
  
  **Tags:** plugin-seomatic
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2019-10-30. Score: 2 | Accepted answer
  
  Have you checked out some of the examples here? [Annotated JSON-LD Structured Data Examples](https://nystudio107.com/blog/annotated-json-ld-structured-data-examples) -- specifically the **devMode.fm Episode Page** example shows adding an array of "actors" and "mentions" to the RadioEpisode type.
  
  The key concept is that anything that can be a schema.org type can also be an array of that type as well.
  
  
  ---
  
  ### Answer by username_0 on 2019-10-30. Score: 3
  
  I hadn't seen those examples but it is bookmarked now.
  
  I've adapted your example as below and it's all working. Thanks @username_1
  
  ```
  {% set performersArray = [] %}
  {% for block in entry.performers .all() %}
    {% set performersArray = performersArray | merge([seomatic.jsonLd.create({
        'type': block.performerType,
        'name': block.performerName,
    }, false)]) %}
  {% endfor %}
  {% do mainEntity.performer(performersArray) %}
  
  ```
  
  > **Comments:**
  > **username_1**: excellently done!  
  
  ---
  
  