Allow multiple Drupal entity types to use the same Schema.org type

Created on 30 May 2022, about 2 years ago
Updated 23 March 2023, over 1 year ago

Problem/Motivation

If we have more than one generic content type, such as Basic page and Landing page, it would be good to be able to choose the Schema WebPage type for both of them. However, if I use it for basic page it is no longer available to choose for the Landing page node type

Steps to reproduce

Map the Basic page content type to the Schema.org WebPage type, hen try and do the same for another content type and you won't be able to select WebPage.

Proposed resolution

Allow the Schema.org types to be used for multiple Drupal Node types

✨ Feature request
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom bezlash@gmail.com

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States jrockowitz Brooklyn, NY

    You can "Allow multiple mappings to point to the same Schema.org type" via the mapping type

    @see /admin/config/search/schemadotorg/types/node

  • Hello :)

    the option is checked but if I write

    content_type_machine_name|Article
    content_type_machine_name|NewsArticle

    and I save, the first is erased and keep the last content_type_machine_name|NewsArticle

  • πŸ‡ΊπŸ‡ΈUnited States jrockowitz Brooklyn, NY

    You can't map the same content type to different Schemas. It is a one-to-one relationship.

    I did add the ability to add custom JSON-LD via the 'Schema.org Blueprints JSON-LD Custom' module, which would allow adding another Schema mapping to a content type.

  • Ok I see. I've tested but that add custom field into a "publisher" object

    <script type="application/ld+json">{
        "@context": "https:\/\/schema.org",
        "@type": "Article",
        "@url": "customURL",
        "identifier": [
            {
                "@type": "PropertyValue",
                "propertyID": "uuid",
                "value": "1f3aab66-d260-4805-ae51-ebac38fc780a"
            }
        ],
        "inLanguage": "fr",
        "name": "customName",
        "copyrightHolder": "test",
        "copyrightYear": 2023,
        "dateCreated": "2022-11-14 15:16:50 +01:00",
        "dateModified": "2022-11-14 15:42:05 +01:00",
        "publisher": {
            "@context": "https:\/\/schema.org",
            "@type": "Organization",
            "name": "customName",
            "url": "customUrl",
            "test": "helloWorld"
        }
    }</script>
    

    I need to have 2 scripts like that

    <script type="application/ld+json">{
        "@context": "https:\/\/schema.org",
        "@type": "Article",
        "@url": "customURL",
        "identifier": [
            {
                "@type": "PropertyValue",
                "propertyID": "uuid",
                "value": "1f3aab66-d260-4805-ae51-ebac38fc780a"
            }
        ],
        "inLanguage": "fr",
        "name": "customName",
        "copyrightHolder": "test",
        "copyrightYear": 2023,
        "dateCreated": "2022-11-14 15:16:50 +01:00",
        "dateModified": "2022-11-14 15:42:05 +01:00"
        }
    }</script>
    <script type="application/ld+json">{
        "@context": "https:\/\/schema.org",
        "@type": "NewsArticle",
        "@url": "customURL"
    }</script>
    

    One script for @type Article and an other script for @type NewsArticle with other field

  • πŸ‡ΊπŸ‡ΈUnited States jrockowitz Brooklyn, NY

    You would have to write custom code to do the other mapping.

Production build 0.69.0 2024