Looking for a way to output a JSON that looks like this:

{ "@context": "http://schema.org", "@type": ["LocalBusiness","MedicalOrganization"], ...

However, the current drop-down allows for only one selection. Is there a solution to this?

Thank you!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hoppin_levels created an issue. See original summary.

anandangalig’s picture

Issue tags: +dropdown, +multiple values, +select
KarenS’s picture

I'm not even sure that would validate.

DamienMcKenna’s picture

Issue tags: -dropdown, -multiple values, -select
ChristophWeber’s picture

I ran a quick test in the Google Validator, it does in fact not validate as proposed.
What does validate is this:

    "@context": "http://schema.org",
    "@graph": [
        {
            "@type": "LocalBusiness",
            "@id": "https://www.example.com",
            "image": "https://www.example.com/image.png",
            "name": "Example Corp"
        },
        {
            "@type": "MedicalOrganization",
            "@id": "https://www.example.com",
            "image": "https://www.example.com/image.png",
            "name": "Example Corp"
        },
...

which makes me think the pivoting feature in schema_metatag ought to work here.

KarenS’s picture

Although Google may accept multiple types, I'm not sure that's ideal. I see there is http://schema.org/additionalType which looks like what you would use instead. Note that the JSON LD example on that page looks like this:

<script type="application/ld+json">
{
  "@context":  "http://schema.org/",
  "@id": "#record",
  "@type": "Book",
  "additionalType": "Product",
  "name": "Le concerto",
  "author": "Ferchault, Guy",
  "offers":{
      "@type": "Offer",
      "availability": "http://schema.org/InStock",
      "serialNumber": "CONC91000937",
      "sku": "780 R2",
      "offeredBy": {
          "@type": "Library",
          "@id": "http://library.anytown.gov.uk",
          "name": "Anytown City Library"
      },
      "businessFunction": "http://purl.org/goodrelations/v1#LeaseOut",
      "itemOffered": "#record"
    }
}
</script>
ChristophWeber’s picture

The general guidance everywhere is to use the most specific type, and everything I've ever read used singular. Unless someone can point to "official" contrary documentation, I suggest we refocus this issue around support for additionalType, or else Close (won't fix) it.

KarenS’s picture

Title: Cannot allow for multiple selection for SCHEMA.ORG: ORGANIZATION @type dropdown » Add additionalType
Version: 8.x-1.0-rc4 » 8.x-1.x-dev
Category: Support request » Feature request
thejimbirch’s picture

That attached patch adds the additionalType field to the Schema.org Organization module.

Status: Needs review » Needs work

The last submitted patch, 9: schema_metatag-add-additionaltype-2936298-9.patch, failed testing. View results

KarenS’s picture

Status: Needs work » Needs review
FileSize
6.49 KB

Rerolled.

  • KarenS committed 54f95f1 on 8.x-1.x authored by thejimbirch
    Issue #2936298 by KarenS, thejimbirch, hoppin_levels, ChristophWeber,...
KarenS’s picture

Version: 8.x-1.x-dev » 7.x-1.x-dev
Status: Needs review » Patch (to be ported)

Committed. Now needs to be back-ported to D7.

KarenS’s picture

Status: Patch (to be ported) » Needs review
FileSize
1.71 KB

  • KarenS committed b740af9 on 7.x-1.x
    Issue #2936298 by KarenS, thejimbirch, hoppin_levels, ChristophWeber,...
KarenS’s picture

Status: Needs review » Fixed

Added to both D7 and D8. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

temujinWest’s picture

Hi, I'm looking to add productontology to product as additionalType, any chance to patch this for product?

thejimbirch’s picture

@18temujinWest . This issue has been closed. It would be best to open a new issue for your feature request.