Laravel Spatie/sitemap 只包含 1 URL
Laravel Spatie/sitemap only contains 1 URL
我正在使用 spatie/sitemap
我这样做是为了通知我站点地图已创建
Route::get('sitemap', function(){
SitemapGenerator::create('http://localhost/')->writeToFile('sitemap.xml');
return "sitemap created"; });
这是我的 APP_URL
APP_URL=http://localhost
我有 2 条路线可以在我 sitemap:generate 时显示,但只有 URL 包含在
中
<?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>
有什么问题吗?我正在使用 windows 10 供您参考
所以当您不使用 localhost:8000 或 127.0.0.1:8000 时它可以工作。您应该使用 laravel 代客更改您的网址 MAC 或更改您的主机 Windows
我正在使用 spatie/sitemap
我这样做是为了通知我站点地图已创建
Route::get('sitemap', function(){
SitemapGenerator::create('http://localhost/')->writeToFile('sitemap.xml');
return "sitemap created"; });
这是我的 APP_URL
APP_URL=http://localhost
我有 2 条路线可以在我 sitemap:generate 时显示,但只有 URL 包含在
中<?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>
有什么问题吗?我正在使用 windows 10 供您参考
所以当您不使用 localhost:8000 或 127.0.0.1:8000 时它可以工作。您应该使用 laravel 代客更改您的网址 MAC 或更改您的主机 Windows