BitBagCommerce / SyliusCmsPlugin

Content management system for eCommerce apps created on Sylius platform. Built with Sylius code quality, flexibility, BDD.
MIT License
237 stars 159 forks source link

Sections URL should not be generated in sitemap #473

Closed David-Crty closed 1 year ago

David-Crty commented 1 year ago

Because of this file, we are generating a cms_sections XML sitemap with URLs like /{_locale}/section/{code}. When you try to access the URL, you get a 500 because there is no $template variable. You get an error like Unable to find template "/show.html.twig" (looked into: /app/vendor/knplabs/knp-menu/src/Knp/Menu/Resources/views, /app/templates, /app/templates, /app/vendor/symfony/twig-bridge/Resources/views/Form).

IMHO, we should not generate section URLs in the sitemap, as the doc says. The sections look to be rendered using TWIG, e.g.: {{ render(path('bitbag_sylius_cms_plugin_shop_block_index_by_section_code', {'sectionCode' : 'blog', 'template' : '@BitBagSyliusCmsPlugin/Shop/Block/index.html.twig'})) }}

I could make a PR removing the URL section generation in the sitemap; what do you think?

For now, to avoid thous URLs to be added in the sitemap, I did a $container->removeDefinition('bitbag_sylius_cms_plugin.sitemap_provider.section');

liszkapawel commented 1 year ago

Hello @David-Crty, If you are able to prepare a pull request, I will be grateful :)

MacBalc commented 1 year ago

@David-Crty could you take a look at PR i have prepped? Is this something addressing your issue?

David-Crty commented 1 year ago

@David-Crty could you take a look at PR i have prepped? Is this something addressing your issue?

Yes this will fix the issue, thanks for your PR :heart:

I will close this issue when https://github.com/BitBagCommerce/SyliusCmsPlugin/pull/475 is merged :+1: