Does Schema.org markup work if markup is dynamically built with JavaScript?

Google’s documentation only mentions that they can consume dynamically added structured data if the syntax JSON-LD is used:

Also, Google can read JSON-LD data even when it is dynamically injected into the page’s contents, such as by Javascript code or embedded “widgets”.

This does not necessarily mean that they can’t read it in case of other syntaxes (like Microdata or RDFa), but at least they don’t document it.

That their testing tool doesn’t read it may or may not mean something (it could be that the tool doesn’t handle this but their internal system does). However, there should be no issue with your actual markup, as you can easily test it yourself by pasting your markup instead of entering your URL.

Leave a Comment