bringyourownideas / laravel-sitemap

Simple crawler and sitemap generator for Laravel. No headless browser - just a crawler.
https://bringyourownideas.com/blog/simple-laravel-sitemap-generator
MIT License
9 stars 4 forks source link

Multi domain sitemap #6

Open MrWeb opened 3 years ago

MrWeb commented 3 years ago

We use the same codebase for more than one site and therefore we have more than one domain.

I'd like to extend the package to accept a url argument, and create a sitemap-{url}.xml file. If the argument is empty the env('APP_URL') is the default url.

I want to know if this is something you can consider me to update or not, so I know what to do. Tks

spekulatius commented 3 years ago

Hello @MrWeb

I haven't run Laravel with multiple domains set up. How does the configuration for this work? Wouldn't this lead to all the sitemap files being public on all of these sites at the same time?

Cheers, Peter

MrWeb commented 3 years ago

Yes, in case you have many domains pointing to the same code in the server, the files will all be in the same folder. If the same code is deployed on different servers/folders then only one file will be created.

We could go with two options php artisan sitemap:generate

and

php artisan sitemap:generate my-site.com

The first one creates a sitemap.xml and looks in the env('APP_URL') as it does currently. The second one looks for that url specified in the command and creates a sitemap-{url}.xml

spekulatius commented 3 years ago

Okay, sounds good @MrWeb. Do you want to start a draft PR?