0

I have installed a fresh Laravel (v 6.7) project and then installed this package spatie/laravel-sitemap. So then as in the documentation I have added below code into my route file web.php file

use Spatie\Sitemap\SitemapGenerator;

Route::get('/sitemap', function () {
ini_set('max_execution_time', 300); // 5 minutes
SitemapGenerator::create('http://sandrianaplantations.com/')->writeToFile('sitemap.xml');
return 'completed';
});

Then when I check sitemap.xml file it has below content

    <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>http://sandrianaplantations.com/</loc>
<lastmod>2019-12-17T06:35:43+00:00</lastmod>
<changefreq>daily</changefreq>
<priority>0.8</priority>
</url>
</urlset>

But if I generate the site map for above url via XML-sitemap.com it generate below content

  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<!--
 created with Free Online Sitemap Generator www.xml-sitemaps.com 
-->
<url>
<loc>https://sandrianaplantations.com/</loc>
<lastmod>2019-12-17T06:33:44+00:00</lastmod>
<priority>1.00</priority>
</url>
<url>
<loc>https://sandrianaplantations.com/About-us/</loc>
<lastmod>2019-12-17T06:33:44+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://sandrianaplantations.com/Gallery/</loc>
<lastmod>2019-12-17T06:33:44+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://sandrianaplantations.com/Contacts/</loc>
<lastmod>2019-12-17T06:33:44+00:00</lastmod>
<priority>0.80</priority>
</url>
</urlset>

So could anyone please tell me if Im making any mistakes in my route file.(web.php) .I have gone through there official document. But nothing can be found. Also gone through YouTube too. Also below questions were almost checked.

question 01

question 02

apokryfos
  • 38,771
  • 9
  • 70
  • 114
Nipun Tharuksha
  • 2,496
  • 4
  • 17
  • 40

1 Answers1

0

note : this package generate other site not self site! but have a trick in doc package

spatie/laravel-sitemap Configuring the crawler The crawler itself can be configured to do a few different things.

sajjad
  • 477
  • 5
  • 12