Sitemap is empty #372
Replies: 4 comments 2 replies
-
Hey, @adnanusstokyo Can you show your implementation? |
Beta Was this translation helpful? Give feedback.
-
I get an empty sitemap too. I'm trying to generate the sitemap using this code: SitemapGenerator::create(config('app.url'))
->configureCrawler(function (Crawler $crawler) {
$crawler->ignoreRobots();
})
->writeToFile(public_path('sitemap.xml')); The Do you know what can cause this? I'm using Sail to dev, could it be related? Thanks! |
Beta Was this translation helpful? Give feedback.
-
same issue on laravel breeze with vite and reactjs code that creates empty sitemap SitemapGenerator::create(config('app.url'))->getSitemap()->writeToDisk('public', 'sitemap.xml'); |
Beta Was this translation helpful? Give feedback.
-
Same issue with running php command in docker compose. It's happen because package request site by provided url. Make sure that site can requested from your script: use Illuminate\Support\Facades\Http;
dd(Http::get(config('app.url'))->status()); |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
After running the code:
SitemapGenerator::create(url('/'))->writeToFile("sitemap.xml");
A file named sitemap.xml is created on root of project, but it has only this content:
<?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/my_project_name</loc> <lastmod>2021-03-16T10:41:22+00:00</lastmod> <changefreq>daily</changefreq> <priority>0.8</priority> </url> </urlset>
Beta Was this translation helpful? Give feedback.
All reactions