Setup

With Sitemap everything is also as easy as other components. Run the following artisan command:
php artisan generate:sitemap
The command will generate a sitemap.xml in the public folder. It uses APP_URL from config files to generate a sitemap. If you want to generate a sitemap for your production locally, change the $url variable in the app/Console/Commands/GenerateSitemap.php file. For more details about sitemap check the spatie/laravel-sitemap package.
Don’t forget to submit your sitemap.xml to Google Search Console {yourdomain}/sitemap.xml