https://github.com/leowebguy/craft-crawler-detect
https://github.com/leowebguy/craft-crawler-detect
craft-cms craft-cms-plugin craft-plugin craft4 craft5 craftcms
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/leowebguy/craft-crawler-detect
- Owner: leowebguy
- Created: 2020-03-03T01:28:40.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2024-03-27T03:48:06.000Z (about 2 years ago)
- Last Synced: 2025-10-28T17:25:33.583Z (8 months ago)
- Topics: craft-cms, craft-cms-plugin, craft-plugin, craft4, craft5, craftcms
- Language: PHP
- Homepage:
- Size: 29.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# CrawlerDetect plugin for Craft
Craft plugin for detecting bots/crawlers/spiders
---
### Installation
Open your terminal and go to your Craft project:
```bash
cd /path/to/project
```
Then tell Composer to load the plugin:
```bash
composer require leowebguy/craft-crawler-detect
```
In the Control Panel, go to Settings → Plugins and click the “Install” button for Crawler Detect.
---
### Overview
A wrapper for the [CrawlerDetect](https://github.com/JayBizzle/Crawler-Detect) by Mark Beech.
---
### Usage
The plugin exposes a Crawler Detect's methods:
```twig
{{ craft.crawlerDetect.isCrawler ? 'I am a crawler.' : 'I am not crawler.' }}
```
```twig
{% if craft.crawlerDetect.isCrawler %} I am a crawler. {% endif %}
```
Also passing user agent as string:
```twig
{% if craft.crawlerDetect.isCrawler('Mozilla/5.0 (compatible; Sosospider/2.0; +http://help.soso.com/webspider.htm)') %} I am a crawler. {% endif %}
```