才发现原来 Typecho 有好多东西要改,现附上一备忘,等下继续折腾...

开启 GZIP 压缩

貌似默认已经开了,但是效果没有下面的方法明显。

在根目下的 index.php 加上下面这一句就能开启GZIP压缩。

ob_start('ob_gzhandler');

最新评论不显示博主评论

在调用函数的地方加上 ignoreAuthor=true

$this->widget('Widget_Comments_Recent','ignoreAuthor=true')->to($comments);

文章归档改为下拉菜单式

打开 sidebar.php,修改归档代码

<select name="archive-dropdown" onchange="location.href=this.options[this.selectedIndex].value;">
    <option>请选择月份</option> 
    <?php $this->widget('Widget_Contents_Post_Date', 'type=month&format=F Y')->parse('<option value="{permalink}">{date}</option>'); ?> 
</select>

如何禁止子目录浏览

如果是 CPanel 面板的话,里面有个索引管理器,很容易就会达到这个目的,为了安全着想,所以还是有必要的,当然也可以通过修改 .htaccess 文件,里面加入下面的代码。

# disable directory browsing 
Options All -Indexes

首页显示特定边栏

<?php if ($this->is('index')): ?> 
     <!-- 显示内容 -->
<?php endif; ?> 

文章倒序排列

修改源文件 /var/Widget/Archive.php 中第 1260 行为

$select->order('table.contents.created', Typecho_Db::SORT_ASC)