Update canonical link condition (#1881)

This commit is contained in:
Luffy
2025-06-11 16:39:39 +08:00
committed by GitHub
parent ba4e4134ad
commit d9d0be334d
4 changed files with 4 additions and 4 deletions

View File

@@ -14,7 +14,7 @@ $this->need('header.php');
<main class="container">
<div class="container-thin">
<?php if (!($this->is('index')) and !($this->is('post'))): ?>
<?php if (!($this->is('index')) && !($this->is('post'))): ?>
<h6 class="text-center text-muted">
<?php $this->archiveTitle([
'category' => _t('分类 %s 下的文章'),

View File

@@ -13,7 +13,7 @@ $this->need('header.php');
?>
<div class="col-mb-12 col-8" id="main" role="main">
<?php if (!($this->is('index')) and !($this->is('post'))): ?>
<?php if (!($this->is('index')) && !($this->is('post'))): ?>
<h3 class="archive-title"><?php $this->archiveTitle([
'category' => _t('分类 %s 下的文章'),
'search' => _t('包含关键字 %s 的文章'),

View File

@@ -1015,7 +1015,7 @@ class Archive extends Contents
$allows = self::pluginHandle()->filter('headerOptions', $allows, $this);
$title = (empty($this->archiveTitle) ? '' : $this->archiveTitle . ' &raquo; ') . $this->options->title;
$header = $this->is('single') ? '<link rel="canonical" href="' . $this->archiveUrl . '" />' . "\n" : '';
$header = ($this->is('single') && !$this->is('index')) ? '<link rel="canonical" href="' . $this->archiveUrl . '" />' . "\n" : '';
if (!empty($allows['pingback']) && 2 == $this->options->allowXmlRpc) {
$header .= '<link rel="pingback" href="' . $allows['pingback'] . '" />' . "\n";

View File

@@ -452,7 +452,7 @@ class Contents extends Base implements QueryInterface, RowFilterInterface, Prima
}
}
$allow &= ($this->row['allow' . ucfirst($permission)] == 1) and !$this->hidden;
$allow &= ($this->row['allow' . ucfirst($permission)] == 1) && !$this->hidden;
}
}