Skip to content

Commit

Permalink
v1.1.0
Browse files Browse the repository at this point in the history
- 增加独立“搜索模板”
- 菜单及部分代码调整
- CSS 样式移至 style.css 文件
- 优化多处负空间距离
- 优化评论框样式
  • Loading branch information
imjeff committed Sep 6, 2024
1 parent a73819d commit cbe99ce
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 102 deletions.
35 changes: 28 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Paper

主题介绍: Paper,一页纸,一片让博主可写可绘的极简创作空间。本主题为极简主题,禅定黄+静思蓝暗黑配色,无 JS、CSS 文件载入,对代码极简优化。主题支持自定义背景、自定义菜单,保留搜索及评论功能;内置文章归档模板;已作中文字体优化,内置3种字体方案可选。主题仅9个文件约50kb
主题介绍: Paper,一页纸,一片让博主可写可绘的极简创作空间。本主题为极简主题,禅定黄+静思蓝暗黑配色,无 JS、图片文件引用,对代码极简优化。主题支持自定义背景、自定义菜单,保留搜索及评论功能;内置文章归档和搜索模板;已作中文字体优化,内置3种字体方案可选。

关键词: 极简,博客,单栏,自适应,暗黑模式,免费
关键词: 极简,纯文本,博客,单栏,自适应,暗黑模式,免费

主题发布页: https://yayu.net/projects/typecho-paper

作者: Jeff Chen

作者网站: https://yayu.net/

最新版本: 1.0.3
最新版本: 1.1.0

授权方式: CC BY-NC-SA 4.0 DEED

Expand All @@ -20,12 +20,33 @@
## 使用方法

1. 上传并激活主题,开箱即用。
2. 主题已内置3种字体方案,分别为雅黑、仿宋和宋体。如需要调整字体,在“控制台”》“外观”的“编辑当前外观”页签中选择编辑 header.php 文件,根据提示对第43行进行修改
2. 主题已内置3种字体方案,分别为雅黑、仿宋和宋体。如需要调整字体,在“控制台”》“外观”的“编辑当前外观”页签中选择编辑 style.css 文件,根据提示对第35行进行修改


## 页面模板/文章归档

1. 创建一个新的独立页面,或选择一个已有页面;
2. 编辑状态,在独立页面“选项”的“自定义模板”中选择“文章归档”模板。
1. 创建一个新的页面,或选择一个已有页面;
2. 编辑状态,在“页面属性”的“模板”一项中选择“文章归档”或“搜索模板”;
3. 按需要添加到菜单中。

该模板按年月展示博客所有文章。
“文章归档”按年月展示博客所有文章。

“搜索模板”中包含搜索框及结果列表。


## 迭代日志

### Version 1.1.0 (2024-09-06)
- 增加独立“搜索模板”
- 菜单及部分代码调整
- CSS 样式移至 style.css 文件
- 优化多处负空间距离
- 优化评论框样式

### Version 1.0.3 (2023-12-16)
- 修正评论框宽度
- 简化代码 archives.php 代码
- 修正 404.php 版本

### Version 1.0.0 (2023-12-10)
- 始发
6 changes: 1 addition & 5 deletions footer.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
</main>
<footer>
<form id="search" method="post" action="<?php $this->options->siteUrl(); ?>" role="search">
<input type="text" id="s" name="s" class="text" placeholder="输入关键字"/>
<button type="submit" class="submit">搜索</button>
</form>
<span>&copy; <?php echo date( 'Y' ); ?> <a href="<?php $this->options->siteUrl(); ?>" title="<?php $this->options->title(); ?>"><?php $this->options->title(); ?></a> | Shared By <a href="https://yayu.net" title="雅余">YAYU</a> | <a href="#">返回顶部 ↑</a></span>
<span>&copy; <?php echo date( 'Y' ); ?> <a href="<?php $this->options->siteUrl(); ?>" title="<?php $this->options->title(); ?>"><?php $this->options->title(); ?></a> | <a href="https://yayu.net" title="雅余">YAYU</a> THEME | <a href="#">返回顶部 ↑</a></span>
</footer>
<?php $this->footer(); ?>
</body>
Expand Down
81 changes: 1 addition & 80 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,87 +5,8 @@
<meta charset="<?php $this->options->charset(); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php $this->archiveTitle(['category' => _t('%s'),'search' => _t('搜索结果:%s'),'tag' => _t('标签:%s'),'author' => _t('作者:%s')], '', ' - '); ?><?php $this->options->title(); ?></title>
<style>
:root {
--width: 720px;
--font-yahei: -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;
--font-fangsong: Baskerville, "Times New Roman", "Liberation Serif", STFangsong, FangSong, FangSong_GB2312, "CWTEX\-F", serif;
--font-songti: Georgia, "Nimbus Roman No9 L", "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif CN", STSong, "AR PL New Sung", "AR PL SungtiL GB", NSimSun, SimSun, "TW\-Sung", "WenQuanYi Bitmap Song", "AR PL UMing CN", "AR PL UMing HK", "AR PL UMing TW", "AR PL UMing TW MBE", PMingLiU, MingLiU, serif;
--font-scale: 1em;
--background-color: #F2F0E5;
--main-color:#fff;
--heading-color: #222;
--nav-color:#666;
--text-color: #444;
--link-color: #444;
--code-background-color: #f2f2f2;
--code-color: #222;
--blockquote-color: #222;
--gray-color: #999;
--shadow-color:#ebe4c6;
}
@media (prefers-color-scheme: dark) {
:root {
--background-color: #0b0c1b;
--main-color: #0e1028;
--heading-color: #c2cef0;
--nav-color: #585c90;
--text-color: #a6b4d2;
--link-color: #7b88c8;
--code-background-color: #000;
--code-color: #ddd;
--blockquote-color: #ccc;
--gray-color: #4f5287;
--shadow-color: #000;
}
}
body {
font-family: var(--font-yahei); /* 可替换 --font-fangsong 或 --font-songti 字体 */
font-size: var(--font-scale);
margin: auto;
padding: 20px;
max-width: var(--width);
text-align: left;
background-color: var(--background-color);
word-wrap: break-word;
overflow-wrap: break-word;
line-height: 1.8;
color: var(--text-color);
}
html{scroll-behavior:smooth;}
h1,h2,h3,h4,h5,h6{color:var(--heading-color);}
a{color:var(--link-color);cursor:pointer;text-decoration:none}
a:hover{opacity:0.5;}
nav a{margin-right:10px}
strong,b{color:var(--heading-color)}
button{margin:0;cursor:pointer}
time,.comment-meta a{color:var(--gray-color);}
main{padding:7%; background-color:var(--main-color);box-shadow: 0px 10px 20px 0px var(--shadow-color);}
table{width:100%}
hr{border:0;border-top:1px dashed}
img{max-width:100%;height:auto}
code{font-family:monospace;padding:2px;background-color:var(--code-background-color);color:var(--code-color);border-radius:3px}
blockquote{border-left:1px solid var(--gray-color);color:var(--code-color);padding-left:20px;font-style:italic}
header,footer{padding:20px 0;margin: 10px 0;color:var(--gray-color);}
header a,footer a{color:var(--nav-color)}
article{margin-bottom: 40px;padding-bottom:40px;border-bottom:1px dashed var(--gray-color);}
h1.title,h2.title {margin:0;line-height:1.6;}
.intro{color:var(--gray-color);margin-bottom:60px;}
.content a,.comment-reply a,.page-navigator .current{border-bottom:1px solid var(--link-color);}
.content a:has(img){border:none}
.tags,.tags a{color:var(--gray-color);margin-right: 10px;}
.page-navigator{list-style: none;padding:0;}
.page-navigator li{display: inline-block;padding:0 6px;margin-right: 10px;}
.comment-list{list-style: none;padding:0;margin-bottom:40px;}
.comment-children{margin:30px 0 0 50px}
.comment-author cite{font-weight:bold;font-style:normal;}
.comment-author .says,.comment-author .avatar{display:none}
input,textarea{border-radius:4px;border:1px solid var(--gray-color);display:block;font-size:0.9em;margin:0 0 10px;padding:10px;max-width:calc(100% - 25px);}
button[type="submit"]{border:none;font-size:0.9em;border-radius:4px;padding:10px 16px;background:#ccc;}
button[type="submit"]:hover{cursor:pointer;opacity:.7;}
#search input{display:inline-block;margin-right: 5px;}
</style>
<?php $this->header(); ?>
<link rel="stylesheet" href="<?php $this->options->themeUrl('style.css'); ?>">
</head>
<body>
<header>
Expand Down
22 changes: 12 additions & 10 deletions index.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php
/**
* Paper,一页纸,一片让博主可写可绘的极简创作空间。本主题为极简主题,禅定黄+静思蓝暗黑配色,无 JS、CSS 文件载入,对代码极简优化。主题支持自定义背景、自定义菜单,保留搜索及评论功能;内置文章归档模板;已作中文字体优化,内置3种字体方案可选。主题仅9个文件约50kb。<br/>
* Paper,一页纸,一片让博主可写可绘的极简创作空间。本主题为极简主题,禅定黄+静思蓝暗黑配色,无 JS、图片文件引用,对代码极简优化。主题支持自定义背景、自定义菜单,保留搜索及评论功能;内置文章归档和搜索模板;已作中文字体优化,内置3种字体方案可选。<br/>
* 发布页:<a href="https://yayu.net/projects/typecho-paper" target="_blank">https://yayu.net/projects/typecho-paper</a>
*
* @package Paper
* @author Jeff Chen
* @version 1.0.3
* @version 1.1.0
* @link https://yayu.net/
*/
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
Expand All @@ -14,22 +14,24 @@
<h1 class="title"><a href="<?php $this->options->siteUrl(); ?>"><?php $this->options->title() ?></a></h1>
<div class="intro"><?php $this->options->description() ?></div>
<?php }; if ($this->is('archive')) { ?>
<h1 class="title"><?php $this->archiveTitle(['category' => _t('%s'),'search' => _t('搜索结果'),'tag' => _t('标签:%s'),'author' => _t('作者:%s')], '', ''); ?></h1>
<div class="intro"><?php if ( $this->is('search') ) { ?>关键词:<?php echo $this->archiveTitle('','',''); ?><?php } else { ?><?php echo $this->getDescription(); ?><?php } ?></div>
<h1 class="title"><?php $this->archiveTitle(['category' => _t('%s'),'tag' => _t('标签:%s'),'author' => _t('作者:%s')], '', ''); ?></h1>
<div class="intro"><?php echo $this->getDescription(); ?></div>
<?php } ?>
<?php if ($this->have()): ?>
<?php while ($this->next()): ?>
<article>
<article class="<?php if ( !$this->is('single') ) { ?>list<?php } else {?>single<?php }; ?>">
<?php $site_title_elem = $this->is('single') ? 'h1' : 'h2'; ?>
<<?php echo $site_title_elem; ?> class="title"><a href="<?php $this->permalink() ?>"><?php $this->title() ?></a></<?php echo $site_title_elem; ?>>
<time datetime="<?php $this->date('c'); ?>"><?php $this->date(); ?></time> · <a itemprop="discussionUrl" href="<?php $this->permalink() ?>#comments"><?php $this->commentsNum('发表评论', '1 条评论', '%d 条评论'); ?></a>
<div class="content"><?php $this->content(); ?></div>
<?php if ( $this->is('post') ) { ?>
<p class="tags"># <?php $this->tags('# ', true, '无标签'); ?></p>
<?php }; ?>
</article>
<?php endwhile; ?>
<?php if ( $this->is('post') ) { ?>
<p class="tags"># <?php $this->tags(', ', true, '无标签'); ?></p>
<?php }; if ( $this->is('single') ) { ?>
<p><br /><?php $this->need('comments.php'); ?></p><?php } else { ?>
<?php if ( $this->is('single') ) { ?>
<?php $this->need('comments.php'); ?><?php } else { ?>
<?php $this->pageNav('&laquo; 前一页', '后一页 &raquo;'); ?>
<?php }; endif; ?>
<?php }; ?>
<?php else : ?><article><em>空空如也 ...</em></article><?php endif; ?>
<?php $this->need('footer.php'); ?>
31 changes: 31 additions & 0 deletions search.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php
/**
* 搜索模板
*
* @package custom
*/
if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php $this->need('header.php'); ?>
<h1 class="title">搜索<?php if ( $this->is('search') ) : ?>关键词:<?php echo $this->archiveTitle('','',''); ?><?php endif; ?></h1>
<form id="search" method="post" action="<?php $this->options->siteUrl(); ?>" role="search">
<input type="text" id="s" name="s" class="text" value="<?php if ( $this->is('search') ) : ?><?php echo $this->archiveTitle('','',''); ?><?php endif; ?>" placeholder="<?php _e('输入关键字搜索'); ?>"/>
<button type="submit" class="submit"><?php _e('搜索'); ?></button>
</form>
<article>
<?php if ( $this->is('search') && $this->have()) : ?>
<div class="intro">为你找到以下相关结果</div>
<ul class="results">
<?php while ($this->next()): ?>
<li>
[ <?php $this->category(','); ?> ] <a href="<?php $this->permalink(); ?>" title="<?php $this->title() ?>"><?php $this->title() ?></a><br />
<small><time datetime="<?php $this->date(); ?>"><?php $this->date(); ?></time></small></li>
<?php endwhile; ?>
</ul>
<?php elseif ( $this->is('search') && !$this->have()) : ?>
<div class="intro">抱歉,没有找到相关的结果,你可以在上方搜索栏中尝试其他关键词。</div>
<?php endif; ?>
</article>
<?php if ( $this->is('search') && $this->is('archive')) { ?>
<?php $this->pageNav('&laquo; 前一页', '后一页 &raquo;'); ?>
<?php }; ?>
<?php $this->need('footer.php'); ?>
83 changes: 83 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
:root {
--width: 720px;
--font-yahei: -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;
--font-fangsong: Baskerville, "Times New Roman", "Liberation Serif", STFangsong, FangSong, FangSong_GB2312, "CWTEX\-F", serif;
--font-songti: Georgia, "Nimbus Roman No9 L", "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif CN", STSong, "AR PL New Sung", "AR PL SungtiL GB", NSimSun, SimSun, "TW\-Sung", "WenQuanYi Bitmap Song", "AR PL UMing CN", "AR PL UMing HK", "AR PL UMing TW", "AR PL UMing TW MBE", PMingLiU, MingLiU, serif;
--font-scale: 1em;
--background-color: #F2F0E5;
--main-color:#fff;
--heading-color: #222;
--nav-color:#666;
--text-color: #444;
--link-color: #444;
--code-background-color: #f2f2f2;
--code-color: #222;
--blockquote-color: #222;
--gray-color: #999;
--shadow-color:#ebe4c6;
}
@media (prefers-color-scheme: dark) {
:root {
--background-color: #0b0c1b;
--main-color: #0e1028;
--heading-color: #c2cef0;
--nav-color: #585c90;
--text-color: #a6b4d2;
--link-color: #7b88c8;
--code-background-color: #000;
--code-color: #ddd;
--blockquote-color: #ccc;
--gray-color: #4f5287;
--shadow-color: #000;
}
}
body {
font-family: var(--font-yahei); /* 可替换 --font-fangsong 或 --font-songti 字体 */
font-size: var(--font-scale);
margin: auto;
padding: 20px;
max-width: var(--width);
text-align: left;
background-color: var(--background-color);
word-wrap: break-word;
overflow-wrap: break-word;
line-height: 1.8;
color: var(--text-color);
}
html{scroll-behavior:smooth;}
h1,h2,h3,h4,h5,h6{color:var(--heading-color);}
a{color:var(--link-color);cursor:pointer;text-decoration:none}
a:hover{opacity:0.5;}
nav a{margin-right:10px}
strong,b{color:var(--heading-color)}
button{margin:0;cursor:pointer}
time,.comment-meta a{color:var(--gray-color);}
main{padding:10% 7% 7%; background-color:var(--main-color);box-shadow: 0px 10px 20px 0px var(--shadow-color);}
table{width:100%}
hr{border:0;border-top:1px dashed}
img{max-width:100%;height:auto}
code{font-family:monospace;padding:2px;background-color:var(--code-background-color);color:var(--code-color);border-radius:3px}
blockquote{border-left:1px solid var(--gray-color);color:var(--code-color);padding-left:20px;font-style:italic}
header,footer{padding:20px 0;margin: 10px 0;color:var(--gray-color);}
header a,footer a{color:var(--nav-color)}
article.list{margin-bottom: 50px;padding-bottom:50px;border-bottom:1px dashed var(--gray-color);}
h1.title,h2.title {margin:0;line-height:1.6;}
.intro{color:var(--gray-color);margin-bottom:80px;}
.single .content{margin-top: 50px;}
.content a,.comment-reply a,.page-navigator .current{border-bottom:1px solid var(--link-color);}
.content a:has(img){border:none}
.tags{margin-top: 50px;}
.tags,.tags a{color:var(--gray-color);margin-right: 15px;}
.page-navigator{list-style: none;padding:0;}
.page-navigator li{display: inline-block;padding:0 6px;margin-right: 10px;}
#comments{margin-top:40px;padding-top:40px;border-top:1px dashed var(--gray-color);}
.comment-list{list-style: none;padding:0;margin-bottom:40px;}
.comment-children{margin:30px 0 0 50px}
.comment-author cite{font-weight:bold;font-style:normal;}
.comment-author .says,.comment-author .avatar{display:none}
input,textarea{border-radius:4px;border:1px solid var(--gray-color);display:block;font-size:0.9em;margin:0 0 10px;padding:10px;width:100%;max-width:calc(100% - 25px);}
button[type="submit"]{border:none;font-size:0.9em;border-radius:4px;padding:10px 16px;background:#ccc;}
button[type="submit"]:hover{cursor:pointer;opacity:.7;}
#search input{margin:20px 5px 10px 0;width: initial;display:inline-block;}
.results{list-style:none;padding:0;margin-bottom:40px;padding-bottom:40px;border-bottom:1px dashed var(--gray-color);}
.results li{margin:20px 0 0;}

0 comments on commit cbe99ce

Please sign in to comment.