Skip to content
This repository has been archived by the owner on May 25, 2022. It is now read-only.

Latest commit

 

History

History
60 lines (40 loc) · 2.29 KB

README.md

File metadata and controls

60 lines (40 loc) · 2.29 KB

[Wip] Laravel Crawler Pre-render

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.