Skip to content

Commit 7fa0e31

Browse files
authored
Merge pull request #11 from CairBin/master
merge: 新增Tiphia主题
2 parents 3bc70f6 + 6d2ac1c commit 7fa0e31

13 files changed

Lines changed: 4183 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
[GreenGrapes](GreenGrapes) | 响应式绿色科技感双栏主题 | 1.0.2 | [hongweipeng](https://github.com/hongweipeng) | [Download]()
3939
[Nova](Nova) | 仿Farbox响应式极简单栏主题 | 1.0.1 | [jiya](https://github.com/shuxiao9058) | [Special]()
4040
[Slanted](Slanted) | (WordPress移植)响应式多配色个性主题 | 1.1.0 | [DT27](https://github.com/DT27) | [Special]()
41+
[Tiphia](https://github.com/cairbin/tiphia-for-typecho) | (TiphiaPress移植)一款简洁清爽的响应式单栏主题 | 1.1.0 | [CairBin](https://github.com/cairbin) | [Download]()
4142
[Yakumo](Yakumo) | (Ghost移植)响应式大Banner单栏主题 | 1.0.0 | [八云酱](https://github.com/bayunjiang) | [Special]()
4243
[JieXiang](jiexiang) | “结香”多配色简洁双栏主题 | 1.0.1 | [ShingChi](https://github.com/shingchi) | [Download]()
4344
[PosArt](posart) | 响应式蓝灰色无图单栏主题 | 1.0 | [Kunr (Lingoys Art)](https://github.com/Rakume) | [Download]()

Tiphia/404.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
2+
<?php $this->need('header.php'); ?>
3+
4+
<article class="article theme-page not-found-page">
5+
<a class="back-link" href="<?php $this->options->siteUrl(); ?>">返回首页</a>
6+
<div class="not-found-panel">
7+
<strong>404</strong>
8+
<h1>页面没有找到</h1>
9+
<p>这个地址可能已经失效,或者你访问的内容被移动了。</p>
10+
<form class="search-form not-found-search" method="post" action="<?php $this->options->siteUrl(); ?>">
11+
<input type="search" name="s" placeholder="搜索文章">
12+
<button type="submit">搜索</button>
13+
</form>
14+
</div>
15+
</article>
16+
17+
<?php $this->need('footer.php'); ?>

Tiphia/README.md

Lines changed: 254 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,254 @@
1+
# Tiphia for Typecho
2+
3+
Tiphia for Typecho 是从 TiphiaPress 默认主题移植而来的 Typecho 主题,保留了 Tiphia 默认主题的首页、文章卡片、文章页、分类/标签/时间线、友情链接、评论卡片、液态玻璃样式和可配置的主题颜色。
4+
5+
主题仓库:[cairbin/tiphia-for-typecho](https://github.com/cairbin/tiphia-for-typecho)
6+
7+
- 原主题来源:[TiphiaPress/tiphia-default-themes](https://github.com/tiphiapress/tiphia-default-themes)
8+
- 主题作者演示站点:[CairBin](https://posts.cairbin.top)
9+
10+
11+
本仓库与原主题仓库独立维护,样式细节会有较小差异。演示站点为TiphiaPress构建,并非typecho。
12+
13+
## 安装
14+
15+
1. 解压后,将主题文件夹改名`tiphia-for-typecho`放到 Typecho 的 `usr/themes/`
16+
2. 进入 Typecho 后台:`控制台 -> 外观`
17+
3. 启用 `Tiphia for Typecho`
18+
4. 进入主题设置,按需要填写配置。
19+
20+
21+
22+
## 功能
23+
24+
- 响应式首页、文章列表、文章页和独立页面。
25+
- 支持强调色、字体栈、额外 CSS。
26+
- 支持置顶文章。
27+
- 支持热门文章和最新评论。
28+
- 支持分类、标签、时间线内置页面。
29+
- 支持友情链接页面。
30+
- 支持 404 页面。
31+
- 支持页脚 Font Awesome 图标。
32+
- 支持 ICP 备案和公安备案链接。
33+
- 支持 Gravatar 镜像。
34+
- 支持 Cookie 提示。
35+
- 支持液态玻璃样式。
36+
- 评论区使用主题自绘卡片样式,超过三层后改为平铺。
37+
38+
## 内置页面
39+
40+
在 Typecho 后台创建独立页面,并设置对应 slug,即可启用主题内置页面。
41+
42+
| slug | 用途 |
43+
| --- | --- |
44+
| `categories` | 分类目录 |
45+
| `tags` | 标签目录 |
46+
| `timeline` | 时间线 |
47+
| `links` | 友情链接 |
48+
49+
`links` 页面会先渲染页面正文,再渲染主题设置中的友情链接卡片。
50+
51+
## 主题配置
52+
53+
### 基础外观
54+
55+
| 配置项 | 说明 |
56+
| --- | --- |
57+
| `accent_color` | 强调色,按钮、链接、标签、激活导航等会使用该颜色。示例:`#2563eb` |
58+
| `font_family` | 字体栈,会写入 CSS 变量 `--theme-font`|
59+
| `liquid_glass` | 是否启用液态玻璃样式。 |
60+
| `custom_css` | 额外 CSS,会直接输出到页面头部。 |
61+
| `avatar` | 站点头像 URL,显示在首页和导航。 |
62+
63+
### 首页
64+
65+
| 配置项 | 说明 |
66+
| --- | --- |
67+
| `posts_per_page` | 首页/归档每页文章数量。 |
68+
| `show_popular_posts` | 是否显示热门文章。 |
69+
| `popular_posts_limit` | 热门文章数量。 |
70+
| `show_recent_comments` | 是否显示最新评论。 |
71+
| `recent_comments_limit` | 最新评论数量。 |
72+
| `pinned_post_ids` | 置顶文章 ID,支持 JSON 数组或逗号分隔。 |
73+
| `pinned_post_slugs` | 置顶文章 slug,支持 JSON 数组或逗号分隔。 |
74+
75+
置顶文章示例:
76+
77+
```json
78+
[1, 2, 3]
79+
```
80+
81+
```json
82+
["hello-world", "about-tiphia"]
83+
```
84+
85+
### 导航
86+
87+
顶部导航默认包含:首页、分类、标签、时间线。可以通过 `nav_pages` 追加自定义页面。
88+
89+
JSON 示例:
90+
91+
```json
92+
[
93+
{ "label": "关于", "slug": "start-page" },
94+
{ "label": "友链", "slug": "links" }
95+
]
96+
```
97+
98+
也支持逐行格式:
99+
100+
```text
101+
关于|start-page
102+
友链|links
103+
```
104+
105+
**请注意:特殊的几个页面,即时间线、分类、标签、友情链接页面需要在 Typecho 后台创建并设置 slug,主题会根据slug渲染各自独特的内容,对应slug如下所示。**
106+
107+
| 页面 | slug |
108+
| --- | --- |
109+
| 时间线 | timeline |
110+
| 分类目录 | categories |
111+
| 标签目录 | tags |
112+
| 友情链接 | links |
113+
114+
115+
116+
117+
### 友情链接
118+
119+
配置项:`friend_links`
120+
121+
格式为 JSON 对象数组:
122+
123+
```json
124+
[
125+
{
126+
"name": "CairBin",
127+
"avatar": "https://posts.cairbin.top/avatar.png",
128+
"url": "https://posts.cairbin.top",
129+
"description": "个人博客",
130+
"category": "朋友"
131+
},
132+
{
133+
"name": "TiphiaPress",
134+
"avatar": "https://example.com/tiphia.png",
135+
"url": "https://github.com/tiphiapress/tiphia",
136+
"description": "TiphiaPress 项目",
137+
"category": "项目"
138+
}
139+
]
140+
```
141+
142+
字段说明:
143+
144+
| 字段 | 说明 |
145+
| --- | --- |
146+
| `name` | 站点名称。 |
147+
| `avatar` | 头像 URL。 |
148+
| `url` | 友情链接地址。 |
149+
| `description` | 简短介绍。 |
150+
| `category` | 分组名称。 |
151+
152+
添加友情链接后,会在slug为`links`的页面渲染友情链接卡片。同一分类的卡片会被聚合在同一个卡片组中,其标题名称为分类名称。
153+
154+
### 评论
155+
156+
| 配置项 | 说明 |
157+
| --- | --- |
158+
| `gravatar_base_url` | Gravatar 镜像地址。可填写 `https://cn.cravatar.com/avatar/`|
159+
160+
主题定义了 Typecho 的 `threadedComments()` 评论输出函数,因此评论头像会走 `gravatar_base_url` 配置。
161+
162+
评论区规则:
163+
164+
- 每条评论显示为卡片。
165+
- 子评论正常嵌套。
166+
- 超过三层后改为平铺,避免无限缩进导致内容变窄。
167+
- 回复表单会跟随 Typecho 的回复逻辑移动。
168+
169+
### 站点公告
170+
171+
| 配置项 | 说明 |
172+
| --- | --- |
173+
| `announcementEnabled` | 是否开启站点公告。 |
174+
| `announcementTitle` | 公告标题。 |
175+
| `announcementContent` | 公告内容。 |
176+
| `announcementUrl` | 公告链接。 |
177+
| `announcementLinkText` | 公告链接文字。 |
178+
179+
### Cookie 提示
180+
181+
| 配置项 | 说明 |
182+
| --- | --- |
183+
| `cookie_notice_enabled` | 是否开启 Cookie 提示。 |
184+
| `cookie_notice_text` | Cookie 提示文本。 |
185+
| `cookie_notice_link` | 了解更多链接。 |
186+
| `cookie_notice_link_text` | 链接文字。 |
187+
| `cookie_notice_button_text` | 确认按钮文字。 |
188+
189+
用户点击按钮后,主题会使用 `localStorage` 记住关闭状态。
190+
191+
### 页脚
192+
193+
194+
| 配置项 | 说明 |
195+
| --- | --- |
196+
| `footer_icons` | 页脚 Font Awesome 图标。 |
197+
| `tag_cloud_limit` | 页脚标签云数量。 |
198+
| `icp` | ICP 备案号。 |
199+
| `icp_url` | ICP 备案链接,默认可填 `https://beian.miit.gov.cn/`|
200+
| `police_record` | 公安备案号。 |
201+
| `police_record_url` | 公安备案链接。 |
202+
203+
`footer_icons` JSON 示例:
204+
205+
页脚图标使用 Font Awesome 图标库,版本为6.5.2。
206+
207+
```json
208+
[
209+
["fa-brands fa-github", "https://github.com/cairbin/tiphia-for-typecho"],
210+
["fa-solid fa-rss", "/feed/"]
211+
]
212+
```
213+
214+
也支持逐行格式:
215+
216+
```text
217+
fa-brands fa-github|https://github.com/cairbin/tiphia-for-typecho
218+
fa-solid fa-rss|/feed/
219+
```
220+
221+
`fa-brands fa-github`为Font Awesome图标的类名,`https://github.com/cairbin/tiphia-for-typecho`为对应的链接地址。
222+
更多请参考[Font Awesome 图标库](https://fontawesome.com/).
223+
224+
## 常见问题
225+
226+
227+
228+
### 友情链接页面没有显示卡片
229+
230+
请确认:
231+
232+
1. 已创建独立页面。
233+
2. 页面 slug 是 `links`
234+
3. 主题设置中的 `friend_links` 是合法 JSON 数组。
235+
236+
### 分类、标签、时间线链接打不开
237+
238+
请创建对应 slug 的独立页面:
239+
240+
- `categories`
241+
- `tags`
242+
- `timeline`
243+
244+
### 评论样式没有更新
245+
246+
请强制刷新浏览器缓存。若使用缓存插件或 CDN,也需要清理缓存。
247+
248+
## 致谢
249+
250+
- [TiphiaPress](https://github.com/tiphiapress/tiphia)
251+
- [Typecho](https://typecho.org/)
252+
- [Font Awesome](https://fontawesome.com/)
253+
254+
如果你喜欢这个主题,欢迎给项目一个 Star。也欢迎使用TiphiaPress来构建你的博客。

Tiphia/archive.php

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

Tiphia/comments.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
2+
3+
<section class="comments" id="comments">
4+
<h2>评论</h2>
5+
<?php $this->comments()->to($comments); ?>
6+
<?php if ($comments->have()): ?>
7+
<?php $comments->listComments(array('before' => '<ol class="comment-list">', 'after' => '</ol>')); ?>
8+
<?php $comments->pageNav(); ?>
9+
<?php else: ?>
10+
<p>暂无评论</p>
11+
<?php endif; ?>
12+
13+
<?php if ($this->allow('comment')): ?>
14+
<div id="<?php $this->respondId(); ?>" class="respond">
15+
<div class="cancel-comment-reply"><?php $comments->cancelReply(); ?></div>
16+
<form class="comment-form" method="post" action="<?php $this->commentUrl(); ?>" id="comment-form" role="form">
17+
<h3 id="response">提交评论</h3>
18+
<?php if ($this->user->hasLogin()): ?>
19+
<p class="comment-login-identity">以 <strong><?php $this->user->screenName(); ?></strong> 身份评论</p>
20+
<?php else: ?>
21+
<div class="form-row">
22+
<input type="text" name="author" id="author" placeholder="昵称" value="<?php $this->remember('author'); ?>" required>
23+
<input type="email" name="mail" id="mail" placeholder="邮箱" value="<?php $this->remember('mail'); ?>"<?php if ($this->options->commentsRequireMail): ?> required<?php endif; ?>>
24+
</div>
25+
<input type="url" name="url" id="url" placeholder="网址,可选" value="<?php $this->remember('url'); ?>"<?php if ($this->options->commentsRequireUrl): ?> required<?php endif; ?>>
26+
<?php endif; ?>
27+
<textarea name="text" id="textarea" rows="5" placeholder="写下你的评论" required><?php $this->remember('text'); ?></textarea>
28+
<button type="submit" class="submit">提交评论</button>
29+
</form>
30+
</div>
31+
<?php else: ?>
32+
<p>评论已关闭</p>
33+
<?php endif; ?>
34+
</section>

Tiphia/footer.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
2+
</main>
3+
<footer>
4+
<?php tiphia_theme_footer_icons(); ?>
5+
<div class="term-cloud">
6+
<?php $this->widget('Widget_Metas_Tag_Cloud', 'ignoreZeroCount=1&limit=' . tiphia_theme_int('tag_cloud_limit', 24, 0, 100))->to($tags); ?>
7+
<?php while ($tags->next()): ?>
8+
<a href="<?php $tags->permalink(); ?>"><?php $tags->name(); ?> <small><?php $tags->count(); ?></small></a>
9+
<?php endwhile; ?>
10+
</div>
11+
<?php if (trim((string) tiphia_theme_option('icp', '')) !== '' || trim((string) tiphia_theme_option('police_record', '')) !== ''): ?>
12+
<div class="filing-info">
13+
<?php if (trim((string) tiphia_theme_option('icp', '')) !== ''): ?>
14+
<?php if (trim((string) tiphia_theme_option('icp_url', '')) !== ''): ?>
15+
<a href="<?php echo tiphia_theme_attr(tiphia_theme_option('icp_url', '')); ?>" rel="nofollow noopener noreferrer" target="_blank"><?php echo tiphia_theme_attr(tiphia_theme_option('icp', '')); ?></a>
16+
<?php else: ?>
17+
<span><?php echo tiphia_theme_attr(tiphia_theme_option('icp', '')); ?></span>
18+
<?php endif; ?>
19+
<?php endif; ?>
20+
<?php if (trim((string) tiphia_theme_option('police_record', '')) !== ''): ?>
21+
<?php if (trim((string) tiphia_theme_option('police_record_url', '')) !== ''): ?>
22+
<a href="<?php echo tiphia_theme_attr(tiphia_theme_option('police_record_url', '')); ?>" rel="nofollow noopener noreferrer" target="_blank"><?php echo tiphia_theme_attr(tiphia_theme_option('police_record', '')); ?></a>
23+
<?php else: ?>
24+
<span><?php echo tiphia_theme_attr(tiphia_theme_option('police_record', '')); ?></span>
25+
<?php endif; ?>
26+
<?php endif; ?>
27+
</div>
28+
<?php endif; ?>
29+
<p class="theme-powered-by">
30+
Theme <a href="https://github.com/cairbin/tiphia-for-typecho" rel="nofollow noopener noreferrer" target="_blank">Tiphia</a>
31+
by <a href="https://posts.cairbin.top" rel="nofollow noopener noreferrer" target="_blank">CairBin</a>
32+
</p>
33+
</footer>
34+
<?php tiphia_theme_cookie_notice(); ?>
35+
</div>
36+
<?php $this->footer(); ?>
37+
</body>
38+
</html>

0 commit comments

Comments
 (0)