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

exclude shop booster params from canonical check #1191

Merged
merged 1 commit into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions meta/documents/changelog_de.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Release Notes für IO

## v5.0.62 (2024-XX-XX) <a href="https://github.com/plentymarkets/plugin-io/compare/5.0.61...5.0.62" target="_blank" rel="noopener"><b>Übersicht aller Änderungen</b></a>

### Behoben

- Ein Fehler bei der Prüfung von kanonischen Urls in Kombination mit ausgeschlossenen ShopBooster Parametern, kann zu fehlenden alternate links führen. Dies wurde behoben.

## v5.0.61 (2023-10-30) <a href="https://github.com/plentymarkets/plugin-io/compare/5.0.60...5.0.61" target="_blank" rel="noopener"><b>Übersicht aller Änderungen</b></a>

### Behoben
Expand Down
6 changes: 6 additions & 0 deletions meta/documents/changelog_en.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Release Notes for IO

## v5.0.62 (2023-XX-XX) <a href="https://github.com/plentymarkets/plugin-io/compare/5.0.61...5.0.62" target="_blank" rel="noopener"><b>Overview of all changes</b></a>

### Fixed

- An error when checking canonical urls in combination with excluded ShopBooster parameters can lead to missing alternate links. This was fixed.

## v5.0.61 (2023-10-30) <a href="https://github.com/plentymarkets/plugin-io/compare/5.0.60...5.0.61" target="_blank" rel="noopener"><b>Overview of all changes</b></a>

### Fixed
Expand Down
13 changes: 12 additions & 1 deletion src/Services/UrlService.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,19 @@ public function isCanonical($lang = null)
$request = pluginApp(Request::class);
$requestUri = $request->getRequestUri();

$url = explode('?', $requestUri)[0];

$queryParameters = $request->query();
$queryParameters = Utils::cleanUpExcludesContentCacheParams($queryParameters);
$queryParameters = http_build_query($queryParameters, null, '&', PHP_QUERY_RFC3986);
if (strlen($queryParameters) > 0)
{
$url .= '?' . $queryParameters;
}


/** @var UrlQuery $urlQuery */
$urlQuery = pluginApp(UrlQuery::class, ['path' => $requestUri]);
$urlQuery = pluginApp(UrlQuery::class, ['path' => $url]);
$requestUrl = $urlQuery->toAbsoluteUrl($lang !== $defaultLanguage);
$canonical = $this->getCanonicalURL($lang);

Expand Down
Loading