Problem/Motivation

Some field values, such as "sameAs" and "awards" accepts multiple values as an array.

<script type="application/ld+json">
    {
      "@context": "https://schema.org",
      "@type": "Organization",
      "image": "https://www.example.com/example_image.jpg",
      "url": "https://www.example.com",
      "sameAs": ["https://example.net/profile/example1234", "https://example.org/example1234"],
      "logo": "https://www.example.com/images/logo.png",
      "name": "Example Corporation",
      "description": "The example corporation is well-known for producing high-quality widgets",
      "email": "contact@example.com",
      "telephone": "+47-99-999-9999",
      "address": {
        "@type": "PostalAddress",
        "streetAddress": "Rue Improbable 99",
        "addressLocality": "Paris",
        "addressCountry": "FR",
        "addressRegion": "Ile-de-France",
        "postalCode": "75001"
      },
      "vatID": "FR12345678901",
      "iso6523Code": "0199:724500PMK2A2M1SQQ228"
    }
    </script>

Source: https://developers.google.com/search/docs/appearance/structured-data/org...

Steps to reproduce

For example, in Organization, add the "sameAs" field. It's only possible to fill with a single text value.

Proposed resolution

Create the multiple value field type, enabling the format like:

"sameAs": ["https://example.net/profile/example1234", "https://example.org/example1234"]

This field type must be available for sameAs and awards.
Possibly, other schema types may have the same need.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

nataliaalves created an issue. See original summary.

nataliaalves’s picture

Title: Enable multiple values in field » Enable multiple values in sameAs and awards schemas
Issue summary: View changes

daniel_mm02 made their first commit to this issue’s fork.

daniel_mm02’s picture

Assigned: Unassigned » daniel_mm02

daniel_mm02’s picture

Hi, I have created a MR: https://git.drupalcode.org/project/json_ld_schema_ui/-/merge_requests/13 which needs revision to merge it, I have tested it and now if you mark the new chockbox in the form and separate the values with commas the result will be as follows:

Input: test1, test2, test3 test4 test5, test6

With checkbox marked:
<script type="application/ld+json">{"@context":"https:\/\/schema.org\/","@type":"Organization","awards":["test1","test2","test3 test4 test5","test6"]}</script>

With checkbox unmarked:
<script type="application/ld+json">{"@context":"https:\/\/schema.org\/","@type":"Organization","awards":"test1, test2, test3 test4 test5, test6"}</script>

daniel_mm02’s picture

Status: Active » Needs review
gxleano’s picture

Version: 1.0.3 » 1.0.x-dev
Assigned: daniel_mm02 » Unassigned
gxleano’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

gxleano’s picture

Status: Fixed » Closed (fixed)