Skip to content

Commit

Permalink
📃 docs: 文档更新
Browse files Browse the repository at this point in the history
  • Loading branch information
白云苍狗 committed Oct 7, 2023
1 parent 391fd40 commit 862cd77
Show file tree
Hide file tree
Showing 9 changed files with 584 additions and 468 deletions.
14 changes: 14 additions & 0 deletions docs/.vitepress/assets/log.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@
{
"large_version": "v2.1.x",
"children": [
{
"version": "2.1.3",
"date": "2023-10-07",
"logs": [
{
"type": "feat",
"text": "关于页支持配置和自定义内容共存"
},
{
"type": "feat",
"text": "增加 note tag"
}
]
},
{
"version": "2.1.2",
"date": "2023-09-27",
Expand Down
16 changes: 10 additions & 6 deletions docs/.vitepress/components/ChangeLogs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,33 @@ import logs from "../assets/log.json";
<template v-for="item in logs">
<h2 :id="item.large_version.replace(/\./g, '-')">
{{ item.large_version }}
<a class="header-anchor" :href="`#${item.large_version.replace(/\./g, '-')}`" aria-hidden="true">#</a>
<a class="header-anchor" :href="`#${item.large_version.replace(/\./g, '-')}`" aria-hidden="true">&ZeroWidthSpace;</a>
</h2>
<template v-for="log in item.children">
<blockquote>
<div class="header-title">
<Badge :type="log.version.search('beta') > -1 ? 'warning' : 'tip'">{{ log.version }}</Badge>
<span>{{ log.date }}</span>
</blockquote>
</div>
<ul>
<ChangeLog v-for="(item, index) in log.logs" v-bind="item" :key="index"></ChangeLog>
</ul>
</template>
</template>
</template>
<style lang="less" scoped>
blockquote {
.header-title {
display: flex;
justify-content: space-between;
align-items: end;
align-items: center;
.VPBadge {
transform: translateY(0px);
}
}
ul {
background: var(--vp-c-bg-alt);
padding: 10px 10px 10px 30px;
padding: 10px 10px 10px 20px;
border-radius: 6px;
}
</style>
10 changes: 10 additions & 0 deletions docs/.vitepress/components/SponsorsLog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ modes.forEach(i => {
<div>{{ item.title }}</div>
</div>
</div>
<div class="sponsor-pay">
<div class="sponsor-pay-item">
<div class="pay-img-item">
<a href="https://mp-8b005489-7724-4f8c-afdd-30192ff4f7ae.cdn.bspapp.com/cloudstorage/alipay_hd.jpg" target="_blank" rel="noopener noreferrer">
<img src="https://mp-8b005489-7724-4f8c-afdd-30192ff4f7ae.cdn.bspapp.com/cloudstorage/alipay_hd.jpg">
</a>
</div>
<div>支付宝扫码领红包(免费)</div>
</div>
</div>
<div class="sponsor-content">
<slot></slot>
</div>
Expand Down
6 changes: 3 additions & 3 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default defineConfig({
text: "帮助改善此页面!(  ̄□ ̄)/",
},
nav: [
{ text: "Guide", link: "/en/guide/" },
{ text: "Guide", link: "/guide/" },
{ text: "DemoSites", link: "/demo/" },
{ text: "Sponsors", link: "/sponsors/" },
{
Expand All @@ -53,8 +53,8 @@ export default defineConfig({
{
text: "Docs",
items: [
{ text: "Preview", link: "http://hexo-theme-async.imalun.com/" },
{ text: "Laster", link: "http://async-docs.imalun.com/" },
{ text: "Preview", link: "https://hexo-theme-async.imalun.com/" },
{ text: "Laster", link: "https://async-docs.imalun.com/" },
],
},
{ text: "HexoEditor", link: "https://web-hexo-editor.imalun.com/" },
Expand Down
2 changes: 2 additions & 0 deletions docs/guide/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -1055,6 +1055,8 @@ layout:
back_to_top: _widget/back-to-top
# 固定按钮模板
fixed_btn: _widget/fixed-btn
# 关于页面配置卡片
about_card: _widget/about-card
# 侧栏
sidebar_user: _partial/sidebar/card/user
sidebar_social: _partial/sidebar/card/social
Expand Down
60 changes: 34 additions & 26 deletions docs/guide/page.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,28 @@
- `author`:文章作者
- `originalLink`:文章源链接(用于转载)


内置的置顶脚本已删除,将 `hexo-generator-index` 升级到 `2.0.0+` 以上版本即可。

``` yaml
```yaml
---
title: 从零开始搭建一个后台模板
keywords: admin-template,vue,element,后台模板
cover: [https://www.logosc.cn/uploads/resources/2018/11/29/1543459457_thumb.jpg]
sticky: 10
banner:
banner:
type: img
bgurl: https://pic1.zhimg.com/v2-b3c2c6745b9421a13a3c4706b19223b3_r.jpg
bannerText: Hi my new friend!
toc: false # 无需显示目录
---
```


## 归档 Archives

Hexo 默认支持。

## 分类 Categories

如果您尚未安装 `hexo-generator-category`,请输入 `npm install hexo-generator-category`

新建 `categories` 页面,在博客根目录下输入:
Expand Down Expand Up @@ -91,14 +91,16 @@ layout: tag
```bash
hexo new page links
```

进入 `source/links/index.md`,设置 `layout` 字段。

``` yaml {3}
```yaml {3}
---
title: 友情链接
layout: links
---
```

`_config.async.yml` 中的添加 `links` 配置信息。

提示:(❌)不是在 `banner.links` 添加,(✔)是直接在配置文件添加新的 `links` 属性。
Expand All @@ -108,7 +110,7 @@ layout: links
- `image`:头像图片链接
- `desc`:一句话描述

``` yaml
```yaml
links:
- name: 白云苍狗
url: //www.imalun.com/
Expand All @@ -118,7 +120,7 @@ links:
如果您的友链比较多,可能会导致 `_config.async.yml` 过长,您可以将 links 配置拆分出来。在 Hexo 工作目录下新建 `source/_data/links.yml` 文件,字段和 `_config.async.yml` 中的一致,只是不再需要 `links` 字段。

``` yaml
```yaml
- name: 白云苍狗
url: //www.imalun.com/
image: //www.imalun.com/images/avatar.jpg
Expand All @@ -127,18 +129,19 @@ links:

也可以是 `source/_data/links.json` 文件

``` json
```json
[
{
"name": "白云苍狗",
"url": "//www.imalun.com/",
"image": "//www.imalun.com/images/avatar.jpg",
"desc": "醒,亦在人间;梦,亦在人间"
}
{
"name": "白云苍狗",
"url": "//www.imalun.com/",
"image": "//www.imalun.com/images/avatar.jpg",
"desc": "醒,亦在人间;梦,亦在人间"
}
]
```

## 关于 About

新建关于页面。

```bash
Expand All @@ -147,34 +150,38 @@ hexo new page about

进入 `source/about/index.md`,设置 `layout` 字段。

``` yaml {3}
```yaml {3}
---
title: 关于
layout: about
---
```

如果使用内置模板,可以设置 `_config.async.yml` 中的 `about`。
``` yaml

```yaml
about:
title: # 标题
insert: none # 插入规则 before(插入在内容前) | after(插入在内容后) | none(不插入)
title: # 标题
introduction: # 个人简单描述
blog: # 博客信息
privacy: # 隐私权说明
blog: # 博客信息
privacy: # 隐私权说明
```

您也可以直接在 `source/about/index.md` 编写您的关于页面, 如果 `about/index.md` 有内容则优先使用自定义内容,否则使用配置项内容。

## 404 Not Found

可以直接在 `source` 目录下新建 `404.md`。
``` yaml

```yaml
---
layout: 404
---
```

在本地,您也可以直接访问 `/404.html` 查看效果。只有当您将其部署到 `GitHub Pages` 上,您访问不存在的页面才会显示。


## 自定义页面 Customize Page

新建自定义页面。像上面 友链、关于等页面也属于自定义页面,主要区别是它们可以通过约定配置,就可以输出主题内置页面样式,当然如果您想要个性化这些页面,也可以通过自定也页面覆盖主题的默认信行为。
Expand All @@ -185,27 +192,28 @@ hexo new page xxxxx

自定义页面只会保留顶部菜单、背景区域、左侧个人信息(如果不想要个人信息,可以将页面设置为单栏 `single_column: true`)。

``` yaml
```yaml
---
title: 自定义页面
single_column: true
---
```
在自定义页面时,可以直接复制主题中 HTML 代码使用,增加编写自定义页面效率,除了复用默认主题代码,还有其他内置卡片样式可以参考 [自定义页面演示](https://hexo-theme-async.imalun.com/demosite/customize_page/),以及主题内置的 [Tag Plugins](https://hexo-theme-async.imalun.com/demosite/2022/12/30/tag_plugins/)

在自定义页面时,可以直接复制主题中 HTML 代码使用,增加编写自定义页面效率,除了复用默认主题代码,还有其他内置卡片样式可以参考 [自定义页面演示](https://hexo-theme-async.imalun.com/demosite/customize_page/),以及主题内置的 [Tag Plugins](https://hexo-theme-async.imalun.com/demosite/2022/12/30/tag_plugins/)

### 相册页

相册页面只是普通的页面,您只需要 hexo new page xxxxx 创建您的页面就行

然后使用标签外挂 [gallery](https://hexo-theme-async.imalun.com/demosite/2022/12/30/tag_plugins/),具体用法请查看对应的内容。

``` markdown
```markdown
<div class="row">
{% gallery '壁纸' '收藏的一些壁纸' '/gallery/wallpaper' https://th.wallhaven.cc/lg/z8/z8dg9y.jpg %}
{% gallery '图库' '收藏的一些壁纸' '/gallery/wallpaper' https://th.wallhaven.cc/lg/rd/rddgwm.jpg %}
</div>
```

<VersionBlock version="1.2.12">
</VersionBlock>

Expand All @@ -215,7 +223,7 @@ single_column: true

然后使用标签外挂 [galleryGroup](https://hexo-theme-async.imalun.com/demosite/2022/12/30/tag_plugins/),具体用法请查看对应的内容。

``` markdown
```markdown
{% galleryGroup %}
{% galleryItem https://th.wallhaven.cc/orig/85/85oy2j.jpg https://w.wallhaven.cc/full/85/wallhaven-85oy2j.png %}
![](https://w.wallhaven.cc/full/jx/wallhaven-jx3z65.jpg)
Expand All @@ -234,4 +242,4 @@ single_column: true
{% galleryItem https://th.wallhaven.cc/orig/p9/p9kdej.jpg https://w.wallhaven.cc/full/p9/wallhaven-p9kdej.jpg %}
{% galleryItem https://th.wallhaven.cc/orig/x6/x68mrd.jpg https://w.wallhaven.cc/full/x6/wallhaven-x68mrd.jpg %}
{% endgalleryGroup %}
```
```
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"type": "module",
"devDependencies": {
"vitepress": "^1.0.0-alpha.74",
"vitepress": "^1.0.0-rc.20",
"less": "^4.1.3",
"unplugin-vue-components": "^0.22.4"
}
Expand Down
2 changes: 2 additions & 0 deletions packages/hexo-theme-async/layout/_partial/page/about.ejs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<% if(theme.about.insert === 'before'){ %>
<%- partial(theme.layout.about_card) %>
<%- page.content %>
<% } %>

<% if(theme.about.insert === 'none'){ %>
<%- page.content ? page.content : partial(theme.layout.about_card) %>
<% } %>

<% if(theme.about.insert === 'after'){ %>
<%- page.content %>
<%- partial(theme.layout.about_card) %>
<% } %>

Expand Down
Loading

0 comments on commit 862cd77

Please sign in to comment.