Opened 5 years ago
Last modified 22 months ago
#4695 accepted defect (bug)
Add FAQPage schema markup to plugin pages
Reported by: | jonoaldersonwp | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | Priority: | normal | |
Component: | Plugin Directory | Keywords: | seo |
Cc: |
Description (last modified by )
Plugin pages, like https://wordpress.org/plugins/autoptimize/, often contain FAQ content.
When this is the case, we should output FAQ schema markup, with an aim to encourage Google to show FAQ questions+answers in the search results (therefore achieving extra visibility and clickthrough-rates).
Approach
- Add an additional node to the existing schema markup on plugin pages, for
"@type": "FAQPage"
.
- Add a
mainEntity
property to house the questions.- Loop through each question/answer, and construct a
Question
node with anacceptedAnswer
property.
- Loop through each question/answer, and construct a
Example output
{ "@context": "https://schema.org", "@type": "FAQPage", "@id": "{{CANONICAL_URL}}", "url": "{{CANONICAL_URL}}", "mainEntity": [{ "@type": "Question", "name": "What does the plugin do to help speed up my site?", "acceptedAnswer": { "@type": "Answer", "text": "It concatenates all scripts and styles, minifies and compresses them, adds expires headers, caches them, and moves styles to the page head, and scripts (optionally) to the footer. It also minifies the HTML code itself, making your page really lightweight." } }, { "@type": "Question", "name": "But I’m on HTTP/2, so I don’t need Autoptimize?", "acceptedAnswer": { "@type": "Answer", "text": "HTTP/2 is a great step forward for sure, reducing the impact of multiple requests from the same server significantly by using the same connection to perform several concurrent requests. That being said, <a href="http://engineering.khanacademy.org/posts/js-packaging-http2.htm">concatenation of CSS/ JS can still make a lot of sense</a>, as described in <a href="https://css-tricks.com/http2-real-world-performance-test-analysis/">this css-tricks.com article</a> and this <a href="http://calendar.perfplanet.com/2015/packaging-for-performance/">blogpost from one of the Ebay engineers</a>. The conclusion; configure, test, reconfigure, retest, tweak and look what works best in your context. Maybe it’s just HTTP/2, maybe it’s HTTP/2 + aggregation and minification, maybe it’s HTTP/2 + minification (which AO can do as well, simply untick the “aggregate JS-files” and/ or “aggregate CSS-files” options). And Autoptimize can do a lot more then “just” optimizing your JS & CSS off course " } }, { "@type": "Question", "name": "Will this work with my blog?", "acceptedAnswer": { "@type": "Answer", "text": "Although Autoptimize comes without any warranties, it will in general work flawlessly if you configure it correctly. See “Troubleshooting” below for info on how to configure in case of problems." } }, {...} ] }
Sanitization concerns
All HTML tags should be stripped from fields, with the exception of the text
property of an acceptedAnswer
, which should:
- Accept
<a>
,<strong>
and<em>
tags. - Disallow/remove any values/properties/attributes of these tags (other than the
href
attribute on<a>
tags). - Remove invalid markup (e.g., an
<a>
without a closing</a>
).
Change History (2)
Note: See
TracTickets for help on using
tickets.