这篇文章上次修改于 403 天前,可能其部分内容已经发生变化,如有疑问可询问作者。
后台设置
站点图标
https://www.ewwe.net/usr/themes/Single/img/icon.png
站点背景
https://www.ewwe.net/usr/themes/Single/img/background.jpg
统计代码
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?1b9cb1455af90eef0646918395137e14";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
永久链接
后台设置永久链接,如出现404,可在宝塔中做如下修改。
宝塔->网站->站点设置->伪静态 选择 typecho保存即可。
页面设置
归档页面
1.后台新建模板archives,文件名list.php,代码如下。
2.新建独立页面选择模板archives。
<?php if(!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php
/**
* archives
*
* @package custom
*/
$this->need('header.php'); ?>
<main>
<div class="wrap min">
<section class="page-title">
<h2><?php $this -> title() ?></h2>
<?php if($this -> authorId == $this -> user -> uid): ?>
<a class="edit-link" href="<?php $this -> options -> adminUrl(); ?>write-page.php?cid=<?php echo $this -> cid; ?>" target="_blank">编辑</a>
<?php endif; ?>
</section>
<article class="page-content">
<?php $this->widget('Widget_Contents_Post_Recent', 'pageSize=10000')->to($archives);
$year=0; $mon=0; $i=0; $j=0;
$output = '<div id="archives">';
while($archives->next()):
$year_tmp = date('Y',$archives->created);
$mon_tmp = date('m',$archives->created);
$y=$year; $m=$mon;
if ($mon != $mon_tmp && $mon > 0) $output .= '</ul></li>';
if ($year != $year_tmp && $year > 0) $output .= '</ul>';
if ($year != $year_tmp) {
$year = $year_tmp;
$output .= '<h3>'. $year .' 年</h3><ul>'; //输出年份
}
if ($mon != $mon_tmp) {
$mon = $mon_tmp;
$output .= '<li><span>'. $mon .' 月</span><ul>'; //输出月份
}
$output .= '<li>'.date('d日: ',$archives->created).'<a href="'.$archives->permalink .'">'. $archives->title .'</a> </li>'; //输出文章日期和标题
endwhile;
$output .= '</ul></li></ul></div>';
echo $output;
?>
</article>
<?php $this -> need('comments.php'); ?>
</div>
</main>
<?php $this -> need('footer.php'); ?>
页脚设置
<section class="sub-footer">
<p><a href="https://www.ewwe.net/index.php/start-page.html" >关于作者</a> | <a
href="https://www.ewwe.net/index.php/7.html" >文章归档</a>
</p>
<p>© <?php echo date('Y'); ?> <a href="<?php $this -> options -> siteUrl(); ?>"><?php $this -> options -> title(); ?></a>. All Rights Reserved. | <a href="http://wiki.ewwe.net" >知识管理 | <a href="http://pan.ewwe.net:81/index.php/s/3oeKQJtAmoYiBpY" > 文件共享</a></a></p>
</section>
标题间距
打开主题目录下的single.css文件
article h1, article h2, article h3{ margin-top: 1.5rem }
404页面
删除404.php文件中的图片,很明显不符合我的风格。
没有评论