summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEltrac Koalar <hi@guhub.cn>2022-09-24 23:59:15 +0800
committerEltrac Koalar <hi@guhub.cn>2022-09-24 23:59:15 +0800
commitd23f16c5ffe7c8fe2e68d5dabb01761178aa7781 (patch)
tree59f3c37cfefbd2e736986fab902174ebb6886a54
parentdb86bb4726d28d679e425d09e5b98672ede1ac10 (diff)
:link: Perf: 相关链接只在首页展示
-rw-r--r--assets/matcha/matcha.post.css2
-rw-r--r--includes/post-list.php4
-rw-r--r--libs/Matcha.php6
3 files changed, 5 insertions, 7 deletions
diff --git a/assets/matcha/matcha.post.css b/assets/matcha/matcha.post.css
index 5c11ede..e85d2c4 100644
--- a/assets/matcha/matcha.post.css
+++ b/assets/matcha/matcha.post.css
@@ -10,7 +10,7 @@
font-size: 1.05em;
margin: 2em 0
}
-.post-atmain:first-child {
+.post:first-child {
margin-top: 0
}
diff --git a/includes/post-list.php b/includes/post-list.php
index 583ae60..7f0ff46 100644
--- a/includes/post-list.php
+++ b/includes/post-list.php
@@ -6,11 +6,11 @@
'tag' => _t('标签 %s 下的文章'),
'author' => _t('%s 发布的文章')
), '', ''); ?></h3><?php } ?>
- <?php if($this->is('index') && $this->options->relatedLinks!=''): ?><!-- 相关链接 -->
+ <?php if($this->is('index') && $this->options->relatedLinks!='' && $this->_currentPage == 1): ?><!-- 相关链接 -->
<?php if($this->options->relatedLinksTitle!=''): ?><h2 class="section-title"><?php $this->options->relatedLinksTitle(); ?></h2><?php endif; ?>
<section class="indexlink"><?php Matcha::relatedLinks($this); ?></section><?php endif; ?>
<!-- 文章列表 -->
- <?php if($this->options->relatedLinksTitle!='' && $this->options->relatedLinks!=''): ?><h2 class="section-title">最新文章</h2><?php endif; ?>
+ <?php if($this->options->relatedLinksTitle!='' && $this->options->relatedLinks!='' && $this->_currentPage == 1): ?><h2 class="section-title">最新文章</h2><?php endif; ?>
<section class="latest-post">
<?php while($this->next()): ?>
<article class="post post-atmain<?php if($this->fields->thumbnail!='') echo ' post-with-thumbnail'; ?>" itemscope itemtype="http://schema.org/BlogPosting">
diff --git a/libs/Matcha.php b/libs/Matcha.php
index c968410..717680d 100644
--- a/libs/Matcha.php
+++ b/libs/Matcha.php
@@ -487,8 +487,7 @@ class Matcha
<h2>'.$post->title.'</h2>
<p>';
$post->excerpt(30);
- echo '</p>
- </a>';
+ echo '</p></a>';
}
//如果是自定义链接
else {
@@ -498,8 +497,7 @@ class Matcha
}
echo '<a href="'.$item['link'].'" target="_blank">
<h2>'.$item['title'].'</h2>
- <p>'.$item['des'].'</p>
- </a>';
+ <p>'.$item['des'].'</p></a>';
}
echo '</div>';