Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wdebusschere opened this issue Jun 5, 2024 · 0 comments
Open
Labels
type: bug 🐛 Is a bug; fixes a bug

Comments

@wdebusschere
Copy link

wdebusschere commented Jun 5, 2024

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

@wdebusschere wdebusschere changed the title No self-referencing hreflang for urls with query parameters Do not serve hreflang information if the url is not a canonical url Jun 5, 2024
@tobimori tobimori added the type: bug 🐛 Is a bug; fixes a bug label Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug 🐛 Is a bug; fixes a bug
Projects
None yet
Development

No branches or pull requests

2 participants