Automatically Laravel Create dynamic generate sitemap

Automatically Laravel Create dynamic generate sitemap

In this Post We Will Explain About is Automatically Laravel Create dynamic generate sitemapBuilding a Search Engine Friendly Sitemap XML with Laravel With Example and Demo.Welcome on – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Example

In this post we will show you Best way to implement Generate a sitemap -> use Blade for xml-document, hear for Automatically generate a sitemap in Laravel 5with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Therefore, let’s follow some source code following Phase as well as use it. i provide just two Phase one for installing packages as well as second one for some example of sitemap generate.Laravel 5 generate sitemap using live24u/sitemap package Example

Also Read :  Angularjs Store in Localstorage - ngStorage

Step 1: Installation Package

first We have to fire following commas well as on We terminal as well as get latest version of “live24u/sitemap” package.

composer require live24u/sitemap

Add ServiceProvider

Ok, And then open config/app.php file as well as add service provider of That package.

'providers' => [

	....some code



Publish Config File

following commas well as through We may create publish config file of “live24u/sitemap” package. after fire That commas well as We may see one file app/config/sitemap.php as well as We may change We own setting.

php artisan vendor:publish --provider="Roumen\Sitemap\SitemapServiceProvider"

Step 2: Example With Route

In Last Phase i provide example of how to generate sitmap. so first open app/Http/routes.php as well as add following route.

Also Read :  PHP Simple Image Upload and Display Source Code


Route::get('sitemap', function(){

    /*Devloped by create new sitemap object */

    $sitemap = App::make("sitemap");


    /*Devloped by add item to the some sitemap parameters(url, date, priority, freq) */

    $sitemap->add(URL::to('/'), '2020-08-25T20:10:00+02:00', '1.0', 'daily');


    $datamsts = DB::table('datamst')


                    ,'datamst.title as datamstTitle','datamst.slug as datamstSlug'

                    ,'datamst_image.image as image','datamst.updated_at as datamstUpdated_at')






    $data_slug_results = array();


        foreach ($datamsts as $key => $value) {

            $data_slug_results[$value->id]['id'] = $value->id;

            $data_slug_results[$value->id]['slug'] = $value->datamstSlug;

            $data_slug_results[$value->id]['datamstTitle'] = $value->datamstTitle;

            $data_slug_results[$value->id]['datamstUpdated_at'] = $value->datamstUpdated_at;

            $data_slug_results[$value->id]['image'][] = $value->image;




     /*Devloped by add every datamst to the sitemap */

     foreach ($data_slug_results as $key=>$value)


        $images = array();

        foreach ($value['image'] as $key2 => $value2) {

            $images[] = array(

                'url' => URL::to('/')."/uploadImages/datamst/".$value2,

                'title' => $value['slug'],

                'caption' => $value['datamstTitle']



        $sitemap->add(URL::route('front.datamst',$value['slug']), $value['datamstUpdated_at'], '1.0', 'daily', $images);



    /* Devloped by show We are sitemap like as a (options: 'xml' (default), 'html', 'txt', 'ror-rss', 'ror-rdf') */

    return $sitemap->render('xml');


And then We may open sitemap route url as well as check output, it shell be like some preview. we may also get more some information of That data package from here : Wiki

Also Read :  Redirect page after delay using Vuejs


I hope you have Got What is Building a Search Engine Friendly Sitemap XML with Laravel And how it works.I would Like to have FeadBack From My Blog( readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article( Are Most Always Welcome.

Leave a Reply

Notify of