更新seo规则

master v0.2.0
落雨楓 3 years ago
parent efafed7ba6
commit c44ddfaaea

@ -86,7 +86,7 @@ class Seo {
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() {
@ -151,18 +151,7 @@ class Seo {
$dom->setOptions($options);
$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');
foreach($appendDom->getChildren() as $child) {
$headElem->addChild($child);
}
// 更改标题
if ($data['currentCategory']['isIndex']) {
@ -255,18 +244,7 @@ class Seo {
$dom->setOptions($options);
$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');
foreach($appendDom->getChildren() as $child) {
$headElem->addChild($child);
}
// 增加author
$authorMeta = new HtmlNode('meta');

@ -1,3 +1,5 @@
<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">
<nav class="nav navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">

@ -1,3 +1,5 @@
<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">
<nav class="nav navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">

Loading…
Cancel
Save