2023-10-20 09:11:26 +08:00
|
|
|
---
|
2023-10-20 09:26:04 +08:00
|
|
|
title: Linear 入门
|
2023-10-20 11:19:36 +08:00
|
|
|
top: 2
|
2023-10-20 09:11:26 +08:00
|
|
|
categories:
|
|
|
|
- Hexo
|
|
|
|
status: doing
|
|
|
|
---
|
|
|
|
|
2023-10-20 13:35:01 +08:00
|
|
|
# Hexo 安装主题
|
|
|
|
|
|
|
|
`Hexo` 主题的安装方式非常简单,只需将主题 `Hexo-theme-linear` 复制目录的 `themes` 目录下,然后在 `Hexo` 的 `_config.yml` 中修改下主题配置即可
|
|
|
|
|
|
|
|
```yml
|
|
|
|
# 找到 theme 配置项
|
|
|
|
theme: Hexo-theme-linear
|
|
|
|
```
|
|
|
|
|
|
|
|
## 获取 Linear
|
|
|
|
|
|
|
|
- 进入 [Linear 代码仓库](https://github.com/17px/hexo-theme-linear/tree/main),了解最新的主题开发进度
|
|
|
|
- 在 [发布页面](https://github.com/17px/hexo-theme-linear/releases) 下载 `hexo-theme-linear.zip`
|
|
|
|
- 解压至站点的 `themes` 目录下
|
|
|
|
- 在 Hexo 的 `_config.yml` 中启用
|
|
|
|
|
2023-10-20 11:19:36 +08:00
|
|
|
# hexo配置
|
2023-10-20 09:11:26 +08:00
|
|
|
|
2023-10-20 13:35:01 +08:00
|
|
|
在 `Hexo` 的 `_config.yml` 中调整
|
2023-10-20 11:19:36 +08:00
|
|
|
|
|
|
|
## 基础配置
|
|
|
|
|
|
|
|
```yml
|
|
|
|
# 网页标题
|
|
|
|
title: 17px blog
|
|
|
|
# 侧边栏顶部显示
|
|
|
|
subtitle: "Mozzie"
|
|
|
|
# 用于SEO的html元描述
|
|
|
|
description: ""
|
|
|
|
# 用于SEO的html关键字
|
|
|
|
keywords:
|
|
|
|
# 文章版权声明显示作者名称
|
|
|
|
author: Mozzie
|
|
|
|
|
|
|
|
# 在此处设置您的网站url
|
|
|
|
url: https://mozzie.cn
|
|
|
|
```
|
|
|
|
|
2023-10-20 13:58:15 +08:00
|
|
|
## 语言
|
|
|
|
|
|
|
|
你可以在 `hexo-theme-linear/languages` 中找到不同的语言文件,如果想切换语言,在配置文件中,填入 `yml` 的文件名
|
2023-10-20 11:19:36 +08:00
|
|
|
|
|
|
|
```yml
|
|
|
|
language: en
|
|
|
|
```
|
|
|
|
|
|
|
|
## 文章语法高亮
|
|
|
|
|
2023-10-20 13:35:01 +08:00
|
|
|
关闭hexo默认的highlight.js语法高亮
|
|
|
|
|
2023-10-20 11:19:36 +08:00
|
|
|
```yml
|
|
|
|
highlight:
|
|
|
|
enable: false
|
|
|
|
line_number: true
|
|
|
|
auto_detect: false
|
|
|
|
tab_replace: ""
|
|
|
|
wrap: true
|
|
|
|
hljs: false
|
2023-10-20 13:35:01 +08:00
|
|
|
|
2023-10-20 11:19:36 +08:00
|
|
|
prismjs:
|
|
|
|
enable: true
|
|
|
|
preprocess: true
|
|
|
|
line_number: true
|
|
|
|
line_threshold: 0
|
|
|
|
tab_replace: ""
|
|
|
|
```
|
|
|
|
|
|
|
|
# Linear主题配置
|
|
|
|
|
2023-10-20 13:35:01 +08:00
|
|
|
下面的配置基于 `Hexo-theme-linear` 下的 `_config.yml`
|
2023-10-20 11:19:36 +08:00
|
|
|
|
|
|
|
## 文章分类图标
|
|
|
|
|
|
|
|
按照顺序,依次设置 `svg` 图标,可以在 [xicon](https://www.xicons.org/) 方面的获取丰富的图标
|
|
|
|
|
|
|
|
```yml
|
|
|
|
postCategoryIcons:
|
|
|
|
- <svg>...</svg>
|
|
|
|
- <svg>...</svg>
|
|
|
|
- <svg>...</svg>
|
|
|
|
```
|
|
|
|
|
|
|
|
## 网站图标 favicon
|
|
|
|
|
|
|
|
- 支持 `svg`
|
|
|
|
- 支持 `图片url`,如:`/img/favicon.png`
|
|
|
|
|
|
|
|
```yml
|
|
|
|
favicon: ''
|
|
|
|
```
|
|
|
|
|
|
|
|
## ICP备案号
|
|
|
|
|
|
|
|
😁 如不需要备案号,可直接删除
|
|
|
|
|
|
|
|
```yml
|
|
|
|
icp: 苏ICP备xxxxxxx号-x
|
|
|
|
```
|
|
|
|
|
|
|
|
## 首页底部文字
|
|
|
|
|
|
|
|
😁 如不需要,可直接删除,或者改为 `false`
|
|
|
|
|
|
|
|
```yml
|
|
|
|
motto: false
|
|
|
|
```
|
|
|
|
|
|
|
|
## 文章版权申明
|
|
|
|
|
|
|
|
默认开启,当 `enable: false`,默认关闭
|
|
|
|
|
|
|
|
```yml
|
|
|
|
postCopyright:
|
|
|
|
enable: true
|
|
|
|
license: CC BY-NC-SA 4.0
|
|
|
|
license_url: https://creativecommons.org/licenses/by-nc-sa/4.0/
|
|
|
|
```
|
|
|
|
|
|
|
|
## katex 数学公式
|
|
|
|
|
|
|
|
可自行配置 `cdn`
|
|
|
|
|
|
|
|
```yml
|
|
|
|
katex:
|
|
|
|
enable: true
|
|
|
|
jsCdn: //cdn.jsdelivr.net/npm/katex@0.13.18/dist/katex.min.js
|
|
|
|
cssCdn: //cdn.jsdelivr.net/npm/katex@0.13.18/dist/katex.min.css
|
|
|
|
```
|
|
|
|
|
|
|
|
## mermaid 流程图
|
|
|
|
|
|
|
|
在撰写时,请使用 `{% mermaid %}` 和 `{% endmermaid %}` 包裹
|
|
|
|
|
|
|
|
```markdown
|
|
|
|
{% mermaid %}
|
|
|
|
graph TD;
|
|
|
|
A --> B;
|
|
|
|
A --> C;
|
|
|
|
B --> D;
|
|
|
|
C --> D;
|
|
|
|
{% endmermaid %}
|
|
|
|
```
|
|
|
|
|
|
|
|
相应配置如下
|
|
|
|
|
|
|
|
```yml
|
|
|
|
mermaid:
|
|
|
|
enable: true
|
|
|
|
cdn: //cdn.jsdelivr.net/npm/mermaid@10.4.0/dist/mermaid.min.js
|
|
|
|
```
|
|
|
|
|
|
|
|
## valine 文章评论
|
|
|
|
|
|
|
|
首先需要注册 `LeanCloud` 国际区用户,创建数据库
|
|
|
|
|
|
|
|
请根据相关地区法规,酌情
|
|
|
|
|
|
|
|
```yml
|
|
|
|
valine:
|
|
|
|
enable: true
|
|
|
|
# 替换
|
|
|
|
appId: appId
|
|
|
|
# 替换
|
|
|
|
appKey: appKey
|
|
|
|
avatar: monsterid
|
|
|
|
cdn: //unpkg.com/valine@latest/dist/Valine.min.js
|
|
|
|
# 替换
|
|
|
|
serverURLs: //xxxxxxxx.api.lncldglobal.com
|
2023-10-20 13:35:01 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
# algolia搜索
|
|
|
|
|
|
|
|
博客自带的本地搜索,基于前端开发,存在或多或少的问题,建议换成 `algolia`,免费账户 总共有 `10,000` 条记录,每月有 `100,000` 的操作数
|
|
|
|
|
|
|
|
## 注册 & 获取 Key
|
|
|
|
|
|
|
|
1. 创建一个新的 `Index`,例如 `hex-blog`
|
|
|
|
|
|
|
|
2. 复制并保存:
|
|
|
|
- Application ID
|
|
|
|
- Search-Only API Key
|
|
|
|
- Admin API Key
|
|
|
|
- Usage API Key
|
|
|
|
|
|
|
|
[API Keys](/img/algolia-api-keys.png)
|
|
|
|
|
|
|
|
3. 替换配置
|
|
|
|
|
|
|
|
在 `Hexo` 的 `_config.yml` 中加入
|
|
|
|
|
|
|
|
```yml
|
|
|
|
algolia:
|
|
|
|
# 替换
|
|
|
|
appId: Application ID
|
|
|
|
# 替换
|
|
|
|
apiKey: Usage API Key
|
|
|
|
# 请勿泄露,用于上报,替换
|
|
|
|
adminApiKey: Admin API Key
|
|
|
|
# 替换
|
|
|
|
SearchOnlyAPIKey: Search-Only API Key
|
|
|
|
chunkSize: 5000
|
|
|
|
# 替换
|
|
|
|
indexName: hex-blog
|
|
|
|
fields:
|
|
|
|
- content:strip
|
|
|
|
- categories
|
|
|
|
- date
|
|
|
|
- permalink
|
|
|
|
- slug
|
|
|
|
- tags
|
|
|
|
- title
|
|
|
|
```
|
|
|
|
|
|
|
|
## 安装 hexo-algoliasearch
|
|
|
|
|
|
|
|
这是 Hexo 博客帖子索引插件,自动化提交索引到 Algolia
|
|
|
|
|
|
|
|
> 如出遇到问题,可阅读 [hexo-algoliasearch 仓库](https://www.npmjs.com/package/hexo-algoliasearch) 最新说明
|
|
|
|
|
|
|
|
安装命令:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
npm install hexo-algoliasearch --save
|
|
|
|
```
|
|
|
|
|
|
|
|
## 使用 algolia
|
|
|
|
|
|
|
|
在每次博客发布之前,进行索引上传的操作,命令通常如下
|
|
|
|
|
|
|
|
```bash
|
|
|
|
hexo clean
|
|
|
|
hexo generate
|
|
|
|
hexo algolia
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
# 🇨🇳 和风天气 Widget
|
|
|
|
|
|
|
|
Linear 主要针对国内用户,在首页集成了和风天气的卡片,通过 [和风天气开发服务](https://dev.qweather.com/docs/start/) 注册
|
|
|
|
|
|
|
|
注册完成后,在配置中填入你的 `appKey` 和 `cityCode(城市代码)`
|
|
|
|
|
|
|
|
```yml
|
|
|
|
weather:
|
|
|
|
enable: true
|
|
|
|
# 替换
|
|
|
|
cityCode: cityCode
|
|
|
|
appKey: appKey
|
|
|
|
```
|
|
|
|
|
|
|
|
其中 `cityCode` 可以在 [官方的地区列表仓库](https://github.com/qwd/LocationList) 中的 `China-City-List-latest.csv` 找到你所在城市的 `cityCode`
|