Ryongyon!

这世界上假绅士太多,缺少训练有素的流氓

· 实践教程 · · 7439次浏览

给Typecho分页的标题加上页码

前言

如果你正在使用Typecho,那么你应该发现当进行上一页 下一页的动作时,网页标题始终都是网站名称,而不是 XXX - 第 X 页
那么,给Typecho分页的标题加上页码的作用是什么呢?当然是可以避免Seo重复页面或重复标题啦。解决的方法很简单,无需用到插件

解决方法

在当前主题目录下的 header.php 中找到一下代码:

<title><?php $this->archiveTitle(array(
    'category'  =>  _t(' %s '),
    'search'    =>  _t(' %s '),
    'tag'       =>  _t(' %s '),
    'author'    =>  _t(' %s ')
    ), '', ' - '); ?></title>

在最后部分插入以下代码:

<?php $this->options->title(); ?><?php if($this->_currentPage>1) echo ' - 第 '.$this->_currentPage.' 页'; ?>
评论 (4条)