|
|
@ -86,7 +86,7 @@ class Seo {
|
|
|
|
self::route('/', [$this, 'beforePageIndex'], [$this, 'afterPageIndex'], 300);
|
|
|
|
self::route('/', [$this, 'beforePageIndex'], [$this, 'afterPageIndex'], 300);
|
|
|
|
|
|
|
|
|
|
|
|
// 帖子页面
|
|
|
|
// 帖子页面
|
|
|
|
self::route('/thread/@threadId', [$this, 'beforePageThread'], [$this, 'afterPageThread'], 300);
|
|
|
|
self::route('/thread/@threadId:[0-9]+', [$this, 'beforePageThread'], [$this, 'afterPageThread'], 300);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function beforePageIndex() {
|
|
|
|
public function beforePageIndex() {
|
|
|
@ -151,18 +151,7 @@ class Seo {
|
|
|
|
$dom->setOptions($options);
|
|
|
|
$dom->setOptions($options);
|
|
|
|
$dom->loadStr($outputPage);
|
|
|
|
$dom->loadStr($outputPage);
|
|
|
|
|
|
|
|
|
|
|
|
// 增加css
|
|
|
|
|
|
|
|
$appendDom = new Dom();
|
|
|
|
|
|
|
|
$appendDom->setOptions($options);
|
|
|
|
|
|
|
|
$appendDom->loadStr(<<<HTML
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="/seo/style">
|
|
|
|
|
|
|
|
HTML);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$headElem = $dom->find('head');
|
|
|
|
$headElem = $dom->find('head');
|
|
|
|
foreach($appendDom->getChildren() as $child) {
|
|
|
|
|
|
|
|
$headElem->addChild($child);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 更改标题
|
|
|
|
// 更改标题
|
|
|
|
if ($data['currentCategory']['isIndex']) {
|
|
|
|
if ($data['currentCategory']['isIndex']) {
|
|
|
@ -255,18 +244,7 @@ class Seo {
|
|
|
|
$dom->setOptions($options);
|
|
|
|
$dom->setOptions($options);
|
|
|
|
$dom->loadStr($outputPage);
|
|
|
|
$dom->loadStr($outputPage);
|
|
|
|
|
|
|
|
|
|
|
|
// 增加css
|
|
|
|
|
|
|
|
$appendDom = new Dom();
|
|
|
|
|
|
|
|
$appendDom->setOptions($options);
|
|
|
|
|
|
|
|
$appendDom->loadStr(<<<HTML
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="/seo/style">
|
|
|
|
|
|
|
|
HTML);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$headElem = $dom->find('head');
|
|
|
|
$headElem = $dom->find('head');
|
|
|
|
foreach($appendDom->getChildren() as $child) {
|
|
|
|
|
|
|
|
$headElem->addChild($child);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 增加author
|
|
|
|
// 增加author
|
|
|
|
$authorMeta = new HtmlNode('meta');
|
|
|
|
$authorMeta = new HtmlNode('meta');
|
|
|
|