You’ve probably noticed that Magento has the ability to create XML Sitemaps from the admin interface.
Whilst it gives you the option to specify a name, do so, and it will automatically reject it with the error Path is not available and cannot be used
. Why?
Magento has a way of restricting what files are allowed to be for public viewing – done within it’s own XML configuration.
I recently wanted to create a sitemap_en.xml
and sitemap_de.xml
for a client, but couldn’t do so because of this.
As the configuration is handled via XML, we can over-ride this and add our own exemptions in. To do this, create a module, and in the config.xml
fil, add the following.
1 2 3 4 5 6 7 8 9 10 11 12 |
<default> <general> <file> <sitemap_generate_valid_paths> <available> <en_path>/*/sitemap_en.xml</en_path> <de_path>/*/sitemap_de.xml</de_path> </available> </sitemap_generate_valid_paths> </file> </general> </default> |
This will then allow the addition of the two files – sitemap_en.xml
and sitemap_de.xml
– within any folder structure of the site.
Of course, doing this means you do need to pre-define the filenames. If you add a new language for example, you’ll need to update the configuratiuon.
Image Credit: Images George Rex
Comment or tweet @douglasradburn