Skip to content

Commit

Permalink
Merge pull request #97 from stefandoorn/maintenance/xml-support-strict
Browse files Browse the repository at this point in the history
Drop unintended suggestion that other formats than XML are supported
  • Loading branch information
stefandoorn authored Jul 19, 2019
2 parents 67449e1 + a81ccc4 commit 0c4b841
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 19 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,12 @@ sylius_sitemap:

The plugin defines three default URI's:

* `sitemap.{_format}`: redirects to `sitemap_index.{_format}`
* `sitemap_index.{_format}`: renders the sitemap index file (with links to the provider xml files)
* `sitemap/all.{_format}`: renders all the URI's from all providers in a single response
* `sitemap.xml`: redirects to `sitemap_index.xml`
* `sitemap_index.xml`: renders the sitemap index file (with links to the provider xml files)
* `sitemap/all.xml`: renders all the URI's from all providers in a single response

Next to this, each provider registeres it's own URI. Take a look in the sitemap index file for the correct URI's.

NB: Currently only the `xml` format is supported.

## Default configuration

Get a full list of configuration: `bin/console config:dump-reference sitemap`
Expand Down
2 changes: 2 additions & 0 deletions UPGRADE-2.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Plugin structure upgraded to PluginSkeleton:^1.3
* Dropped support for relative URL's
* Models (& their interfaces) renamed
* Drop suggestion that other formats than XML were supported

## New features

Expand All @@ -13,6 +14,7 @@
## Removed features

* Dropped support for relative URL's; Google advises to [use fully qualified URL's](https://support.google.com/webmasters/answer/183668?hl=en).
* Unintentionally the plugin could suggest that other formats than XML were allowed. This was never properly supported and therefore removed.

## Config changes

Expand Down
4 changes: 1 addition & 3 deletions src/Provider/IndexUrlProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ public function addProvider(UrlProviderInterface $provider): void
public function generate(): iterable
{
foreach ($this->providers as $provider) {
$location = $this->router->generate('sylius_sitemap_' . $provider->getName(), [
'_format' => 'xml',
]);
$location = $this->router->generate('sylius_sitemap_' . $provider->getName());

$this->urls[] = $this->sitemapIndexUrlFactory->createNew($location);
}
Expand Down
10 changes: 3 additions & 7 deletions src/Resources/config/routing.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
sylius_sitemap_index:
path: /sitemap_index.{_format}
path: /sitemap_index.xml
methods: [GET]
defaults:
_controller: sylius.controller.sitemap_index:showAction
requirements:
_format: xml

sylius_sitemap_no_index:
path: /sitemap.{_format}
path: /sitemap.xml
defaults:
_controller: FrameworkBundle:Redirect:redirect
route: sylius_sitemap_index
permanent: true

sylius_sitemap_all:
path: /sitemap/all.{_format}
path: /sitemap/all.xml
methods: [GET]
defaults:
_controller: sylius.controller.sitemap:showAction
requirements:
_format: xml

sylius_sitemap_providers:
resource: .
Expand Down
6 changes: 2 additions & 4 deletions src/Routing/SitemapLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,12 @@ public function load($resource, $type = null): RouteCollection
$routes->add(
$name,
new Route(
'/sitemap/' . $provider->getName() . '.{_format}',
'/sitemap/' . $provider->getName() . '.xml',
[
'_controller' => 'sylius.controller.sitemap:showAction',
'name' => $provider->getName(),
],
[
'_format' => 'xml',
],
[],
[],
'',
[],
Expand Down

0 comments on commit 0c4b841

Please sign in to comment.