A simple package to pre-render your Javascript site for web crawlers like Google bot to improve your SEO.
It uses Spatie's Crawler and Browsershot to crawl your website and store the HTML. Crawlers (detected by Jaybizzle's Crawler Detect) are getting the pre-rendered version served.
You can install the package via composer:
composer require appstract/laravel-crawl-render
You need Puppeteer to be installed for Browsershot to work, see: https://github.com/spatie/browsershot#requirements
First add the middleware to any routes you want to Pre-render.
\Appstract\CrawlRender\Middleware\CrawlerPrerenderMiddleware::class
Then run the crawler to pre-render your site:
php artisan prerender:crawl
You can run this command regularly, for example after a deploy or with a schedule:
// app/console/Kernel.php
protected function schedule(Schedule $schedule)
{
$schedule->command('prerender:crawl')->daily()->at('02:00');
}
composer test
Contributions are welcome, thanks to y'all :)
Appstract is a small team from The Netherlands. We create (open source) tools for webdevelopment and write about related subjects on Medium. You can follow us on Twitter, buy us a beer or support us on Patreon.
The MIT License (MIT). Please see License File for more information.