Rich snippet tags itemscope and itemtype has fixed order, how to generate that in JSP?
-
14-04-2021 - |
Question
Trying to add rich snippets to a JSP-generated page. Spent a few hours on it with no luck and then realized that the generated page looks like this:
<p itemtype="http://schema.org/LocalBusiness" itemscope="itemscope">
This is not recognized by the Google rich snippet test tool. If I move the itemscope tag before itemtype, it works.
What can I do about this? The parser reads my JSPX and spits it out with the tags in arbitrary order. Can I have control over the tag order somehow?
Solution
Not the nicest solution but if Google won't follow standards, who am I to argue...
In the JSPX file, I generate the HTML like this:
<p itemscope="itemscope" itemtype="http://schema.org/LocalBusiness">
...
</p>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow