appstract/laravel-crawl-render

This package is abandoned and no longer maintained. No replacement package was suggested.

Pre-render your site for web crawlers

0.1.4 2018-04-25 12:23 UTC

This package is auto-updated.

Last update: 2022-06-23 04:46:16 UTC


README

Latest Version on Packagist Total Downloads Software License

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.

Installation

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

Usage

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');
}

Testing

composer test

Contributing

Contributions are welcome, thanks to y'all :)

About Appstract

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.

License

The MIT License (MIT). Please see License File for more information.