Skip to content

Commit

Permalink
Fix missing priority values in sitemaps. Bump to 2.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mmikkel committed Sep 5, 2024
1 parent a0a6421 commit 2f6911d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# SEOMate Changelog

## 2.3.1 - 2024-09-05
### Fixed
- Fixed a regression error introduced in 2.3.0, where SEOMate could fail to render sitemap priority values

## 2.3.0 - 2024-08-24
### Changed
- SEOMate now strips preview and token params from canonical and alternate URLs
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vaersaagod/seomate",
"description": "SEO, mate! It's important.",
"type": "craft-plugin",
"version": "2.3.0",
"version": "2.3.1",
"keywords": [
"craft",
"cms",
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/SEOMateHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,10 +348,10 @@ public static function ensureAbsoluteUrl(string $url): string
* @param mixed $url
* @return string
*/
public static function stripTokenParams(mixed $url): string
public static function stripTokenParams(mixed $url): mixed
{
if (empty($url) || !is_string($url)) {
return '';
return $url;
}
$queryParamsToRemove = [
Craft::$app->getConfig()->getGeneral()->tokenParam,
Expand Down
5 changes: 4 additions & 1 deletion src/helpers/SitemapHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,10 @@ public static function addUrlsToSitemap(\DOMDocument $document, \DOMElement $sit
unset($url['alternate']);

foreach ($url as $key => $val) {
$node = $document->createElement($key, SEOMateHelper::stripTokenParams($val));
if ($key === 'loc') {
$val = SEOMateHelper::stripTokenParams($val);
}
$node = $document->createElement($key, $val);
$topNode->appendChild($node);
}

Expand Down

0 comments on commit 2f6911d

Please sign in to comment.