jonasmerlin / astro-seo

Makes it easy to add information that is relevant for SEO to your Astro app.
MIT License
908 stars 50 forks source link

Add advanced Example to readme #44

Closed surjithctly closed 1 year ago

surjithctly commented 1 year ago

Please add how an advanced example looks like in the readme, it will reduce lot of friction on how to format esp when title, opengraph etc. are different.

You defined openGraph.basic.image, but didn't define openGraph.image.alt. This is stongly discouraged.'

I'm still wondering it should be inside the basic object or should create a new image object. The typescript autocomplete doesn't also help here. So an advanced example of a valid use case would be great.

jonasmerlin commented 1 year ago

@surjithctly Yes, you're right. I'll try to find the time to update the docs a bit.

With regards to your question specifically: the OpenGraph tags mirror how they are structured in the OpenGraph docs, that's why it's a bit weird. In your case you would have both objects:

{
  basic: {
    image: "..."
  },
  image: {
    alt: "..."
  }
}

Hope that helps. Maybe also take a look at the descriptions of each of the possible keys if you haven't yet.

surjithctly commented 1 year ago

yeah, bit weird since it's decoupled. Do you know why next-seo doesn't ask for this alt ?

jonasmerlin commented 1 year ago

@surjithctly The thing is: the message only says that defining image without specifying alt is "stongly discouraged". That wording is important, because actually you can just ignore it. It's just trying to nuge you into using best practices - it's not forcing you to. Putting that in was a decision I made based on feedback by @jonathantneal which I found and still find very valid. Most likely he didn't give that same input to @garmeeh (next-seo's inventor). astro-seo tries to guide you a bit more than next-seo with these kinds of things, which some might not like

jonasmerlin commented 1 year ago

@surjithctly Added a more advanced example to the README with 0.6.1