辰風依恛
文章35
标签0
分类11
生成博客到部署

生成博客到部署

生成博客到部署

大体思路:开通Gitee Pages,自己写一个静态网站或者使用Jekyll、Hugo、Hexo来生成

Gitee Pages

首先开通Gitee Pages:

需要注册登录到Gitee上,并且创建仓库,仓库名称最好和自己的个性地址一样,然后开源这个仓库,在服务中点击Gitee Pages,首次使用需要实名注册

生成ssh添加到Gitee仓库,详细的百度查一下,方便后续快速部署

更多访问https://gitee.com/help/articles/4136#article-header0

如果是想要自己手写的话就打包好上传到这个仓库即可

使用Hexo

hexo可以使用Markdown文档生成,相对于手写更加方便。

使用他上传首先需要安装Git、node,版本要求最后是看官网;一般来讲只要不是很老的都行。

安装Hexo

1
npm install -g hexo-cli

准备一个文件夹,在文件夹地址中输入cmd回车,打开命令提示符,在文件夹中创建网站,并安装依赖

1
2
hexo init
npm i

安装完成后输入

1
hexo s

可以在 localhost:4000查看生成的网站

在根目录中找到_config.yml来配置

详细查看官网:https://hexo.io/zh-cn/docs/configuration

下面列举几个,每一个:后面都有一个空格

1
2
3
4
5
6
7
8
9
10
11
title: 网站标题
author: 作者
language: 语言
timezone: 时间

url: Gitee Page、GitHub Pages等,github是:用户名.github.io,Gitee:用户名.gitee.io

deploy:
type: git
repo: 这里直接复制Gitee生成仓库时的地址,大致就是https://gitee.com/个性地址/仓库地址.git
branch: master

安装依赖

1
npm install hexo-deployer-git --save

然后进行部署

1
2
3
hexo clean
hexo generate
hexo deploy

hexo clean 清除了你之前生成的东西。

hexo generate 生成静态文章,可以用 hexo g 缩写

hexo deploy 部署文章,可以用hexo d缩写

更多命令查看官网:https://hexo.io/zh-cn/docs/commands

如果没有配置ssh一般需要输入用户名和密码

配置主题

hexo有很多主题,例如我使用的:Kira-Hexo

在你的 Hexo 项目根目录下运行

1
npm i hexo-theme-kira

_config.yml 中,将 theme 的值修改为 kira(使用其他的就是其他的主题名称)

为了让 Kira-Hexo 正常工作,你还需要在 Hexo 项目的根目录下新建一个名为 _config.kira.yml 的文件,并在文件中填入下方的配置信息。(最好访问官网去看,可能会更新)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
avatar: https://raw.githubusercontent.com/ch1ny/PictureCDN/master/others/116359b4ccf19917.jpg # 网站 Logo
background: # 既是博客的背景,又是文章默认头图
path: https://raw.githubusercontent.com/ch1ny/PictureCDN/master/others/f0d5cc34c6e5aa7.jpg
width: 1280
height: 720
favicon:
href: https://raw.githubusercontent.com/ch1ny/PictureCDN/master/others/116359b4ccf19917.jpg # 网站图标
type: image/png # 图标类型,可能的值有(image/png, image/vnd.microsoft.icon, image/x-icon, image/gif)

# 附加图标库 使用说明:https://hexo.kira.host/config/icon
iconlib: //at.alicdn.com/t/c/font_3299330_2a7ov96q7e3.css

cdn: # 这里可以修改站点使用的库的CDN
gitalk:
css: https://unpkg.com/gitalk@latest/dist/gitalk.css
js: https://unpkg.com/gitalk@latest/dist/gitalk.min.js

beian: 赣ICP备******号 # 备案号(选填,此乃中国特色,不得不尝)

menu:
回到首页:
- /
- icon-home
文章归档: # 使用说明:https://docs.kira.com/article/archive
- /archive.html
- icon-container
关于本人:
- /about.html
- icon-user
我的朋友:
- /friends.html # 使用说明:https://docs.kira.com/article/py
- icon-team

widgets:
- social
- category
- tagcloud

maxTagcloud: 0 # 标签云组件显示的标签数量,0 表示不限制

social:
QQ:
- tencent://AddContact/?fromId=45&fromSubId=1&subcmd=all&uin=1056317718&website=www.oicqzone.com
- icon-QQ
- rgb(49, 174, 255)
- rgba(49, 174, 255, .1)
哔哩哔哩:
- https://space.bilibili.com/27905679
- icon-bilibili
- rgb(231, 106, 141)
- rgba(231, 106, 141, .15)
GitHub:
- https://github.com/ch1ny/
- icon-github
- rgb(25, 23, 23)
- rgba(25, 23, 23, .15)
Gitee:
- https://gitee.com/ch1ny/
- icon-gitee
- rgb(165, 15, 15)
- rgba(165, 15, 15, .15)

color: # 配色方案,从first到seventh为优先级为1-7的颜色,默认为彩虹配色
first: # 同时作为主题色
r: 49
g: 174
b: 255
second:
r: 255
g: 78
b: 106
third:
r: 255
g: 185
b: 0
fourth:
r: 51
g: 213
b: 122
fifth:
r: 0
g: 219
b: 255
sixth:
r: 255
g: 69
b: 0
seventh:
r: 144
g: 144
b: 255

# 评论区
gitalk:
active: true # 是否启用 gitalk
admin: -your github username- # 拥有对该repo进行操作的 GitHub username
owner: -your github username- # 持有该 repo 的 GitHub username
repo: -issue repo name- # 存放评论的 issue 所在的 repo
clientID: -id- # GitHub Client ID
clientSecret: -key- # GitHub Client Secret
title: '' # Gitalk Issue Title

copyright: '<strong>版权声明:</strong>本文采用 <a href="https://creativecommons.org/licenses/by-nc-sa/3.0/cn/deed.zh" target="_blank">CC BY-NC-SA 3.0 CN</a> 协议进行许可'
copyTip: "著作权归作者所有。\n商业转载请联系作者获得授权,非商业转载请注明出处。\n来源:%url" # 自定义复制版权文案,使用 %url 代替当前页面URL, 修改为false禁用

# achive widget behavior
widgetAchive: #文章归档组件
archive_type: 'year' #按月展示还是按年展示
show_count: true #是否展示数量

widgetLink: #链接组件
- title: <title>
img: <img_path>
link: <url>
- title: <title>
img: <img_path>
link: <url>

# 自定义侧边栏尾部内容
sidebar: ''

最后在命名行输入

1
2
3
hexo clean
hexo g
hexo d

等待部署完成后去Gitee的仓库找到 Gitee Pages服务,点击更新。

更新博客

如果有新的博客内容要更新,找到根目录的source/_posts文件夹,在里面写Markdown文档的内容,然后再命令行输入

1
2
3
hexo clean
hexo g
hexo d

部署完成后去Gitee的仓库找到 Gitee Pages服务,点击更新。

当然在本地查看效果再去部署最好。

本文作者:辰風依恛
本文链接:https://766187397.github.io/2025/10/12/%E7%94%9F%E6%88%90%E5%8D%9A%E5%AE%A2%E5%88%B0%E9%83%A8%E7%BD%B2/
版权声明:本文采用 CC BY-NC-SA 3.0 CN 协议进行许可
×