vdaguenet/one-page-seo

此包已被弃用且不再维护。未建议替代包。

使用 PhantomJS 将单页网站的静态内容服务于爬虫(例如 Facebook、Google 或 Twitter)

v1.0 2015-07-20 18:25 UTC

This package is not auto-updated.

Last update: 2023-10-28 12:20:43 UTC


README

将单页网站的静态内容服务于爬虫。

安装

通过 Composer

composer require vdaguenet/one-page-seo

使用方法

在您的 index.php 文件顶部添加以下行

include_once __DIR__ . '/OnePage-SEO/BotDetector.php';

$detector = new BotDetector();
$detector->setServerOS($detector::LINUX);
if($detector->isBot()) {
    $detector->displayStaticContent();
}

在您的javascript中,在您确认 内容已附加 的情况下添加以下行

if(typeof window.callPhantom === 'function') window.callPhantom();

包含什么?

PhantomJS

  • mac 版本 2.0.0
  • linux 版本 1.9.8

您可以从 官方仓库 下载其他构建版本