Skip to content

Commit

Permalink
Fixed the sitemap urls
Browse files Browse the repository at this point in the history
  • Loading branch information
programarivm committed May 3, 2024
1 parent 16acc25 commit 18fb5af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions config/routes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ pages_play_online:
requirements:
_locale: en|es|fr
options:
sitemap: true
sitemap: true
_locale: en|es|fr

pages_players:
path: /{_locale}/players
Expand Down Expand Up @@ -131,9 +132,10 @@ pages_about:
controller: App\Controller\Pages\AboutController::index
methods: GET
requirements:
_locale: en
_locale: en|es|fr
options:
sitemap: true
sitemap: true
_locale: en

pages_legal:
path: /{_locale}/legal
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/SitemapController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public function index(): Response
$routes = Yaml::parseFile("../config/routes.yaml");
foreach ($routes as $key => $val) {
if (isset($val['requirements'])) {
$locale = explode('|', $val['requirements']['_locale']);
if (isset($val['options']['sitemap']) && $val['options']['sitemap']) {
$locale = explode('|', $val['options']['_locale']);
foreach ($locale as $item) {
$urls[] = [
'loc' => $this->generateUrl($key, ['_locale' => $item], UrlGeneratorInterface::ABSOLUTE_URL),
Expand Down

0 comments on commit 18fb5af

Please sign in to comment.