Skip to content

Commit

Permalink
Add default locale itself as hreflang too when using alternate option (
Browse files Browse the repository at this point in the history
  • Loading branch information
taylankasap committed Feb 25, 2021
1 parent 63f54b8 commit fb83304
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
4 changes: 0 additions & 4 deletions EventListener/StaticRoutesAlternateEventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ public function addAlternate(SitemapAddUrlEvent $event): void
)
);
foreach ($this->options['locales'] as $alternate) {
if ($alternate === $locale) {
continue; // avoid re-adding default route
}

$url->addLink($this->generateTranslatedRouteUrl($translatedName, $alternate), $alternate);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function testTranslatedUrls(
public function translated(): \Generator
{
$options = ['lastmod' => null, 'changefreq' => null, 'priority' => null];
$xml = '<url><loc>https://acme.org/about</loc><xhtml:link rel="alternate" hreflang="fr" href="https://acme.org/a-propos" /></url>';
$xml = '<url><loc>https://acme.org/about</loc><xhtml:link rel="alternate" hreflang="en" href="https://acme.org/about" /><xhtml:link rel="alternate" hreflang="fr" href="https://acme.org/a-propos" /></url>';
yield [
self::SYMFONY_OPTIONS,
'about.en',
Expand Down

0 comments on commit fb83304

Please sign in to comment.