In Version 12.0.1.15778, if the forum question or answers only include HTML content (like screen shots or videos), Google Search Console will complain about the "text" field being empty in the JSON (either question and/or answer).
Here is the solution I came up with and I thought I'd share with the community:
- In the Forum - Thread widget, add a resource named "contentOnPage" and add a friendly message like "View Content on Page..."
- Note that you don't necessarily need a resource and could just hard code a string, but if you are translating, it makes things easier later.
- In the Forum - Thread structured-question-data.vm file, for the question section replace:
"text": "$core_v2_encoding.JavascriptEncode($core_v2_language.RemoveHtml($thread.Body()))",
with:#if ($core_v2_encoding.JavascriptEncode($core_v2_language.RemoveHtml($thread.Body())) != "") "text": "$core_v2_encoding.JavascriptEncode($core_v2_language.RemoveHtml($thread.Body()))", #else "text": "$core_v2_encoding.JavascriptEncode($core_v2_language.GetResource('contentOnPage'))", #end
- In the Forum - Thread structured-question-data.vm file, for the answer sections (there are 3) replace:
"text": "$core_v2_encoding.JavascriptEncode($core_v2_language.RemoveHtml($answer.Body()))",
with:#if ($core_v2_encoding.JavascriptEncode($core_v2_language.RemoveHtml($answer.Body()))!= "") "text": "$core_v2_encoding.JavascriptEncode($core_v2_language.RemoveHtml($answer.Body()))", #else "text": "$core_v2_encoding.JavascriptEncode($core_v2_language.GetResource('contentOnPage'))", #end
This is perhaps already fixed with the changes made in 12.0.1.16198 for TE-16814 - Fixed date formatting in QAPage structured data.