Search code examples
laravelsitemaplaravel-sitemap

Laravel Spatie/sitemap only contains 1 URL


I'm using spatie/sitemap

this is what i do to inform me that sitemap is created

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

SitemapGenerator::create('http://localhost/')->writeToFile('sitemap.xml');

return "sitemap created"; });

and this is my APP_URL

APP_URL=http://localhost

i have 2 routes that could show up when i do sitemap:generate, but only this URL that contains in

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
    <url>
        <loc>http://localhost/</loc>
    
    
        <lastmod>2019-03-07T11:54:02+00:00</lastmod>
    
        <changefreq>daily</changefreq>
    
        <priority>0.8</priority>
    </url>
</urlset>

is there anything wrong? i am using windows 10 for your information


Solution

  • So it works when you're not using localhost:8000 or 127.0.0.1:8000. you should change your web address using laravel valet for MAC or change your hosts for Windows