Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Structured Data #129

Open
xRahul opened this issue Dec 27, 2017 · 6 comments
Open

Adding Structured Data #129

xRahul opened this issue Dec 27, 2017 · 6 comments

Comments

@xRahul
Copy link
Contributor

xRahul commented Dec 27, 2017

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

@migueldemoura
Copy link
Contributor

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.

@xRahul
Copy link
Contributor Author

xRahul commented Dec 27, 2017

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

@migueldemoura
Copy link
Contributor

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.

@xRahul
Copy link
Contributor Author

xRahul commented Dec 28, 2017

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.

@migueldemoura
Copy link
Contributor

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!

@xRahul
Copy link
Contributor Author

xRahul commented May 21, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants