PrestaSitemapBundle icon indicating copy to clipboard operation
PrestaSitemapBundle copied to clipboard

Creation of sitemap.xml files in sub directory

Open rberneder opened this issue 1 year ago • 4 comments

There is the possibility to set the target directory where the files shall be dumped to. However the links between the generated section-xml-files don't respect that and try link the files from the web root.

Similar to the file prefix a sub-directory config would be great so the created links between each sitemap-file add this sub-directory in each path.

rberneder avatar Apr 04 '23 12:04 rberneder

I think if you are dumping to the sub-dir then you should configure routing prefix to be same in config/routes/presta_sitemap.yaml or where you import the routes

norkunas avatar Apr 04 '23 13:04 norkunas

If I understand correctly, you are proposing to expose the routes to the sitemap generation controller (which generates the sitemap on the fly). Due to the large amount of pages I prefer generating the sitemap.xml files regularly with a cron job:

bin/console presta:sitemaps:dump /var/www/public/sitemap/site-1 --base-url="https://www.site-1.com"

I think all it needs is to have an additional "relative-path-to-sitemap" parameter that is added to all sitemap-section-links.

rberneder avatar Apr 05 '23 08:04 rberneder

From an historical point of view, this bundle was created to serve sitemap on the fly But indeed, we moved to the dump command, because it was too much for an HTTP endpoint This is why there is some code aimed to be working on the HTTP side that still works on dump command So yes, I believe you could put some path in sitemap_file_prefix (ie site-1/sitemap) and it might work

But I think we better rethink this whole thing by making an inventory of all use cases we want to cover, and find a way to rewrite these code parts with new config structure

yann-eugone avatar Apr 24 '23 07:04 yann-eugone

I've the same issue.

It's related with https://github.com/prestaconcept/PrestaSitemapBundle/issues/138

If you set --base-url, it will work. But it's not consistent

BriceFab avatar Oct 18 '23 17:10 BriceFab