tobimori / kirby-seo

🔎 All-in-one toolkit that makes implementing SEO & Meta best practices in your Kirby 4+ site a breeze
https://plugins.andkindness.com/seo
MIT License
82 stars 10 forks source link

Do not serve hreflang information if the url is not a canonical url #98

Open wdebusschere opened 3 months ago

wdebusschere commented 3 months ago

Problem: No self-referencing hreflang for urls with query parameters

Example url https://www.domain.be/fr/devis?activity=activity1

If a URL is not a canonical URL - meaning is has parameters and links to a clean URL via link rel="canonical" → do not serve hreflang information.

Hreflang:

<link href="https://www.domain.be/fr/devis" rel="canonical">
<link href="https://www.domain.be/en/quotation" hreflang="en" rel="alternate">
<link href="https://www.domain.be/fr/devis" hreflang="fr" rel="alternate">
<link href="https://www.domain.be/nl/offerte" hreflang="nl" rel="alternate">
<link href="https://www.domain.be/en/quotation" hreflang="x-default" rel="alternate">

Hreflang should be:

<link href="https://www.domain.be/fr/devis" rel="canonical">

Right now i just added this if ($_SERVER['QUERY_STRING'] == "") in the code