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-renderYou 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::classThen run the crawler to pre-render your site:
php artisan prerender:crawlYou 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 testContributions 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.