-
Notifications
You must be signed in to change notification settings - Fork 0
/
da-jian-ge-ren-bo-ke-hexo-zi-ding-yi-pei-zhi-zhu-ti-zi-ding-yi-pei-zhi-yu-ming-chun-gan-huo-wu-fei-hua.html
executable file
·207 lines (185 loc) · 10.3 KB
/
da-jian-ge-ren-bo-ke-hexo-zi-ding-yi-pei-zhi-zhu-ti-zi-ding-yi-pei-zhi-yu-ming-chun-gan-huo-wu-fei-hua.html
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
<!doctype html>
<html lang="">
<head>
<meta charset="utf-8"/>
<title>搭建个人博客(hexo) + 自定义配置主题 + 自定义配置域名(纯干货、无废话) - Restart</title>
<meta name="author" content="wxz" />
<meta name="copyright" content="wxz" />
<meta property="og:site_name" content="Restart" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:title" content="搭建个人博客(hexo) + 自定义配置主题 + 自定义配置域名(纯干货、无废话)" />
<meta name="date" content="2021-10-14 17:20:00+08:00" />
<meta property="og:type" content="article" />
<meta property="og:locale" content="en" />
<meta property="og:published_time" content="2021-10-14 17:20:00+08:00" />
<meta property="og:title" content="搭建个人博客(hexo) + 自定义配置主题 + 自定义配置域名(纯干货、无废话)" />
<meta property="og:url" content="./da-jian-ge-ren-bo-ke-hexo-zi-ding-yi-pei-zhi-zhu-ti-zi-ding-yi-pei-zhi-yu-ming-chun-gan-huo-wu-fei-hua.html" />
<meta property="og:description" content="搭建个人博客(hexo) + 自定义配置主题 + 自定义配置域名(纯干货、无废话) 无一句废话,个人总结,需一定基础 安装hexo npm install -g hexo-cli hexo --version …" />
<meta name="description" content="搭建个人博客(hexo) + 自定义配置主题 + 自定义配置域名(纯干货、无废话) 无一句废话,个人总结,需一定基础 安装hexo npm install -g hexo-cli hexo --version …" />
<meta name="HandheldFriendly" content="True" />
<meta name="MobileOptimized" content="320" />
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0" />
<link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
<link rel="icon" href="./favicon.ico" type="image/x-icon" />
<link href='https://fonts.googleapis.com/css?family=Droid+Sans:700,400|Droid+Sans+Mono' rel='stylesheet' type='text/css' />
<link rel="stylesheet" href="./theme/css/main.css" type="text/css" />
<!--[if lt IE 9]>
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<header class="clearfix" role="banner">
<div class="wrapper">
<h1 class="huge"><a href=".">Restart</a></h1>
</div>
</header>
<div role="main" class="content clearfix">
<article>
<div class="post wrapper">
<h1>搭建个人博客(hexo) + 自定义配置主题 + 自定义配置域名(纯干货、无废话)</h1>
<h2>搭建个人博客(hexo) + 自定义配置主题 + 自定义配置域名(纯干货、无废话)</h2>
<blockquote>
<blockquote>
<p>无一句废话,个人总结,需一定基础</p>
</blockquote>
</blockquote>
<ul>
<li>安装hexo</li>
</ul>
<div class="highlight"><pre><span></span><code>npm<span class="w"> </span>install<span class="w"> </span>-g<span class="w"> </span>hexo-cli
hexo<span class="w"> </span>--version
</code></pre></div>
<ul>
<li>创建项目</li>
</ul>
<div class="highlight"><pre><span></span><code>hexo<span class="w"> </span>init<span class="w"> </span>blog
<span class="nb">cd</span><span class="w"> </span>blog
npm<span class="w"> </span>install
hexo<span class="w"> </span>serve
</code></pre></div>
<ul>
<li>自定义hexo主题</li>
</ul>
<p><a href="https://theme-stun.github.io/docs/guide/quick-start.html">hexo中的stun主题文档</a></p>
<div class="highlight"><pre><span></span><code>git clone https://github.com/liuyib/hexo-theme-stun.git themes/stun
npm install --save hexo-renderer-pug
</code></pre></div>
<ul>
<li>加入git版本控制</li>
</ul>
<div class="highlight"><pre><span></span><code>git<span class="w"> </span>init
git<span class="w"> </span>add<span class="w"> </span>*
git<span class="w"> </span>commit<span class="w"> </span>-m<span class="w"> </span><span class="s2">"Init"</span>
</code></pre></div>
<ul>
<li>将git所在系统上的ssh公钥复制给github</li>
</ul>
<div class="highlight"><pre><span></span><code>vim /mnt/c/Users/windows用户/.ssh/id_rsa.pub
</code></pre></div>
<p>将上述文件内容复制到github网站以下截图打码地方</p>
<p><img alt="image-20230407113729805" src="https://cdn.jsdelivr.net/gh/MakerCosy/PicCDN/img/image-20230407113729805.png"></p>
<div class="highlight"><pre><span></span><code><span class="n">#测试通讯</span>
<span class="n">ssh</span><span class="w"> </span><span class="o">-</span><span class="n">T</span><span class="w"> </span><span class="n">git</span><span class="nv">@github</span><span class="p">.</span><span class="n">com</span>
</code></pre></div>
<p>若出现以下截图横线所标内容,则证明和GitHub网站成功建立ssh免密通讯协议</p>
<p><img alt="" src="image/2021-10-09-20-38-59.png"></p>
<ul>
<li>修改hexo配置</li>
</ul>
<div class="highlight"><pre><span></span><code><span class="n">vim</span><span class="w"> </span><span class="o">/</span><span class="n">mnt</span><span class="o">/</span><span class="n">d</span><span class="o">/</span><span class="n">hexo</span><span class="o">/</span><span class="n">blog</span><span class="o">/</span><span class="n">_config</span><span class="p">.</span><span class="n">yml</span>
<span class="nl">url</span><span class="p">:</span><span class="w"> </span><span class="nl">https</span><span class="p">:</span><span class="o">//</span><span class="n">wxzhang13</span><span class="p">.</span><span class="n">github</span><span class="p">.</span><span class="n">io</span><span class="o">/</span><span class="n">blog</span><span class="o">/</span><span class="w"> </span><span class="n">#github访问此博客地址</span><span class="err">,</span><span class="n">如果url不对</span><span class="err">,</span><span class="n">会乱码</span>
<span class="nl">theme</span><span class="p">:</span><span class="w"> </span><span class="n">stun</span><span class="w"> </span><span class="n">#选择hexo自定义主题stun</span>
<span class="nl">deploy</span><span class="p">:</span>
<span class="w"> </span><span class="nl">type</span><span class="p">:</span><span class="w"> </span><span class="n">git</span><span class="w"> </span><span class="n">#选择git传输方式</span>
<span class="w"> </span><span class="nl">repo</span><span class="p">:</span><span class="w"> </span><span class="n">git</span><span class="nv">@github</span><span class="p">.</span><span class="nl">com</span><span class="p">:</span><span class="n">wxzhang13</span><span class="o">/</span><span class="n">blog</span><span class="p">.</span><span class="n">git</span><span class="w"> </span><span class="n">#github上所建的仓库源</span>
<span class="w"> </span><span class="nl">branch</span><span class="p">:</span><span class="w"> </span><span class="n">master</span><span class="w"> </span><span class="n">#主分支</span>
</code></pre></div>
<h4>修改CNAME设置</h4>
<p>新建一个文件,添加内容为你的域名
vim blog/source/CNAME
www.wxzhang.cool</p>
<ul>
<li>运行</li>
</ul>
<div class="highlight"><pre><span></span><code>#本地试运行
hexo s -g
#github网站运行
hexo d -g
</code></pre></div>
<ul>
<li>自定义博客域名</li>
</ul>
<p>添加阿里云域名解析域名记录</p>
<p><img alt="" src="https://cdn.jsdelivr.net/gh/MakerCosy/PicCDN/img/202304071713653.png"></p>
<p>添加github Pages</p>
<p><img alt="image-20230407171714800" src="https://cdn.jsdelivr.net/gh/MakerCosy/PicCDN/img/image-20230407171714800.png"></p>
<ul>
<li>访问博客</li>
</ul>
<p>成功访问<a href="http://www.wxzhang.cool/">我的博客</a></p>
<p><img alt="image-20230417143546590" src="https://cdn.jsdelivr.net/gh/MakerCosy/PicCDN/img/image-20230417143546590.png"></p>
<h4>启用https认证</h4>
<p>github上面设置</p>
<p><img alt="image-20230417143512616" src="https://cdn.jsdelivr.net/gh/MakerCosy/PicCDN/img/image-20230417143512616.png"></p>
<h4>conding上部署(比较坑,现在想用pages必须买他的服务器)</h4>
<ul>
<li>
<p>部署公钥(和上述部署在github网站上方法一样,这里就不重复补充呢)</p>
</li>
<li>
<p>测试是否可以coding网站进行ssh通讯</p>
</li>
</ul>
<div class="highlight"><pre><span></span><code><span class="n">ssh</span><span class="w"> </span><span class="o">-</span><span class="n">T</span><span class="w"> </span><span class="n">git</span><span class="nv">@e</span><span class="p">.</span><span class="n">coding</span><span class="p">.</span><span class="n">net</span>
</code></pre></div>
<ul>
<li>hexo配置文件添加coding源</li>
</ul>
<div class="highlight"><pre><span></span><code>vim<span class="w"> </span>/mnt/d/hexo/blog/_config.yml
deploy:
-<span class="w"> </span>type:<span class="w"> </span>git
<span class="w"> </span>repo:<span class="w"> </span>git@github.com:wxzhang13/blog.git
<span class="w"> </span>branch:<span class="w"> </span>master
-<span class="w"> </span>type:<span class="w"> </span>git
<span class="w"> </span>repo:<span class="w"> </span>git@e.coding.net:MakerCosy/blog/blog.git
<span class="w"> </span>branch:<span class="w"> </span>master
</code></pre></div>
<blockquote>
<blockquote>
<p>报错截图</p>
</blockquote>
</blockquote>
<p>出现以下报错,输入以下命令即可</p>
<div class="highlight"><pre><span></span><code>npm install --save hexo-deployer-git
</code></pre></div>
<p><img alt="image-20230417143434623" src="https://cdn.jsdelivr.net/gh/MakerCosy/PicCDN/img/image-20230417143434623.png"></p>
<h4>部署到个人服务器</h4>
<p>https://www.cnblogs.com/jie-fang/p/13445939.html</p>
<a href="https://twitter.com/share" class="twitter-share-button" data-via="" data-lang="en" data-size="large" data-related="">Tweet</a>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
</div>
<div class="meta wrapper">
<time datetime="2021-10-14T17:20:00+08:00" pubdate>Thu 14 October 2021</time>
<ul class="tag clearfix">
<li><a href="./category/page.html">page</a></li>
</ul>
</div> </article>
</div>
<footer class="clearfix">
<div class="wrapper pages">
<ul class="nav">
<li><a href="./archives.html">Archive</a></li>
</ul>
</div>
<div class="copy wrapper">
<ul class="social">
<li><a href="https://dianyi.ng/">You can add links in your config file</a></li>
<li><a href="#">Another social link</a></li>
</ul>
<p role="contentinfo"> © 2017 wxz
<br>
Proudly powered by <a href="http://alexis.notmyidea.org/pelican/">Pelican</a>.</p>
</div>
</footer>
</body>
</html>