代码实现给Typecho添加归档页面,自己测试成功。步骤如下
1、新建一个页面,命名为“archives.php”,代码如下
<?php
/**
* archives
*
* @package custom
*/
$this->need('header.php'); ?>
<div class="col-mb-12 col-8" id="main" role="main">
<article class="post" itemscope itemtype="http://schema.org/BlogPosting">
<h1 class="post-title" itemprop="name headline">
<a itemprop="url"
href="<?php $this->permalink() ?>"><?php $this->title() ?></a>
</h1>
<div class="post-content" itemprop="articleBody">
<?php $this->widget('Widget_Contents_Post_Recent', 'pageSize=10000')->parse('<li>{year}-{month}-{day} : <a href="{permalink}" target=_blank>{title}</a></li>'); ?>
</div>
</article>
<?php $this->need('comments.php'); ?>
</div><!-- end #main-->
<?php $this->need('sidebar.php'); ?>
<?php $this->need('footer.php'); ?>2、将 archives.php 上传至主题目录下
3、新建独立页面,自定义模板处选择“archives”
/ 转载自 飞鸟上校

2 comments
给Typecho加归档页,核心就是新建archives.php,用Widget_Contents_Post_Recent把文章按日期列出来,再在后台新建页面并指定该模板。步骤短,但把“主题目录里的模板”和“后台页面选择模板”这两下都写到了,不容易只做一半。转载说明也清楚。对只想要一份按年列表、不想再装插件的站点,这个做法足够。
我也是这样创建归档页面滴..