Open xRahul opened 6 years ago
This is a good idea, it is standardized as far as I know and it makes sense. Is there any way of adding the tags without javascript? I used to do this with html tags in the <head>
, not sure if that's still possible.
No javascript is required to add it. The json-ld format uses the script tag, but that's just semantics. Check out the structured data page by google It is just a properly formatted json wrapped in script tags. It's the default standard nowadays
What I knew before was https://www.w3.org/TR/microdata. Could you place the json in a separate .js file? That way you get better caching and it doesn't interfere with a proper CSP definition.
microdata is an older format and search engines are moving towards json-ld format now.
Google recommends using JSON-LD for structured data whenever possible.
Also, it's structured data for the page, so moving it to a separate file doesn't make sense. We can add it in the
tag just like the og and twitter tags we have. It can also be added in the body. Also, what do you mean by CSP definition? I'm unfamiliar with the term.Yes yes, I read their recommendation.
We can add it in the tag just like the og and twitter tags we have. How would that look like?
CSP "is an added layer of security that helps to detect and mitigate certain types of attacks, including Cross Site Scripting (XSS) and data injection attacks." The correct way of using it would break the inline scripts (w/o nounces), hence my question about moving it to another file. This should be a non-issue for most users, just asking as myself and a couple others I know will have to find a workaround :)
All in all this a great addition!
As this is a theme, I did not add too much information in the structured data, but I've made it extensible so that users can add their own.
Hey guys, I have recently started to dive deep into the SEO aspects of the theme. As I can see, there is no structured data for List of Articles, each article, author etc. Adding some basic structured data can really enhance the website in search results when users are using this theme. We can use schemas like
BlogPosting
,Article
etc on the pages and give them a boost in the search. Reference commit