Skip to content

Commit

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

pages_players:
path: /{_locale}/players
Expand Down Expand Up @@ -134,8 +134,8 @@ pages_about:
requirements:
_locale: en|es|fr
options:
sitemap: true
_locale: en
sitemap:
_locale: en

pages_legal:
path: /{_locale}/legal
Expand Down
4 changes: 2 additions & 2 deletions 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'])) {
if (isset($val['options']['sitemap']) && $val['options']['sitemap']) {
$locale = explode('|', $val['options']['_locale']);
if (isset($val['options']['sitemap'])) {
$locale = explode('|', $val['options']['sitemap']['_locale']);
foreach ($locale as $item) {
$urls[] = [
'loc' => $this->generateUrl($key, ['_locale' => $item], UrlGeneratorInterface::ABSOLUTE_URL),
Expand Down

0 comments on commit ea3133c

Please sign in to comment.