Typecho给首页设置副标题

技术
75 0

Typecho给首页设置副标题

打开head.php文件中。
找到下面这行代码

<?php $this->options->title(); ?>

注意:每个模板不一定相同,上面的代码可以写成很多样式。不变的是:上面的代码在head标签里面。
它可能以这种方法出现:

<head>
    <meta charset="UTF-8">
    <title><?php $this -> archiveTitle(array(
            'category'  =>  _t('%s'),
            'search'    =>  _t('含关键词 %s 的文章'),
            'tag'       =>  _t('标签 %s 下的文章'),
            'author'    =>  _t('%s 发布的文章')
        ), '', ' - '); $this -> options -> title(); ?></title>
</head>

上面倒数第二行就是要找的代码。
所以用Notepad++搜索 this->options->title() 比较容易找。
把下面代码粘贴到这行代码的后面即可。

<?php if ($this->is('index')): ?>副标题<?php endif; ?>

将上面的副标题换成你想要的。
修改后的代码:

<title><?php $this -> archiveTitle(array(
        'category'  =>  _t('%s'),
        'search'    =>  _t('含关键词 %s 的文章'),
        'tag'       =>  _t('标签 %s 下的文章'),
        'author'    =>  _t('%s 发布的文章')
    ), '', ' - '); $this -> options -> title(); ?><?php if ($this->is('index')): ?>副标题<?php endif; ?></title>

这样设置后,首页的标题会加上我们刚才设置的副标题,而文章的标题就不会加上副标题。

转载:http://blog.csdn.net/qq_34626094/article/details/112254699

最后更新 2023-02-06
评论 ( 0 )
OωO
隐私评论