48 lines
1.1 KiB
PHP
48 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use Illuminate\Console\Command;
|
|
use Spatie\Sitemap\SitemapGenerator;
|
|
use Spatie\Crawler\Crawler;
|
|
use Spatie\Sitemap\Tags\Url;
|
|
use SevenSpan\Matomo\Facades\Matomo;
|
|
|
|
class IkeaSitemap extends Command
|
|
{
|
|
/**
|
|
* The name and signature of the console command.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $signature = 'ikea:sitemap {path}';
|
|
|
|
/**
|
|
* The console command description.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $description = 'Command description';
|
|
|
|
/**
|
|
* Execute the console command.
|
|
*
|
|
* @return int
|
|
*/
|
|
public function handle()
|
|
{
|
|
$path = $this->argument('path');
|
|
|
|
SitemapGenerator::create('https://prices.soson.eu')
|
|
->configureCrawler(function (Crawler $crawler) {
|
|
$crawler->ignoreRobots();
|
|
})
|
|
->getSitemap()
|
|
->add(Url::create('https://prices.soson.eu/about/')->setPriority(0.7))
|
|
->add(Url::create('https://prices.soson.eu/exchange/')->setPriority(0.5))
|
|
->add(Url::create('https://prices.soson.eu/doc/')->setPriority(0.8))
|
|
->writeToFile($path);
|
|
return 0;
|
|
}
|
|
}
|