HiDeoo / starlight-blog

Starlight plugin to add a blog to your documentation
https://starlight-blog-docs.vercel.app
MIT License
159 stars 21 forks source link

Add Article structured data #83

Open julien-deramond opened 2 months ago

julien-deramond commented 2 months ago

Is your feature request related to a problem?

Developers can add structured data to their website to help Google Search understand the content, and also sometimes add a dedicated rendering in the search results. More information.

The Article structured data (Article, NewsArticle, BlogPosting) could be a nice addition to Starlight Blog.

Describe the solution you'd like

One could optionally provide the right information, the structured data type definitions, in the frontmatter for instance (for the information not already available).

If most, or all, information is already there, Starlight Blog could update the head automatically to add this structured data <script>.

Describe alternatives you've considered

I've implemented it in my own project. This is not the best implementation ever, but it gives clues about some potential solution "from outside": https://github.com/Open-reSource/openresource.dev/commit/5c42ffd65f22048d1bba22796a95d563418a9f46

Additional Context

No response

HiDeoo commented 2 months ago

Thanks for the feedback :raised_hands:

I definitely think that could be a good improvement.

If most, or all, information is already there, Starlight Blog could update the head automatically to add this structured data <script>.

I'll need to read again the documentation but I'm leaning towards using the Microdata format instead of JSON-LD, maybe a bit easier to maintain.

Not sure when I'll have time to implement this but altho worth noting that astro-seo-schema can be a good alternative for users wanting this feature right now.