Pivot on sub elements like images, FAQ answers etc

Created on 3 December 2020, about 4 years ago
Updated 20 June 2023, over 1 year ago

Problem/Motivation

After applying patch #3182969: Wrong property_type for schema_qa_page_main_entity I can now populate the fields for Q/A in the Schema.org metatags for FAQpage. The problem is that if you enable pivot the questions are formatted correctly, but the answers are not split up properly. The output looks like this:

{
    "@context": "https://schema.org",
    "@graph": [
        {
            "@type": "FAQPage",
            "mainEntity": [
                {
                    "@type": "Question",
                    "name": "This is a test meta q1",
                    "answerCount": "1",
                    "acceptedAnswer": {
                        "@type": "Answer",
                        "text": [
                            "This is a test meta answer 1",
                            "This is a test meta answer 2"
                        ],
                        "url": "https://mysite.com/en/test-1"
                    }
                },
                {
                    "@type": "Question",
                    "name": "This is a test meta q2",
                    "answerCount": "1",
                    "acceptedAnswer": {
                        "@type": "Answer",
                        "text": [
                            "This is a test meta answer 1",
                            "This is a test meta answer 2"
                        ],
                        "url": "https://mysite.com/en/test-1"
                    }
                }
            ]
        },
        {
            "@type": "WebPage"
        }
    ]
}

I believe the correct format should be:

{
    "@context": "https://schema.org",
    "@graph": [
        {
            "@type": "FAQPage",
            "mainEntity": [
                {
                    "@type": "Question",
                    "name": "This is a test meta q1",
                    "answerCount": "1",
                    "acceptedAnswer": {
                        "@type": "Answer",
                        "text": [
                            "This is a test meta answer 1"
                        ],
                        "url": "https://mysite.com/en/test-1"
                    }
                },
                {
                    "@type": "Question",
                    "name": "This is a test meta q2",
                    "answerCount": "1",
                    "acceptedAnswer": {
                        "@type": "Answer",
                        "text": [
                            "This is a test meta answer 2"
                        ],
                        "url": "https://mysite.com/en/test-1"
                    }
                }
            ]
        },
        {
            "@type": "WebPage"
        }
    ]
}

Steps to reproduce

1. Enable FAQPage for schema_metatags on a content-type
2. Create two multivalue long text fields for question and answer on the c-t
3. Configure settings for schema_metadate FAQ/QA page set @type to FAQPage, configure question as token [node:field_meta_question], configure and answer as token [node:field_meta_answer] and choose PIVOT.
4. Create a node with a title and two questions and answers
5. View node header and see the issue

Proposed resolution

TBD

🐛 Bug report
Status

Fixed

Version

3.0

Component

Existing structures

Created by

🇨🇦Canada joel_osc

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.

Production build 0.71.5 2024