Skip to content

Commit

Permalink
Fix missing priority values in sitemaps. Bump to 3.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mmikkel committed Sep 5, 2024
1 parent 4cc4b18 commit 6f08949
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

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

## 3.1.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": "3.1.0",
"version": "3.1.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 @@ -478,10 +478,10 @@ public static function isElementPreviewable(ElementInterface $element): bool
* @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 @@ -222,7 +222,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

1 comment on commit 6f08949

@ymilin
Copy link

@ymilin ymilin commented on 6f08949 Sep 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the quick fix!

Please sign in to comment.