feat(commands): add GenerateSitemapCommand for sitemap generation

- Added GenerateSitemapCommand to create sitemap.xml
- Updated Kernel to schedule sitemap generation weekly
- Updated composer.json with spatie/laravel-sitemap dependency
This commit is contained in:
Rico van Zelst
2024-02-26 17:48:22 +01:00
parent d7f03d3315
commit c6f9423241
5 changed files with 31598 additions and 1 deletions

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Spatie\Sitemap\SitemapGenerator;
class GenerateSitemapCommand extends Command
{
protected $signature = 'sitemap:generate';
protected $description = 'Command description';
public function handle(): void
{
SitemapGenerator::create('https://heimerdinger.lol')
->writeToFile(public_path('sitemap.xml'));
}
}

View File

@@ -13,6 +13,8 @@ class Kernel extends ConsoleKernel
protected function schedule(Schedule $schedule): void protected function schedule(Schedule $schedule): void
{ {
$schedule->command('db:seed --force')->twiceDaily(1, 13)->timezone('Europe/Amsterdam'); $schedule->command('db:seed --force')->twiceDaily(1, 13)->timezone('Europe/Amsterdam');
$schedule->command('sitemap:generate')->weekly();
} }
/** /**

View File

@@ -30,6 +30,7 @@
"spatie/laravel-discord-alerts": "^1.3", "spatie/laravel-discord-alerts": "^1.3",
"spatie/laravel-honeypot": "^4.4", "spatie/laravel-honeypot": "^4.4",
"spatie/laravel-query-builder": "^5.6", "spatie/laravel-query-builder": "^5.6",
"spatie/laravel-sitemap": "^7.2",
"spatie/sheets": "^1.10", "spatie/sheets": "^1.10",
"sqids/sqids": "^0.4.1" "sqids/sqids": "^0.4.1"
}, },

459
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "2954259235d0a0b20a9f886137583fec", "content-hash": "5373c6d42488f4f14f2e1dcd41d929f5",
"packages": [ "packages": [
{ {
"name": "andcarpi/laravel-popper", "name": "andcarpi/laravel-popper",
@@ -3297,6 +3297,73 @@
], ],
"time": "2024-01-02T14:29:17+00:00" "time": "2024-01-02T14:29:17+00:00"
}, },
{
"name": "masterminds/html5",
"version": "2.8.1",
"source": {
"type": "git",
"url": "https://github.com/Masterminds/html5-php.git",
"reference": "f47dcf3c70c584de14f21143c55d9939631bc6cf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Masterminds/html5-php/zipball/f47dcf3c70c584de14f21143c55d9939631bc6cf",
"reference": "f47dcf3c70c584de14f21143c55d9939631bc6cf",
"shasum": ""
},
"require": {
"ext-dom": "*",
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35 || ^5.7.21 || ^6 || ^7 || ^8"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.7-dev"
}
},
"autoload": {
"psr-4": {
"Masterminds\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Matt Butcher",
"email": "technosophos@gmail.com"
},
{
"name": "Matt Farina",
"email": "matt@mattfarina.com"
},
{
"name": "Asmir Mustafic",
"email": "goetas@gmail.com"
}
],
"description": "An HTML5 parser and serializer.",
"homepage": "http://masterminds.github.io/html5-php",
"keywords": [
"HTML5",
"dom",
"html",
"parser",
"querypath",
"serializer",
"xml"
],
"support": {
"issues": "https://github.com/Masterminds/html5-php/issues",
"source": "https://github.com/Masterminds/html5-php/tree/2.8.1"
},
"time": "2023-05-10T11:58:31+00:00"
},
{ {
"name": "monolog/monolog", "name": "monolog/monolog",
"version": "3.5.0", "version": "3.5.0",
@@ -3720,6 +3787,60 @@
}, },
"time": "2023-02-02T10:41:53+00:00" "time": "2023-02-02T10:41:53+00:00"
}, },
{
"name": "nicmart/tree",
"version": "0.8.0",
"source": {
"type": "git",
"url": "https://github.com/nicmart/Tree.git",
"reference": "8d02952acc9779a2c14f7a9c4ac1650c3dacb545"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nicmart/Tree/zipball/8d02952acc9779a2c14f7a9c4ac1650c3dacb545",
"reference": "8d02952acc9779a2c14f7a9c4ac1650c3dacb545",
"shasum": ""
},
"require": {
"php": "~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0"
},
"require-dev": {
"ergebnis/composer-normalize": "^2.31.0",
"ergebnis/license": "^2.4.0",
"ergebnis/php-cs-fixer-config": "^6.13.0",
"fakerphp/faker": "^1.23.0",
"infection/infection": "~0.26.19",
"phpunit/phpunit": "^9.6.14",
"psalm/plugin-phpunit": "~0.18.4",
"vimeo/psalm": "^5.16.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Tree\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolò Martini",
"email": "nicmartnic@gmail.com"
},
{
"name": "Andreas Möller",
"email": "am@localheinz.com"
}
],
"description": "A basic but flexible php tree data structure and a fluent tree builder implementation.",
"support": {
"issues": "https://github.com/nicmart/Tree/issues",
"source": "https://github.com/nicmart/Tree/tree/0.8.0"
},
"time": "2023-12-02T13:24:56+00:00"
},
{ {
"name": "nikic/php-parser", "name": "nikic/php-parser",
"version": "v4.18.0", "version": "v4.18.0",
@@ -4872,6 +4993,141 @@
], ],
"time": "2024-01-17T10:50:36+00:00" "time": "2024-01-17T10:50:36+00:00"
}, },
{
"name": "spatie/browsershot",
"version": "4.0.1",
"source": {
"type": "git",
"url": "https://github.com/spatie/browsershot.git",
"reference": "04b3527022dc31daae425f22a328fed646dc3cac"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/browsershot/zipball/04b3527022dc31daae425f22a328fed646dc3cac",
"reference": "04b3527022dc31daae425f22a328fed646dc3cac",
"shasum": ""
},
"require": {
"ext-fileinfo": "*",
"ext-json": "*",
"php": "^8.2",
"spatie/temporary-directory": "^2.0",
"symfony/process": "^6.0|^7.0"
},
"require-dev": {
"pestphp/pest": "^1.20",
"spatie/image": "^3.3",
"spatie/phpunit-snapshot-assertions": "^4.2.3"
},
"type": "library",
"autoload": {
"psr-4": {
"Spatie\\Browsershot\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Freek Van der Herten",
"email": "freek@spatie.be",
"homepage": "https://github.com/freekmurze",
"role": "Developer"
}
],
"description": "Convert a webpage to an image or pdf using headless Chrome",
"homepage": "https://github.com/spatie/browsershot",
"keywords": [
"chrome",
"convert",
"headless",
"image",
"pdf",
"puppeteer",
"screenshot",
"webpage"
],
"support": {
"source": "https://github.com/spatie/browsershot/tree/4.0.1"
},
"funding": [
{
"url": "https://github.com/spatie",
"type": "github"
}
],
"time": "2024-01-02T17:36:56+00:00"
},
{
"name": "spatie/crawler",
"version": "8.2.0",
"source": {
"type": "git",
"url": "https://github.com/spatie/crawler.git",
"reference": "807d145a3c071dc0e69bb7e6783611e2591f9773"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/crawler/zipball/807d145a3c071dc0e69bb7e6783611e2591f9773",
"reference": "807d145a3c071dc0e69bb7e6783611e2591f9773",
"shasum": ""
},
"require": {
"guzzlehttp/guzzle": "^7.3",
"guzzlehttp/psr7": "^2.0",
"illuminate/collections": "^10.0|^11.0",
"nicmart/tree": "^0.8.0",
"php": "^8.1",
"spatie/browsershot": "^3.45|^4.0",
"spatie/robots-txt": "^2.0",
"symfony/dom-crawler": "^6.0|^7.0"
},
"require-dev": {
"pestphp/pest": "^2.0",
"spatie/ray": "^1.37"
},
"type": "library",
"autoload": {
"psr-4": {
"Spatie\\Crawler\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Freek Van der Herten",
"email": "freek@spatie.be"
}
],
"description": "Crawl all internal links found on a website",
"homepage": "https://github.com/spatie/crawler",
"keywords": [
"crawler",
"link",
"spatie",
"website"
],
"support": {
"issues": "https://github.com/spatie/crawler/issues",
"source": "https://github.com/spatie/crawler/tree/8.2.0"
},
"funding": [
{
"url": "https://spatie.be/open-source/support-us",
"type": "custom"
},
{
"url": "https://github.com/spatie",
"type": "github"
}
],
"time": "2024-02-15T10:40:48+00:00"
},
{ {
"name": "spatie/db-dumper", "name": "spatie/db-dumper",
"version": "3.4.2", "version": "3.4.2",
@@ -5405,6 +5661,140 @@
], ],
"time": "2023-01-14T21:10:59+00:00" "time": "2023-01-14T21:10:59+00:00"
}, },
{
"name": "spatie/laravel-sitemap",
"version": "7.2.0",
"source": {
"type": "git",
"url": "https://github.com/spatie/laravel-sitemap.git",
"reference": "4f79443e76a677731edfb4e89fac8816d11e194b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/laravel-sitemap/zipball/4f79443e76a677731edfb4e89fac8816d11e194b",
"reference": "4f79443e76a677731edfb4e89fac8816d11e194b",
"shasum": ""
},
"require": {
"guzzlehttp/guzzle": "^7.8",
"illuminate/support": "^10.0|^11.0",
"nesbot/carbon": "^2.71|^3.0",
"php": "^8.2",
"spatie/crawler": "^8.0.1",
"spatie/laravel-package-tools": "^1.16.1",
"symfony/dom-crawler": "^6.3.4|^7.0"
},
"require-dev": {
"mockery/mockery": "^1.6.6",
"orchestra/testbench": "^8.14|^9.0",
"pestphp/pest": "^2.24",
"spatie/pest-plugin-snapshots": "^2.1",
"spatie/phpunit-snapshot-assertions": "^5.1.2",
"spatie/temporary-directory": "^2.2"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Spatie\\Sitemap\\SitemapServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Spatie\\Sitemap\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Freek Van der Herten",
"email": "freek@spatie.be",
"homepage": "https://spatie.be",
"role": "Developer"
}
],
"description": "Create and generate sitemaps with ease",
"homepage": "https://github.com/spatie/laravel-sitemap",
"keywords": [
"laravel-sitemap",
"spatie"
],
"support": {
"source": "https://github.com/spatie/laravel-sitemap/tree/7.2.0"
},
"funding": [
{
"url": "https://spatie.be/open-source/support-us",
"type": "custom"
}
],
"time": "2024-02-15T10:50:21+00:00"
},
{
"name": "spatie/robots-txt",
"version": "2.0.3",
"source": {
"type": "git",
"url": "https://github.com/spatie/robots-txt.git",
"reference": "dacba2ba159364987392aa1b0002e196c5923970"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/robots-txt/zipball/dacba2ba159364987392aa1b0002e196c5923970",
"reference": "dacba2ba159364987392aa1b0002e196c5923970",
"shasum": ""
},
"require": {
"php": "^8.0"
},
"require-dev": {
"larapack/dd": "^1.0",
"phpunit/phpunit": "^8.0 || ^9.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Spatie\\Robots\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Brent Roose",
"email": "brent@spatie.be",
"homepage": "https://spatie.be",
"role": "Developer"
}
],
"description": "Determine if a page may be crawled from robots.txt and robots meta tags",
"homepage": "https://github.com/spatie/robots-txt",
"keywords": [
"robots-txt",
"spatie"
],
"support": {
"issues": "https://github.com/spatie/robots-txt/issues",
"source": "https://github.com/spatie/robots-txt/tree/2.0.3"
},
"funding": [
{
"url": "https://spatie.be/open-source/support-us",
"type": "custom"
},
{
"url": "https://github.com/spatie",
"type": "github"
}
],
"time": "2023-11-22T12:57:35+00:00"
},
{ {
"name": "spatie/sheets", "name": "spatie/sheets",
"version": "1.11.1", "version": "1.11.1",
@@ -6060,6 +6450,73 @@
], ],
"time": "2023-05-23T14:45:45+00:00" "time": "2023-05-23T14:45:45+00:00"
}, },
{
"name": "symfony/dom-crawler",
"version": "v7.0.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/dom-crawler.git",
"reference": "3330a8f836e7631412c5e07f69b88480d27a20a2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/3330a8f836e7631412c5e07f69b88480d27a20a2",
"reference": "3330a8f836e7631412c5e07f69b88480d27a20a2",
"shasum": ""
},
"require": {
"masterminds/html5": "^2.6",
"php": ">=8.2",
"symfony/polyfill-ctype": "~1.8",
"symfony/polyfill-mbstring": "~1.0"
},
"require-dev": {
"symfony/css-selector": "^6.4|^7.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\DomCrawler\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Eases DOM navigation for HTML and XML documents",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/dom-crawler/tree/v7.0.3"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2024-01-23T15:02:46+00:00"
},
{ {
"name": "symfony/error-handler", "name": "symfony/error-handler",
"version": "v6.4.3", "version": "v6.4.3",

31118
public/sitemap.xml Normal file

File diff suppressed because it is too large Load Diff