Skip to content

Commit

Permalink
refactor: 页面优化,更新 README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
john1298308460 committed Jan 22, 2024
1 parent 7b32c9b commit 442c82e
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 99 deletions.
41 changes: 25 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
# ThemeMin Vite Starter
# Clear 主题使用与限制

一个集成了 Vite 的主题快速开始模板。
基于 Halo2.0 开发,将当前目录压缩为 zip 包后安装

主题开发文档可查阅:<https://docs.halo.run/2.0.0-SNAPSHOT/developer-guide/theme/prepare>
基于 [LoveIt](https://github.com/dillonzq/LoveIt) Hugo 主题模版进行开发

## 开发
初始化设置步骤如下:

```bash
git clone [email protected]:halo-dev/theme-vite-starter.git ~/halo2-dev/themes/theme-vite-starter
```
- [x] 安装主题后,需要在 Halo 的管理后台(Console 端)设置,在「菜单」—「主菜单」中,依次设置四个菜单项:
- 【菜单1】**名称**:所有文章;**类型**:自定义链接;**链接地址**:/archives;其他为默认
- 【菜单2】**名称**:标签;**类型**:自定义链接;**链接地址**:/tags;其他为默认
- 【菜单3】**名称**:分类;**类型**:自定义链接;**链接地址**:/categories;其他为默认
- 【菜单4】**类型**:自定义页面;**自定义页面**:选择「关于」页面;其他为默认

```bash
cd ~/halo2-dev/themes/theme-vite-starter
```
上述设置完成后,提交并保存,并且重载主题配置刷新。

```bash
pnpm install
```

```bash
pnpm dev
```
- [x] 如果需要展示博客内容,需要在 Console 端添加 **文章 / 标签 / 分类**,然后将文章在设置里划分到对应的标签和分类中

注:如果主题的部分样式丢失,可在 Console 端的主题 tag 菜单底部点击保存并再次刷新主题页面查看效果

预览效果
![clear1.jpg](clear1.jpg)

![clear2.jpg](clear2.jpg)

预览地址:
http://43.136.69.44:8090/

如有版权问题请联系 [email protected] 进行修改

主题开发参考 [Halo官方文档](https://docs.halo.run)
Binary file added clear1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added clear2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 0 additions & 4 deletions settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,6 @@ spec:
- group: system
label: 主题参数
formSchema:
- $formkit: text
name: version
label: 主题版本
value: "1.0.0"
- $formkit: attachment
name: svgFavicon
label: 站点图标
Expand Down
28 changes: 11 additions & 17 deletions templates/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,9 @@ <h3 id=下载安装>
<li>
<i class="fa fa-download" aria-hidden="true"></i>
&nbsp;下载
<strong>
<a href=https://github.com/john1298308460/theme-clear target=_blank rel="noopener noreffer">
releases
</a>
</strong>
<a href=https://github.com/f2ccloud/theme-clear target=_blank rel="noopener noreffer">
releases
</a>
通过 Halo Console 后台主题安装处上传即可。
</li>
</ul>
Expand Down Expand Up @@ -140,11 +138,9 @@ <h3 id=社交和评论系统>
<i class="fas fa-comment-dots fa-fw" aria-hidden=true>
</i>
&nbsp;支持
<strong>
<a href=https://github.com/halo-dev/plugin-comment-widget target=_blank rel="noopener noreffer">
Halo 评论插件
</a>
</strong>
<a href=https://github.com/halo-dev/plugin-comment-widget target=_blank rel="noopener noreffer">
Halo 评论插件
</a>
评论系统
</li>
</ul>
Expand Down Expand Up @@ -176,12 +172,10 @@ <h3 id=扩展功能>
<i class="fab fa-font-awesome fa-fw" aria-hidden=true>
</i>
&nbsp;支持
<strong>
<a href=https://fontawesome.com/ target=_blank rel="noopener noreffer">
Font Awesome
</a>
图标
</strong>
<a href=https://fontawesome.com/ target=_blank rel="noopener noreffer">
Font Awesome
</a>
图标
</li>
<li>
<i class="fas fa-i-cursor fa-fw" aria-hidden=true>
Expand Down Expand Up @@ -223,7 +217,7 @@ <h2 id=其他>
</h2>
<p>
如果你对主题有什么建议或者意见,欢迎评论区留言,或者提
<a href=https://github.com/john1298308460/theme-clear target=_blank rel="noopener noreffer">
<a href=https://github.com/f2ccloud/theme-clear target=_blank rel="noopener noreffer">
PR & issue
</a>
Expand Down
2 changes: 0 additions & 2 deletions templates/categories.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<!DOCTYPE html>
<html xmlns:th="https://www.thymeleaf.org" th:replace="~{modules/layout :: html(content = ~{::content})}">
<th:block th:fragment="content">

<div class="page archive">
<h2 class="single-title animate__animated animate__pulse animate__faster">
所有分类
Expand Down Expand Up @@ -33,7 +32,6 @@ <h3 class=card-item-title>
</div>
</th:block>
</div>

</div>
</th:block>
</html>
Expand Down
35 changes: 5 additions & 30 deletions templates/modules/head/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class=header-title>
<a href=/ title=LoveIt>
<span class=header-title-pre>
<img th:src="${theme.config.home.top_logo}" style="height: 24px; width: 24px;" aria-hidden=true />
<img th:src="${theme.config.home.top_logo}" style="height: 24px; width: 24px;" aria-hidden=true/>
</span>
<th:block th:text="${theme.config.home.top_logo_desc}"></th:block>
</a>
Expand Down Expand Up @@ -35,18 +35,6 @@
<i class="fas fa-adjust fa-fw" aria-hidden=true>
</i>
</a>
<!-- <a href=javascript:void(0); class="menu-item language" title=选择语言>-->
<!-- <i class="fa fa-globe" aria-hidden=true>-->
<!-- </i>-->
<!-- <select class=language-select id=language-select-desktop onchange="location=this.value">-->
<!-- <option value=/>-->
<!-- English-->
<!-- </option>-->
<!-- <option value=/zh-cn/ selected>-->
<!-- 简体中文-->
<!-- </option>-->
<!-- </select>-->
<!-- </a>-->
</div>
</div>
</div>
Expand All @@ -58,11 +46,10 @@
<div class=header-wrapper>
<div class=header-title>
<a href=/ title=LoveIt>
<span class=header-title-pre>
<i class="far fa-kiss-wink-heart fa-fw" aria-hidden=true>
</i>
</span>
LoveIt
<span class=header-title-pre>
<img th:src="${theme.config.home.top_logo}" style="height: 24px; width: 24px;" aria-hidden=true/>
</span>
<th:block th:text="${theme.config.home.top_logo_desc}"></th:block>
</a>
</div>
<div class=menu-toggle id=menu-toggle-mobile>
Expand Down Expand Up @@ -110,18 +97,6 @@
<i class="fas fa-adjust fa-fw" aria-hidden=true>
</i>
</a>
<!-- <a href=javascript:void(0); class=menu-item title=选择语言>-->
<!-- <i class="fa fa-globe fa-fw" aria-hidden=true>-->
<!-- </i>-->
<!-- <select class=language-select onchange="location=this.value">-->
<!-- <option value=/>-->
<!-- English-->
<!-- </option>-->
<!-- <option value=/zh-cn/ selected>-->
<!-- 简体中文-->
<!-- </option>-->
<!-- </select>-->
<!-- </a>-->
</div>
</div>
</header>
Expand Down
6 changes: 4 additions & 2 deletions templates/modules/head/link.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@
<link rel=canonical href=https://hugoloveit.com/zh-cn/>
<link rel=stylesheet th:href="@{/assets/css/style.min.css}">

<link rel=preload href=https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/css/all.min.css as=style onload='this.onload=null; this.rel="stylesheet"'>
<link rel=preload href=https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/css/all.min.css as=style
onload='this.onload=null; this.rel="stylesheet"'>
<noscript>
<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/css/all.min.css>
</noscript>
<link rel=preload href=https://cdn.jsdelivr.net/npm/[email protected]/animate.min.css as=style onload='this.onload=null; this.rel="stylesheet"'>
<link rel=preload href=https://cdn.jsdelivr.net/npm/[email protected]/animate.min.css as=style
onload='this.onload=null; this.rel="stylesheet"'>
<noscript>
<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/[email protected]/animate.min.css>
</noscript>
Expand Down
16 changes: 0 additions & 16 deletions templates/modules/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
<th:block th:replace="~{modules/head/meta.html}" />
<th:block th:replace="~{modules/head/link.html}" />
<th:block th:replace="~{modules/head/seo.html}" />
<link rel="stylesheet" th:href="@{/assets/dist/style.css}" href="./assets/dist/style.css" />
</head>
<body data-header-desktop=fixed data-header-mobile=auto>
<script type="text/javascript">
Expand All @@ -26,8 +25,6 @@
</main>
<th:block th:replace="~{modules/foot/footer}"/>
</div>


<div id=fixed-buttons>
<a href=# id=back-to-top class=fixed-button title=回到顶部>
<i class="fas fa-arrow-up fa-fw" aria-hidden=true>
Expand All @@ -38,26 +35,13 @@
</i>
</a>
</div>


<script data-cfasync="false" th:src="@{/assets/js/email-decode.min.js}"></script>
<script type=text/javascript th:src="@{/assets/js/autocomplete.min.js}"></script>
<script type=text/javascript th:src="@{/assets/js/algoliasearch-lite.umd.min.js}"></script>
<script type=text/javascript th:src="@{/assets/js/lazysizes.min.js}"></script>
<script type=text/javascript th:src="@{/assets/js/clipboard.min.js}"></script>
<script type=text/javascript th:src="@{/assets/js/sharer.min.js}"></script>
<script type=text/javascript th:src="@{/assets/js/index.umd.js}"></script>

<!-- <script type=text/javascript th:src="@{/assets/js/ofi.min.js}"></script>-->
<!-- <script type=text/javascript th:src="@{/assets/js/cookieconsent.min.js}"></script>-->
<!-- <script type=text/javascript th:src="@{/assets/js/Valine.min.js}"></script>-->
<!-- <script type=text/javascript th:src="@{/assets/js/gitalk.min.js}"></script>-->
<!-- <script type=text/javascript th:src="@{/assets/js/mapbox-gl-language.js}"></script>-->
<!-- <script type=text/javascript th:src="@{/assets/js/mapbox-gl.min.js}"></script>-->
<!-- <script type=text/javascript th:src="@{/assets/js/lightgallery.min.js}"></script>-->
<!-- <script type=text/javascript th:src="@{/assets/js/auto-render.min.js}"></script>-->


<script defer
src="https://static.cloudflareinsights.com/beacon.min.js/v84a3a4012de94ce1a686ba8c167c359c1696973893317"
crossorigin="anonymous">
Expand Down
11 changes: 1 addition & 10 deletions templates/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ <h1 class="single-title animate__animated animate__flipInX" th:text="${post.spec
</span>
&nbsp;
<span class=post-category>
收录于

<th:block th:if="${not #lists.isEmpty(post.categories)}">
收录于
<a th:href="@{${category.status.permalink}}" th:each="category : ${post.categories}">
<i class="far fa-folder fa-fw" aria-hidden=true>
</i>
Expand All @@ -39,9 +38,7 @@ <h1 class="single-title animate__animated animate__flipInX" th:text="${post.spec
</i>
<th:block th:with="content = ${postFinder.content(post.metadata.name)}">
<th:block th:with="wordCount = ${#strings.length(content.content)}">

<span th:text="${wordCount}"></span>

<i class="far fa-clock fa-fw" aria-hidden=true>
</i>
<th:block th:if="${wordCount / 400 lt 1}">
Expand All @@ -50,7 +47,6 @@ <h1 class="single-title animate__animated animate__flipInX" th:text="${post.spec
<th:block th:if="${wordCount / 400 ge 1}">
&nbsp;预计阅读 [[${wordCount / 400}]] 分钟&nbsp;
</th:block>

<span class=leancloud_visitors>
<i class="far fa-eye fa-fw" aria-hidden=true>
</i>
Expand All @@ -72,7 +68,6 @@ <h1 class="single-title animate__animated animate__flipInX" th:text="${post.spec
<hr/>
</section>
</div>

<div class=post-footer id=post-footer>
<div class=post-info>
<div class=post-info-line>
Expand Down Expand Up @@ -107,15 +102,13 @@ <h1 class="single-title animate__animated animate__flipInX" th:text="${post.spec
</span>
</section>
</div>

<div class=post-nav th:with="postCursor = ${postFinder.cursor(post.metadata.name)}">
<a th:if="${postCursor.hasPrevious()}" th:href="@{${postCursor.previous.status.permalink}}" class=prev rel=prev
th:title="${postCursor.previous.spec.title}">
<i class="fas fa-angle-left fa-fw" aria-hidden=true>
</i>
<span th:text="${postCursor.previous.spec.title}"></span>
</a>

<a th:if="${postCursor.hasNext()}" th:href="@{${postCursor.next.status.permalink}}" class=next rel=next
th:title="${postCursor.next.spec.title}">
<i class="fas fa-angle-right fa-fw" aria-hidden=true>
Expand All @@ -134,8 +127,6 @@ <h1 class="single-title animate__animated animate__flipInX" th:text="${post.spec
/>
</div>
</article>


</th:block>
</html>

Expand Down
4 changes: 2 additions & 2 deletions theme.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ spec:
website: https://www.halo.run
description: A development starter theme with Vite Ecosystem for Halo
logo: https://www.halo.run/logo
website: https://github.com/john1298308460/theme-clear
repo: https://github.com/john1298308460/theme-clear.git
website: https://github.com/f2ccloud/theme-clear
repo: https://github.com/f2ccloud/theme-clear.git
settingName: "theme-clear-setting"
configMapName: "theme-clear-configMap"
version: 1.0.0
Expand Down

0 comments on commit 442c82e

Please sign in to comment.