Skip to content

Commit ade19e6

Browse files
committed
v1.0.0
0 parents  commit ade19e6

File tree

9 files changed

+276
-0
lines changed

9 files changed

+276
-0
lines changed

404.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
2+
<?php $this->need('header.php'); ?>
3+
<div>
4+
<h1>404</h1>
5+
<p>出错了,这里什么都没有。</p>
6+
<p><a href="<?php $this->options->siteUrl(); ?>">← 返回首页</a></p>
7+
</div>
8+
<?php $this->need('footer.php'); ?>

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Writing
2+
3+
主题介绍: Writing 是一款极致极简写作主题,支持自定义背景、自定义菜单、暗黑模式、自适应,保留搜索及评论功能;内置文章归档模板。主题无 JS、CSS 文件载入,对程序极简优化,仅9个文件约50kb。
4+
5+
关键词: 极简,博客,单栏,自适应,暗黑模式,免费
6+
7+
主题发布页: https://yayu.net/projects/typecho-writing
8+
9+
作者: Jeff Chen
10+
11+
作者网站: https://yayu.net/
12+
13+
最新版本: 1.0.0
14+
15+
授权方式: CC BY-NC-SA 4.0 DEED
16+
17+
授权介绍: https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh-hans
18+
19+
20+
## 使用方法
21+
22+
1. 上传并激活主题,开箱即用。
23+
24+
25+
## 页面模板/所有文章
26+
27+
1. 创建一个新的页面,或选择一个已有页面;
28+
2. 编辑状态,在“页面属性”的“模板”一项中选择“文章归档”模板。
29+
30+
该模板按年月展示博客所有文章。

archives.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
/**
3+
* 文章归档
4+
*
5+
* @package custom
6+
*/
7+
if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
8+
<?php $this->need('header.php'); ?>
9+
<style>
10+
details{margin:10px 0;}
11+
details ul{list-style:none;padding:0 0 10px;margin:0;}
12+
details li{margin:6px 0;font-weight:bold;font-size:1.1em;}
13+
summary{color:#999;}
14+
summary:hover{cursor: pointer;opacity:0.5;}
15+
</style>
16+
<h1 class="title"><?php $this->title() ?></h1><br />
17+
<p>
18+
<?php $this->widget('Widget_Contents_Post_Recent', 'pageSize=10000')->to($archives);
19+
$year=0; $mon=0; $i=0; $j=0; $output='';
20+
while($archives->next()):
21+
$year_tmp = date('Y',$archives->created);
22+
$mon_tmp = date('m',$archives->created);
23+
$y=$year; $m=$mon;
24+
if ($mon != $mon_tmp && $mon > 0) $output .= '</ul>';
25+
if ($year != $year_tmp && $year > 0) $output .= '';
26+
if ($year != $year_tmp && $mon != $mon_tmp) {
27+
$year = $year_tmp;
28+
$mon = $mon_tmp;
29+
$output .= '<details><summary>'. $year .''. $mon .'月</summary><ul>';
30+
}
31+
$output .= '<li><a href="'.$archives->permalink .'" title="'. $archives->title .'">'. $archives->title .'</a></li>';
32+
endwhile;
33+
$output .= '</ul></details>';
34+
echo $output;
35+
?>
36+
</p>
37+
<?php $this->need('footer.php'); ?>

comments.php

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
2+
<div id="comments">
3+
<?php $this->comments()->to($comments); ?>
4+
<?php if ($comments->have()): ?>
5+
<h3><?php $this->commentsNum(_t('暂无评论'), _t('仅有一条评论'), _t('已有 %d 条评论')); ?></h3>
6+
<?php $comments->listComments(); ?>
7+
<?php $comments->pageNav('&laquo; 前一页', '后一页 &raquo;'); ?>
8+
<?php endif; ?>
9+
<?php if ($this->allow('comment')): ?>
10+
<div id="<?php $this->respondId(); ?>" class="respond">
11+
<div class="cancel-comment-reply">
12+
<?php $comments->cancelReply(); ?>
13+
</div>
14+
<h3 id="response"><?php _e('添加新评论'); ?></h3>
15+
<form method="post" action="<?php $this->commentUrl() ?>" id="comment-form" role="form">
16+
<?php if ($this->user->hasLogin()): ?>
17+
<p><?php _e('登录身份: '); ?><a
18+
href="<?php $this->options->profileUrl(); ?>"><?php $this->user->screenName(); ?></a>. <a
19+
href="<?php $this->options->logoutUrl(); ?>" title="Logout"><?php _e('退出'); ?> &raquo;</a>
20+
</p>
21+
<?php else: ?>
22+
<p>
23+
<label for="author" class="required"><?php _e('称呼'); ?></label>
24+
<input type="text" name="author" id="author" class="text"
25+
value="<?php $this->remember('author'); ?>" required/>
26+
</p>
27+
<p>
28+
<label
29+
for="mail"<?php if ($this->options->commentsRequireMail): ?> class="required"<?php endif; ?>><?php _e('Email'); ?></label>
30+
<input type="email" name="mail" id="mail" class="text"
31+
value="<?php $this->remember('mail'); ?>"<?php if ($this->options->commentsRequireMail): ?> required<?php endif; ?> />
32+
</p>
33+
<p>
34+
<label
35+
for="url"<?php if ($this->options->commentsRequireURL): ?> class="required"<?php endif; ?>><?php _e('网站'); ?></label>
36+
<input type="url" name="url" id="url" class="text" placeholder="<?php _e('http://'); ?>"
37+
value="<?php $this->remember('url'); ?>"<?php if ($this->options->commentsRequireURL): ?> required<?php endif; ?> />
38+
</p>
39+
<?php endif; ?>
40+
<p>
41+
<label for="textarea" class="required"><?php _e('内容'); ?></label>
42+
<textarea rows="8" cols="50" name="text" id="textarea" class="textarea"
43+
required><?php $this->remember('text'); ?></textarea>
44+
</p>
45+
<p>
46+
<button type="submit" class="submit"><?php _e('提交评论'); ?></button>
47+
</p>
48+
</form>
49+
</div>
50+
<?php else: ?>
51+
<h3 style="text-align: center;"><?php _e('评论已关闭'); ?></h3>
52+
<?php endif; ?>
53+
</div>

footer.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
</main>
2+
<footer>
3+
<?php if ($this->is('index')){ ?><form id="search" method="post" action="<?php $this->options->siteUrl(); ?>" role="search">
4+
<input type="text" id="s" name="s" class="text" placeholder="输入关键字"/>
5+
<button type="submit" class="submit">搜索</button>
6+
</form><?php } ?>
7+
<span>&copy; <?php echo date( 'Y' ); ?> <a href="<?php $this->options->siteUrl(); ?>" title="<?php $this->options->title(); ?>"><?php $this->options->title(); ?></a> | <a href="<?php $this->options->feedUrl(); ?>">RSS</a> | <a href="#"> ↑↑ </a></span><br /><small>SHARED BY <a href="https://yayu.net" title="雅余">YAYU</a></small>
8+
</footer>
9+
<?php $this->footer(); ?>
10+
</body>
11+
</html>

functions.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?php
2+
if (!defined('__TYPECHO_ROOT_DIR__')) exit;

header.php

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
2+
<!DOCTYPE HTML>
3+
<html>
4+
<head>
5+
<meta charset="<?php $this->options->charset(); ?>">
6+
<meta name="viewport" content="width=device-width, initial-scale=1">
7+
<title><?php $this->archiveTitle(['category' => _t('%s'),'search' => _t('搜索结果:%s'),'tag' => _t('标签:%s'),'author' => _t('作者:%s')], '', ' - '); ?><?php $this->options->title(); ?></title>
8+
<style>
9+
:root {
10+
--width: 600px;
11+
--font-scale: 1em;
12+
--background-color: #fff;
13+
--heading-color: #222;
14+
--nav-color:#777;
15+
--text-color: #333;
16+
--code-background-color: #f2f2f2;
17+
--code-color: #222;
18+
--blockquote-color: #222;
19+
--gray-color: #aaa;
20+
}
21+
@media (prefers-color-scheme: dark) {
22+
:root {
23+
--background-color: #111;
24+
--heading-color: #d9c48f;
25+
--nav-color: #8f8873;
26+
--text-color: #d9c48f;
27+
--code-background-color: #000;
28+
--code-color: #ddd;
29+
--blockquote-color: #ccc;
30+
--gray-color: #756a56;
31+
}
32+
}
33+
body {
34+
font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Ubuntu,"Helvetica Neue",Helvetica,Arial,"PingFangSC-Regular","Hiragino Sans GB","Lantinghei SC","Microsoft Yahei","Source Han Sans CN","WenQuanYi Micro Hei",SimSun,sans-serif;
35+
font-size: var(--font-scale);
36+
margin: auto;
37+
padding: 20px;
38+
max-width: var(--width);
39+
text-align: center;
40+
background-color: var(--background-color);
41+
word-wrap: break-word;
42+
overflow-wrap: break-word;
43+
line-height: 1.8;
44+
color: var(--text-color);
45+
}
46+
html{scroll-behavior:smooth;}
47+
h1,h2,h3,h4,h5,h6{color:var(--heading-color);}
48+
a{color:var(--text-color);cursor:pointer;text-decoration:none}
49+
a:hover{opacity:0.5;}
50+
nav a{margin:0 5px;}
51+
strong,b{color:var(--heading-color)}
52+
button{margin:0;cursor:pointer}
53+
time,.commentmetadata a{color:var(--gray-color);font-size:0.8em;}
54+
table{width:100%}
55+
hr{border:0;border-top:1px dashed}
56+
img{max-width:100%;height:auto}
57+
code{font-family:monospace;padding:2px;background-color:var(--code-background-color);color:var(--code-color);border-radius:3px}
58+
blockquote{border-left:1px solid var(--gray-color);color:var(--code-color);padding-left:20px;font-style:italic}
59+
header,footer{margin: 10px 0;color:var(--gray-color);}
60+
footer{padding-top:40px;}
61+
header a,footer a{color:var(--nav-color)}
62+
article{margin-bottom:30px;}
63+
h1.title,h2.title {margin:50px 0 0;line-height:1.6;}
64+
.intro{color:var(--gray-color);margin-bottom:50px;}
65+
.home.intro:after{content:"✍";display: block;font-size:2em;margin-top: 40px;}
66+
.content,.comlist,.respond{text-align:left;padding-top:40px;}
67+
.content a,.comment-reply a,.respond a{border-bottom:1px solid var(--text-color);}
68+
.content a:has(img){border:none}
69+
.pages a{font-size:20px;padding:5px;}
70+
.tags,.tags a{color:var(--gray-color);margin-right:10px;}
71+
.comlist{max-width:450px;margin:0 auto;}
72+
.comment-list,.comment-list .comment-children{list-style: none;padding:0;margin-bottom:40px;}
73+
.comment-body{margin:30px 0;list-style: none;}
74+
.comment-body .comment-children{margin-left:35px;}
75+
.comment-author cite{font-weight:bold;font-style:normal;}
76+
input,textarea{border-radius:4px;border:1px solid var(--gray-color);display:block;font-size:0.9em;margin:0 0 10px;padding:10px;width:calc(100% - 25px);background:var(--background-color);color:var(--heading-color)}
77+
input:focus,textarea:focus{border:1px solid var(--text-color);outline:0}
78+
button[type="submit"]{border:none;border-radius:4px;padding:10px 16px;width:initial;background:var(--heading-color);color:var(--background-color);font-size:0.9em}
79+
button[type="submit"]:hover{cursor:pointer;opacity:.7;}
80+
#search input{margin:20px auto;width: initial;display:inline-block;}
81+
</style>
82+
<?php $this->header(); ?>
83+
</head>
84+
<body>
85+
<header>
86+
<nav><?php if ($this->is('single') || $this->is('category') || $this->is('search') || $this->is('tag')) { ?>
87+
<a href="<?php $this->options->siteUrl(); ?>">← 首页</a> | <?php } ?>
88+
<?php if ($this->is('post')) { ?><?php $this->category(','); ?><?php } ?>
89+
<?php if ($this->is('page') || $this->is('index') || $this->is('category') || $this->is('search') || $this->is('tag')) { ?>
90+
<?php $this->widget('Widget_Metas_Category_List')->to($category); ?>
91+
<?php while($category->next()): ?>
92+
<a<?php if($this->is('category', $category->slug)): ?> class="current"<?php endif; ?> href="<?php $category->permalink(); ?>" title="<?php $category->name(); ?>"><?php $category->name(); ?></a>
93+
<?php endwhile; ?>
94+
<?php $this->widget('Widget_Contents_Page_List')->to($pages); ?>
95+
<?php while ($pages->next()): ?>
96+
<a<?php if ($this->is('page', $pages->slug)): ?> class="current"<?php endif; ?> href="<?php $pages->permalink(); ?>" title="<?php $pages->title(); ?>"><?php $pages->title(); ?></a>
97+
<?php endwhile; ?>
98+
<?php } ?></nav>
99+
</header>
100+
<main>

index.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
/**
3+
* Writing 是一款极致极简写作主题,支持自定义背景、自定义菜单、暗黑模式、自适应,保留搜索及评论功能;内置文章归档模板。主题无 JS、CSS 文件载入,对程序极简优化,仅9个文件约50kb。<br/>
4+
* 发布页:<a href="https://yayu.net/projects/typecho-writing" target="_blank">https://yayu.net/projects/typecho-writing</a>
5+
*
6+
* @package Writing
7+
* @author Jeff Chen
8+
* @version 1.0.0
9+
* @link https://yayu.net/
10+
*/
11+
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
12+
$this->need('header.php'); ?>
13+
<?php if ($this->is('index')){ ?>
14+
<h1 class="title"><a href="<?php $this->options->siteUrl(); ?>"><?php $this->options->title() ?></a></h1>
15+
<div class="home intro"><?php $this->options->description() ?></div>
16+
<?php }; if ($this->is('archive')) { ?>
17+
<h1 class="title"><?php $this->archiveTitle(['category' => _t('%s'),'search' => _t('搜索结果'),'tag' => _t('标签:%s'),'author' => _t('作者:%s')], '', ''); ?></h1>
18+
<div class="intro"><?php if ( $this->is('search') ) { ?>关键词:<?php echo $this->archiveTitle('','',''); ?><?php } else { ?><?php echo $this->getDescription(); ?><?php } ?></div>
19+
<?php } ?>
20+
<?php if ($this->have()): ?>
21+
<?php while ($this->next()): ?>
22+
<article>
23+
<?php $site_title_elem = $this->is('single') ? 'h1' : 'h2'; ?>
24+
<<?php echo $site_title_elem; ?> class="title"><a href="<?php $this->permalink() ?>"><?php $this->title() ?></a></<?php echo $site_title_elem; ?>>
25+
<?php if ( $this->is('archive') || $this->is('index') || $this->is('post') ) { ?><time datetime="<?php $this->date('c'); ?>"><?php $this->date(); ?></time><?php } ?>
26+
<?php if ( $this->is('single') ) { ?><div class="content"><?php $this->content(); ?></div><?php } ?>
27+
</article>
28+
<?php endwhile; ?>
29+
<?php if ( $this->is('single') ) { ?>
30+
<?php if ( $this->is('post') ) { ?><p class="tags"># <?php $this->tags('', true, '无标签'); ?></p><?php }; ?>
31+
<div class="comlist"><br /><?php $this->need('comments.php'); ?></div>
32+
<?php }; if ( $this->is('archive') || $this->is('index') ) { ?>
33+
<div class="pages"><?php $this->pageLink('&nbsp;←&nbsp;'); ?><?php $this->pageLink('&nbsp;→&nbsp;','next'); ?></div>
34+
<?php }; endif; ?>
35+
<?php $this->need('footer.php'); ?>

screenshot.png

2.45 KB
Loading

0 commit comments

Comments
 (0)