From 87b5264cdc451f4268722e670a6f77d8e3d1c334 Mon Sep 17 00:00:00 2001 From: horus Date: Thu, 11 Feb 2021 22:57:49 +0100 Subject: Upgrade to Laravel 8.0 and generate sitemap.xml. --- app/Console/Commands/GenerateSitemap.php | 52 ++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 app/Console/Commands/GenerateSitemap.php (limited to 'app/Console') diff --git a/app/Console/Commands/GenerateSitemap.php b/app/Console/Commands/GenerateSitemap.php new file mode 100644 index 0000000..46bb0ac --- /dev/null +++ b/app/Console/Commands/GenerateSitemap.php @@ -0,0 +1,52 @@ +shouldCrawl(function (UriInterface $url) { + /** + * Prevent the crawler from crawling the random pages. + */ + return strpos($url->getPath(), '/random') === false; + }) + ->writeToFile(public_path('sitemap.xml')); + } +} -- cgit v1.2.3