0

This is my code in Laravel :

 SitemapGenerator::create('https://'.request()->getHost())->writeToFile(request()->getHost().'.xml');

After generating the sitemap I am getting this type of URLs

<url>
        <loc>https://example.com/login?redirectTo=https://example.com/posts/wvj/test</loc>
        <lastmod>2021-01-20T19:39:59+06:00</lastmod>
        <changefreq>daily</changefreq>
        <priority>0.8</priority>
    </url>

Thanks

apokryfos
  • 38,771
  • 9
  • 70
  • 114
Valadanchik
  • 33
  • 1
  • 4

1 Answers1

0

Use add method.

SitemapGenerator::create('https://example.com')
   ->getSitemap()
   ->add(Url::create('/extra-page')
        ->setLastModificationDate(Carbon::yesterday())
        ->setChangeFrequency(Url::CHANGE_FREQUENCY_YEARLY)
        ->setPriority(0.1))

    ->add(...)

    ->writeToFile($path);
Dmitry
  • 21
  • 2