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

localized version of a webpage #67

Closed C0casio45 closed 1 year ago

C0casio45 commented 1 year ago

ref : https://developers.google.com/search/docs/specialty/international/localized-versions?hl=fr

<link rel="alternate" hreflang="en-gb"
       href="https://en-gb.example.com/page.html" />
  <link rel="alternate" hreflang="en-us"
       href="https://en-us.example.com/page.html" />
  <link rel="alternate" hreflang="en"
       href="https://en.example.com/page.html" />
  <link rel="alternate" hreflang="de"
       href="https://de.example.com/page.html" />
 <link rel="alternate" hreflang="x-default"
       href="https://www.example.com/" />

This feature can be implemented by using an array as input or defining each country code and giving the url (following next example)

<SEO
   alternate= {{
       en: "https://en.example.com/page.html",
       en_US: "https://en-us.example.com/page.html",
       de: "https://de.example.com/page.html",
       default: "https://www.example.com/"
   }}
/>
jonasmerlin commented 1 year ago

@C0casio45 Thanks for the suggestion, makes sense! I can take a look at this once I have the time to work on the next version, which might take a while. Or you might take a crack at adding this via a PR and I'll try to merge it asap (I think this shouldn't be too difficult to add). Your call!

C0casio45 commented 1 year ago

Sounds great, I am working on it this week end

C0casio45 commented 1 year ago

done #68

C0casio45 commented 1 year ago

Hey @jonasmerlin , Waiting for your approval

jonasmerlin commented 1 year ago

Hey @C0casio45, sorry I dropped the ball on this one. Only saw your PR today. Thank you for looking into this! I fixed a few issues with your PR, so if you're interested what has changes, take a look.

I will release a new version with the changes.