lorisleiva / vuepress-plugin-seo

🔌 Generate SEO friendly meta header for every page
MIT License
107 stars 7 forks source link

[Feature request] Microdata/JSON-LD Support #6

Open andreacanton opened 4 years ago

andreacanton commented 4 years ago

Hi!

I think it should be supported the Microdata/JSON-LD.

More info about this structured data here:

https://developers.google.com/search/docs/guides/intro-structured-data?hl=en

lorisleiva commented 4 years ago

Hi there 👋

Good idea.

The challenge for me here was to find a flexible API to provide that JSON schema.

PR welcome. 🙂

adamdehaven commented 4 years ago

@lorisleiva I can help with this, but a question: how would you inject the structured data into the rendered page, without JavaScript so that it's available on page load?

lorisleiva commented 4 years ago

Vuepress compiles for both server-side rendering and client-side rendering. So, just like we do with the current metadata, we just need to make sure it's applied when compiling the initial HTML pages.

adamdehaven commented 4 years ago

Right, but you can't inject a script tag as part of the page meta or frontmatter, so... How would you do that?

lorisleiva commented 4 years ago

I'm hoping the innerHTML argument could do the trick but otherwise, we'd have to manually inject it somehow by looking into how that head configuration work on the Vuepress core.

Screenshot 2020-08-15 at 18 20 36
adamdehaven commented 4 years ago

@lorisleiva when you pass values there, they don't update on route change though ...

amerkay commented 2 years ago

Check out this article about adding Canonical, Meta Tags, and Structured Data.

We should implement for VuePress v2. I already submitted a pull request with upgraded code to v2.