-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.xml
690 lines (622 loc) · 165 KB
/
search.xml
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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
<?xml version="1.0" encoding="utf-8"?>
<search>
<entry>
<title><![CDATA[Hello World]]></title>
<url>/blog/2017/07/27/hello-world/</url>
<content type="html"><![CDATA[<link rel="stylesheet" type="text/css" href="/assets/css/DPlayer.min.css"><script src="/assets/js/DPlayer.min.js"> </script><script src="/assets/js/APlayer.min.js"> </script><p>Welcome to <a href="https://hexo.io/" target="_blank" rel="external">Hexo</a>! This is your very first post. Check <a href="https://hexo.io/docs/" target="_blank" rel="external">documentation</a> for more info. If you get any problems when using Hexo, you can find the answer in <a href="https://hexo.io/docs/troubleshooting.html" target="_blank" rel="external">troubleshooting</a> or you can ask me on <a href="https://github.com/hexojs/hexo/issues" target="_blank" rel="external">GitHub</a>.</p>
<h2 id="Quick-Start"><a href="#Quick-Start" class="headerlink" title="Quick Start"></a>Quick Start</h2><h3 id="Create-a-new-post"><a href="#Create-a-new-post" class="headerlink" title="Create a new post"></a>Create a new post</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ hexo new <span class="string">"My New Post"</span></div></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/writing.html" target="_blank" rel="external">Writing</a></p>
<h3 id="Run-server"><a href="#Run-server" class="headerlink" title="Run server"></a>Run server</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ hexo server</div></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/server.html" target="_blank" rel="external">Server</a></p>
<h3 id="Generate-static-files"><a href="#Generate-static-files" class="headerlink" title="Generate static files"></a>Generate static files</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ hexo generate</div></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/generating.html" target="_blank" rel="external">Generating</a></p>
<h3 id="Deploy-to-remote-sites"><a href="#Deploy-to-remote-sites" class="headerlink" title="Deploy to remote sites"></a>Deploy to remote sites</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ hexo deploy</div></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/deployment.html" target="_blank" rel="external">Deployment</a></p>]]></content>
</entry>
<entry>
<title><![CDATA[Github+Hexo 博客 自定义页面做首页]]></title>
<url>/blog/2017/07/24/Github-Hexo-%E5%8D%9A%E5%AE%A2-%E8%87%AA%E5%AE%9A%E4%B9%89%E9%A1%B5%E9%9D%A2%E5%81%9A%E9%A6%96%E9%A1%B5/</url>
<content type="html"><![CDATA[<link rel="stylesheet" type="text/css" href="/assets/css/DPlayer.min.css"><script src="/assets/js/DPlayer.min.js"> </script><script src="/assets/js/APlayer.min.js"> </script><p>我看好多人都直接用作 <code><username>.github.io</code> 博客地址,我把这个地址预留了下来留给以后加个首页什么的,然后把博客放在<code>/blog/</code>目录下,根目录下放个 <code>html</code> ,然后在<code>html</code>文件里把浏览器重新定向到<code>/blog/</code>下就行了。</p>
<a id="more"></a>
<h1 id="Github上先建立两个仓库"><a href="#Github上先建立两个仓库" class="headerlink" title="Github上先建立两个仓库"></a>Github上先建立两个仓库</h1><h2 id="仓库一:Lunaleeguo-github-io-用于存放自定义首页"><a href="#仓库一:Lunaleeguo-github-io-用于存放自定义首页" class="headerlink" title="仓库一:Lunaleeguo.github.io 用于存放自定义首页"></a>仓库一:<a href="https://github.com/Lunaleeguo/Lunaleeguo.github.io" target="_blank" rel="external">Lunaleeguo.github.io</a> 用于存放自定义首页</h2><p>自定义首页的仓库名字必须是这个</p>
<h2 id="仓库二:blog-用于存放博客本体"><a href="#仓库二:blog-用于存放博客本体" class="headerlink" title="仓库二:blog 用于存放博客本体"></a>仓库二:<a href="https://github.com/Lunaleeguo/blog" target="_blank" rel="external">blog</a> 用于存放博客本体</h2><p>用于存放博客本地的仓库名字随意,这里我取名为 <code>blog</code></p>
<h1 id="本地建立一个-My-Blog-文件夹用于存放源代码"><a href="#本地建立一个-My-Blog-文件夹用于存放源代码" class="headerlink" title="本地建立一个 My Blog 文件夹用于存放源代码"></a>本地建立一个 My Blog 文件夹用于存放源代码</h1><p>这里最好把<code>My bolg</code>文件夹放到可以多机同步的同步文件夹内,便于多机同时撰写博客</p>
<h2 id="Step-1-:在My-Blog-目录下,新建一个名为Lunaleeguo-github-io的文件夹"><a href="#Step-1-:在My-Blog-目录下,新建一个名为Lunaleeguo-github-io的文件夹" class="headerlink" title="Step 1 :在My Blog 目录下,新建一个名为Lunaleeguo.github.io的文件夹"></a>Step 1 :在My Blog 目录下,新建一个名为Lunaleeguo.github.io的文件夹</h2><p>在<code>My Blog</code> 目录下,新建一个名为<code>Lunaleeguo.github.io</code>的文件夹用于存放自己自定义首页的<code>css</code>和<code>html</code>文件</p>
<h2 id="Step-2-:在My-Blog-目录下,利用hexo命令init一个blog文件夹"><a href="#Step-2-:在My-Blog-目录下,利用hexo命令init一个blog文件夹" class="headerlink" title="Step 2 :在My Blog 目录下,利用hexo命令init一个blog文件夹"></a>Step 2 :在My Blog 目录下,利用hexo命令init一个blog文件夹</h2><p>在<code>My Blog</code>目录下,利用<code>hexo</code>命令<code>init</code>一个<code>blog</code>文件夹,用于存放博客本体,以后的操作基本都是在<code>blog</code>目录下进行操作</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">hexo init blog</div></pre></td></tr></table></figure>]]></content>
<categories>
<category> 博客建站 </category>
</categories>
<tags>
<tag> Next </tag>
<tag> Hexo </tag>
</tags>
</entry>
<entry>
<title><![CDATA[博客写作小技巧]]></title>
<url>/blog/2017/07/23/%E5%8D%9A%E5%AE%A2%E5%86%99%E4%BD%9C%E5%B0%8F%E6%8A%80%E5%B7%A7/</url>
<content type="html"><![CDATA[<link rel="stylesheet" type="text/css" href="/assets/css/DPlayer.min.css"><script src="/assets/js/DPlayer.min.js"> </script><script src="/assets/js/APlayer.min.js"> </script><p>日常搜集的一些方便博客写作的小技巧</p>
<a id="more"></a>
<div id="aplayer0" class="aplayer" style="margin-bottom: 20px"></div>
<script>
new APlayer({
element: document.getElementById("aplayer0"),
narrow: false,
autoplay: false,
showlrc: 0,
music: {
title: "童话镇",
author: "陈一发儿",
url: "https://gossl.daoapp.io/p2.music.126.net/oiyHl_q-7m4Z0dFqhLmg_Q==/3319425604329008.mp3",
pic: "https://gossl.daoapp.io/p4.music.126.net/i2YqeMpR2DPuj15M-B1skA==/5816416510959096.jpg",
}
});
</script>
<div id="aplayer1" class="aplayer" style="margin-bottom: 20px"></div>
<script>
new APlayer({
element: document.getElementById("aplayer1"),
narrow: false,
autoplay: true,
showlrc: 0,
music: {
title: "Caffeine",
author: "Jeff Williams",
url: "http://7xq131.com1.z0.glb.clouddn.com/Preparation.mp3",
pic: "",
}
});
</script>
<div id="aplayer2" class="aplayer" style="margin-bottom: 20px"></div>
<script>
new APlayer({
element: document.getElementById("aplayer2"),
narrow: false,
autoplay: false,
showlrc: 0,
music: {
title: "她的睫毛",
author: "周杰伦",
url: "http://home.ustc.edu.cn/~mmmwhy/%d6%dc%bd%dc%c2%d7%20-%20%cb%fd%b5%c4%bd%de%c3%ab.mp3",
pic: "http://home.ustc.edu.cn/~mmmwhy/jay.jpg",
}
});
</script>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">{% aplayer "童话镇" "陈一发儿" "https://gossl.daoapp.io/p2.music.126.net/oiyHl_q-7m4Z0dFqhLmg_Q==/3319425604329008.mp3" "https://gossl.daoapp.io/p4.music.126.net/i2YqeMpR2DPuj15M-B1skA==/5816416510959096.jpg" "" %}</div></pre></td></tr></table></figure>
<h1 id="插入图片以及-PDF-文档"><a href="#插入图片以及-PDF-文档" class="headerlink" title="插入图片以及 PDF 文档"></a>插入图片以及 PDF 文档</h1><h2 id="法一:利用-Markdown-语法"><a href="#法一:利用-Markdown-语法" class="headerlink" title="法一:利用 Markdown 语法"></a>法一:利用 Markdown 语法</h2><p>当 blog 项目中只用到少量图片时,可以将图片统一放在<code>source/images</code>文件夹中,通过 markdown 语法访问它们。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">![](/images/image.jpg)</div></pre></td></tr></table></figure>
<h2 id="法二:利用插件"><a href="#法二:利用插件" class="headerlink" title="法二:利用插件"></a>法二:利用插件</h2><h3 id="Step-1-安装"><a href="#Step-1-安装" class="headerlink" title="Step 1 : 安装"></a>Step 1 : 安装</h3><p>在<code>bolg</code>目录下,利用插件,安装 <a href="https://github.com/timnew/hexo-tag-asset-res" target="_blank" rel="external">hexo-tag-asset-res</a> 插件:(<strong>图片既可以在首页内容中访问到,也可以在文章正文中访问到</strong>)</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm install hexo-tag-asset-res --save</div></pre></td></tr></table></figure>
<h3 id="Step-2-用法"><a href="#Step-2-用法" class="headerlink" title="Step 2 : 用法"></a>Step 2 : 用法</h3><ul>
<li><p>假设你有以下文件夹结构:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">source\</div><div class="line"> _posts\</div><div class="line"> 2014-08-15-a-simple-self-introduction.md</div><div class="line"> 2014-08-15-a-simple-self-introduction\</div><div class="line"> my_portrait.jpg</div><div class="line"> my_resume.pdf</div></pre></td></tr></table></figure>
<ul>
<li><p>还是可以直接利用 Markdown 语法:<strong>(图片只能在文章中显示,但无法在首页中正常显示)</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">![](image.jpg)</div></pre></td></tr></table></figure>
</li>
<li><p>在 markdown 文件中<code>2014-08-15-a-simple-self-introduction.md</code>,使用标签插件语法您可以将文件引用为:(<strong>图片在文章和首页中同时显示</strong>)</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">{% asset_img my_portrait.jpg %}</div><div class="line">{% asset_link my_resume.pdf My Resume %}</div></pre></td></tr></table></figure>
</li>
</ul>
</li>
</ul>
<h2 id="法三:利用js"><a href="#法三:利用js" class="headerlink" title="法三:利用js"></a>法三:利用js</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line"><img src= image_path alt="Lytro相机" width="100%"></div><div class="line"><center>Lytro</center></div></pre></td></tr></table></figure>
<p>注意以上的<code>image_path</code>既可以是图床中的路径,亦可以把图片放在<code>source/images/</code>文件下,然后<code>image_path=/images/logo.png</code></p>
<div id="aplayer3" class="aplayer" style="margin-bottom: 20px"></div>
<script>
new APlayer({
element: document.getElementById("aplayer3"),
narrow: false,
autoplay: false,
showlrc: 0,
music: {
title: "HUSH",
author: "Lasse Lindh",
url: "http://opj0cbfmf.bkt.clouddn.com/Part.3%20Lasse%20Lindh%20-%20Hush.mp3",
pic: "http://opj0cbfmf.bkt.clouddn.com/hush.jpg",
}
});
</script>]]></content>
<categories>
<category> 博客建站 </category>
</categories>
<tags>
<tag> Markdown </tag>
</tags>
</entry>
<entry>
<title><![CDATA[Hexo+NexT 主题配置笔记]]></title>
<url>/blog/2017/07/23/Hexo-NexT%E4%B8%BB%E9%A2%98%E9%85%8D%E7%BD%AE%E7%AC%94%E8%AE%B0/</url>
<content type="html"><![CDATA[<link rel="stylesheet" type="text/css" href="/assets/css/DPlayer.min.css"><script src="/assets/js/DPlayer.min.js"> </script><script src="/assets/js/APlayer.min.js"> </script><p> Hexo + NexT 主题配置,自己学习记录的一个过程,大家参考一下就好,可能不是很详细,还请大家见谅</p>
<a id="more"></a>
<h1 id="准备工作"><a href="#准备工作" class="headerlink" title="准备工作"></a>准备工作</h1><p>定位到bolg目录下,预先安装的插件:</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div></pre></td><td class="code"><pre><div class="line">npm install --save hexo-algolia</div><div class="line">npm install hexo-wordcount --save</div><div class="line">npm install hexo-generator-sitemap -save</div><div class="line">npm install hexo-generator-feed -save</div><div class="line">npm install hexo-generator-search --save</div><div class="line">npm install hexo-generator-index --save #索引生成器</div><div class="line">npm install hexo-generator-archive --save #归档生成器</div><div class="line">npm install hexo-generator-category --save #分类生成器</div><div class="line">npm install hexo-generator-tag --save #标签生成器</div><div class="line">npm install hexo-server --save #本地服务</div><div class="line">npm install hexo-deployer-git --save #hexo通过git发布(必装)</div><div class="line">npm install [email protected] #渲染器</div><div class="line">npm install [email protected] --save #渲染器</div></pre></td></tr></table></figure>
<hr>
<h1 id="Hexo-配置相关"><a href="#Hexo-配置相关" class="headerlink" title="Hexo 配置相关"></a>Hexo 配置相关</h1><h2 id="本地更新调试"><a href="#本地更新调试" class="headerlink" title="本地更新调试"></a>本地更新调试</h2><p>定位到blog文件夹下,输入:</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">hexo clean</div><div class="line">rm ./db.json</div><div class="line">hexo server --debug</div></pre></td></tr></table></figure>
<h2 id="在线发布上传"><a href="#在线发布上传" class="headerlink" title="在线发布上传"></a>在线发布上传</h2><h3 id="blog-发布"><a href="#blog-发布" class="headerlink" title="blog 发布"></a>blog 发布</h3><p>定位到blog文件夹下,输入:</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">hexo clean</div><div class="line">hexo g</div><div class="line">hexo d</div></pre></td></tr></table></figure>
<h3 id="Home-page-主页发布"><a href="#Home-page-主页发布" class="headerlink" title="Home page 主页发布"></a>Home page 主页发布</h3><p>定位到Lunaleeguo.github.io文件夹下</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">git add --all</div><div class="line">git commit -m <span class="string">"Initial commit."</span></div><div class="line">git remote add origin https:<span class="comment">//github.com/Lunaleeguo/Lunaleeguo.github.io.git</span></div><div class="line">git push</div></pre></td></tr></table></figure>
<h2 id="Tips-若后面重新更换主题"><a href="#Tips-若后面重新更换主题" class="headerlink" title="Tips: 若后面重新更换主题"></a>Tips: 若后面重新更换主题</h2><p>在主题目录下,如next目录下:</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">hexo clean</div><div class="line">git pull</div><div class="line">hexo g</div></pre></td></tr></table></figure>
<p>再到blog目录下:</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">hexo g</div></pre></td></tr></table></figure>
<hr>
<h1 id="Hexo-文件目录详解"><a href="#Hexo-文件目录详解" class="headerlink" title="Hexo 文件目录详解"></a>Hexo 文件目录详解</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div></pre></td><td class="code"><pre><div class="line">.</div><div class="line">├── .deploy #执行 hexo deploy 命令部署到 GitHub 上的内容目录</div><div class="line">├── public #执行 hexo generate 命令,输出的静态网页内容目录</div><div class="line">├── scaffolds #layout 模板文件目录,其中的 md 文件可以添加编辑</div><div class="line">├── scripts #扩展脚本目录,这里可以自定义一些 javascript 脚本</div><div class="line">├── source #文章源码目录,该目录下的 markdown 和 html 文件均会被 hexo 处理。该页面对应 repo 的根目录,404 文件、favicon.ico 文件,CNAME 文件等都应该放这里,该目录下可新建页面目录。</div><div class="line">| ├── _drafts #草稿文章</div><div class="line">| └── _posts #发布文章</div><div class="line">├── themes #主题文件目录</div><div class="line">├── _config.yml #全局配置文件,大多数的设置都在这里 </div><div class="line">└── package.json #应用程序数据,指明 hexo 的版本等信息,类似于一般软件中的关于按钮</div></pre></td></tr></table></figure>
<h1 id="Hexo-个性化设置"><a href="#Hexo-个性化设置" class="headerlink" title="Hexo 个性化设置"></a>Hexo 个性化设置</h1><h2 id="规范化设置"><a href="#规范化设置" class="headerlink" title="规范化设置"></a>规范化设置</h2><ul>
<li><p>前往到 <code>blog/scaffolds</code> 文件夹下,将 <code>post.md</code> 和 <code>draft.md</code> 的模板均改为如下代码:</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div></pre></td><td class="code"><pre><div class="line">---</div><div class="line">title: {{ title }}</div><div class="line">date: {{ date }}</div><div class="line">tags: []</div><div class="line">categories:</div><div class="line">comments: <span class="literal">true</span></div><div class="line">---</div><div class="line"> </div><div class="line"><!--more--></div></pre></td></tr></table></figure>
</li>
<li><p>前往到 <code>blog/scaffolds</code> 文件夹下,将 <code>page.md</code> 的模板均改为如下代码:</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line">---</div><div class="line">title: {{ title }}</div><div class="line">date: {{ date }}</div><div class="line">tags: []</div><div class="line">categories:</div><div class="line">comments: <span class="literal">true</span></div><div class="line">---</div></pre></td></tr></table></figure>
</li>
<li><p>新建关于页、标签页和分类页和自定义分页,定位到blog文件夹下</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">hexo <span class="keyword">new</span> page <span class="string">"about"</span></div><div class="line">hexo <span class="keyword">new</span> page <span class="string">"tags"</span></div><div class="line">hexo <span class="keyword">new</span> page <span class="string">"categories"</span></div><div class="line">hexo <span class="keyword">new</span> page <span class="string">"categories"</span></div><div class="line">hexo <span class="keyword">new</span> page <span class="string">"photo"</span></div></pre></td></tr></table></figure>
</li>
</ul>
<h2 id="config-yml-个性化设置"><a href="#config-yml-个性化设置" class="headerlink" title="_config.yml 个性化设置"></a>_config.yml 个性化设置</h2><ul>
<li><p><code>Ctrl+F</code> , 搜索 <code>language</code></p>
<figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">language: zh-Hans #设置博客语言为中文</div></pre></td></tr></table></figure>
</li>
<li><p><code>Ctrl+F</code>, 搜索 <code>post_asset_folder</code> </p>
<figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">post_asset_folder: true #新建一个页面后自动生成一个同名文件夹(默认为false)</div></pre></td></tr></table></figure>
</li>
<li><p><code>Ctrl+F</code>, 搜索 <code>deploy</code> </p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">deploy: </div><div class="line"> type: git</div><div class="line"> repository: https:<span class="comment">//github.com/Lunaleeguo/blog.git</span></div><div class="line"> branch: master</div></pre></td></tr></table></figure>
</li>
<li><p><code>_config.yml</code> 文件末尾加上代码:</p>
<ul>
<li><p>local search 设置</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line">local_search:</div><div class="line"> enable: <span class="literal">true</span></div><div class="line">search:</div><div class="line"> path: search.xml</div><div class="line"> field: post</div><div class="line"> format: html</div><div class="line"> limit: <span class="number">1000</span></div></pre></td></tr></table></figure>
</li>
<li><p>RSS设置</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div></pre></td><td class="code"><pre><div class="line"># SiteMap configuration</div><div class="line"># https://github.com/hexojs/hexo-generator-sitemap</div><div class="line">sitemap:</div><div class="line"> # 想配置 sitemap.xml 的模板,请移步到 ./node_modules/hexo-generator-sitemap/sitemap.xml</div><div class="line"> path: sitemap.xml</div><div class="line"># RSS configuration</div><div class="line"># https://github.com/hexojs/hexo-generator-feed</div><div class="line">feed:</div><div class="line"> type: rss2</div><div class="line"> path: rss2.xml</div><div class="line"> # RSS里最多包含几篇文章</div><div class="line"> limit: 6</div><div class="line"> hub:</div><div class="line"> # 是否把文章全部内容也包含进去</div><div class="line"> content: false</div></pre></td></tr></table></figure>
</li>
</ul>
</li>
</ul>
<hr>
<h1 id="Next-文件目录详解"><a href="#Next-文件目录详解" class="headerlink" title="Next 文件目录详解"></a>Next 文件目录详解</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div></pre></td><td class="code"><pre><div class="line">├── .github #git信息</div><div class="line">├── languages #多语言</div><div class="line">| ├── default.yml #默认语言</div><div class="line">| └── zh-Hans.yml #简体中文</div><div class="line">| └── zh-tw.yml #繁体中文</div><div class="line">├── layout #布局,根目录下的*.ejs文件是对主页,分页,存档等的控制</div><div class="line">| ├── _custom #可以自己修改的模板,覆盖原有模板</div><div class="line">| | ├── _header.swig #头部样式</div><div class="line">| | ├── _sidebar.swig #侧边栏样式</div><div class="line">| ├── _macro #可以自己修改的模板,覆盖原有模板</div><div class="line">| | ├── post.swig #文章模板</div><div class="line">| | ├── reward.swig #打赏模板</div><div class="line">| | ├── sidebar.swig #侧边栏模板</div><div class="line">| ├── _partial #局部的布局</div><div class="line">| | ├── head #头部模板</div><div class="line">| | ├── search #搜索模板</div><div class="line">| | ├── share #分享模板</div><div class="line">| ├── _script #局部的布局</div><div class="line">| ├── _third-party #第三方模板</div><div class="line">| ├── _layout.swig #主页面模板</div><div class="line">| ├── index.swig #主页面模板</div><div class="line">| ├── page #页面模板</div><div class="line">| └── tag.swig #tag模板</div><div class="line">├── scripts #script源码</div><div class="line">| ├── tags #tags的script源码</div><div class="line">| ├── marge.js #页面模板</div><div class="line">├── source #源码</div><div class="line">| ├── css #css源码</div><div class="line">| | ├── _common #*.styl基础css</div><div class="line">| | ├── _custom #*.styl局部css</div><div class="line">| | └── _mixins #mixins的css</div><div class="line">| ├── fonts #字体</div><div class="line">| ├── images #图片</div><div class="line">| ├── uploads #添加的文件</div><div class="line">| └── js #javascript源代码</div><div class="line">├── _config.yml #主题配置文件</div><div class="line">└── README.md #用GitHub的都知道</div></pre></td></tr></table></figure>
<h1 id="Next-个性化设置"><a href="#Next-个性化设置" class="headerlink" title="Next 个性化设置"></a>Next 个性化设置</h1><h2 id="config-yml的操作"><a href="#config-yml的操作" class="headerlink" title="_config.yml的操作"></a>_config.yml的操作</h2><h3 id="页面名称,图标相关操作"><a href="#页面名称,图标相关操作" class="headerlink" title="页面名称,图标相关操作"></a>页面名称,图标相关操作</h3><ul>
<li><p><code>Ctrl+F</code>, 搜索 <code>menu</code> </p>
<figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div></pre></td><td class="code"><pre><div class="line">menu:</div><div class="line"> links: https://Lunaleeguo.github.io</div><div class="line"> home: /</div><div class="line"> categories: /categories/</div><div class="line"> tags: /tags</div><div class="line"> about: /about</div><div class="line"> archives: /archives/</div><div class="line"> photo: /photo</div><div class="line"> #life: /categories/life</div><div class="line"> technology: /categories/technology</div><div class="line"> #search: /search </div><div class="line"> #sitemap: /sitemap.xml</div><div class="line"> #commonweal: /404.html</div></pre></td></tr></table></figure>
</li>
<li><p><code>Ctrl+F</code>, 搜索 <code>menu_icons</code> </p>
<figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div></pre></td><td class="code"><pre><div class="line">menu_icons:</div><div class="line"> enable: true</div><div class="line"> #KeyMapsToMenuItemKey: NameOfTheIconFromFontAwesome</div><div class="line"> home: home</div><div class="line"> about: user</div><div class="line"> links: link</div><div class="line"> categories: th</div><div class="line"> schedule: calendar</div><div class="line"> tags: tags</div><div class="line"> photo: image</div><div class="line"> archives: archive</div><div class="line"> sitemap: sitemap</div><div class="line"> commonweal: heartbeat</div><div class="line"> life: coffee</div><div class="line"> technology: cog</div><div class="line"> home page: home</div><div class="line"> search: search</div></pre></td></tr></table></figure>
</li>
<li><p>修改对应的 <code>zh-Hans.yml</code> 文件</p>
</li>
</ul>
<h3 id="侧边栏相关操作"><a href="#侧边栏相关操作" class="headerlink" title="侧边栏相关操作"></a>侧边栏相关操作</h3><ul>
<li>设置侧边栏头像<ul>
<li>next/source 文件夹下建立一个 uploads 文件夹用来上传图片,并建立一个 avatar.png 名字的头像</li>
<li>在 _config.yml 文件中, <code>Ctrl+F</code>, 搜索<code>Sidebar Avatar</code> ,设置<code>avatar: /uploads/avatar.png</code></li>
</ul>
</li>
</ul>
<ul>
<li><p><code>Ctrl+F</code>, 搜索<code>Social Links</code></p>
<figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div></pre></td><td class="code"><pre><div class="line">social:</div><div class="line"> #LinkLabel: Link</div><div class="line"> GitHub: https://github.com/Lunaleeguo</div><div class="line"> #Pcbeta: http://i.pcbeta.com/space-uid-4333710.html</div><div class="line"> Weibo: http://weibo.com/Lunaleeguo</div><div class="line"> QQ: http://wpa.qq.com/msgrd?v=3&uin=932168150&site=qq&menu=yes</div><div class="line"> Facebook: https://www.facebook.com/Lunaleeguo</div><div class="line"> Twitter: https://twitter.com/Lunaleeguo</div></pre></td></tr></table></figure>
</li>
<li><p><code>Ctrl+F</code>, 搜索 <code>social_icons</code> </p>
<figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div></pre></td><td class="code"><pre><div class="line">social_icons:</div><div class="line"> enable: true</div><div class="line"> # Icon Mappings.</div><div class="line"> # KeyMapsToSocialItemKey: NameOfTheIconFromFontAwesome</div><div class="line"> GitHub: github</div><div class="line"> #Pcbeta: cloud</div><div class="line"> Weibo: weibo</div><div class="line"> QQ: qq</div><div class="line"> Facebook: facebook</div><div class="line"> Twitter: twitter</div></pre></td></tr></table></figure>
</li>
<li><p><code>Ctrl+F</code>, 搜索 <code>links:</code> </p>
<figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div></pre></td><td class="code"><pre><div class="line">links:</div><div class="line"> Hexo 设置: http://theme-next.iissnan.com/faqs.html</div><div class="line"> Next 设置: http://theme-next.iissnan.com/</div><div class="line"> 主题优化: http://blog.ynxiu.com/2016/hexo-next-theme-optimize.html</div><div class="line"> 泼辣修图: http://www.polaxiong.com/editor</div><div class="line"> Home Page: https://Lunaleeguo.github.io</div><div class="line"> OneV's Den: https://onevcat.com/</div><div class="line"> Fontawesome: http://fontawesome.io/icons/</div><div class="line"> Interactive: http://strml.net/</div><div class="line"> Markdown: https://jbt.github.io/markdown-editor/</div></pre></td></tr></table></figure>
</li>
</ul>
<h3 id="显示文章更新时间"><a href="#显示文章更新时间" class="headerlink" title="显示文章更新时间"></a>显示文章更新时间</h3><p><code>Ctrl+F</code>, 搜索 <code>post_meta</code> </p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">post_meta:</div><div class="line"> item_text: <span class="literal">true</span></div><div class="line"> created_at: <span class="literal">true</span></div><div class="line"> updated_at: <span class="literal">true</span></div><div class="line"> categories: <span class="literal">true</span></div></pre></td></tr></table></figure>]]></content>
<categories>
<category> 博客建站 </category>
</categories>
<tags>
<tag> 学习笔记 </tag>
<tag> Next </tag>
<tag> Hexo </tag>
</tags>
</entry>
<entry>
<title><![CDATA[NexT 主题 CSS 自定义样式]]></title>
<url>/blog/2017/07/23/NexT-%E4%B8%BB%E9%A2%98-CSS-%E8%87%AA%E5%AE%9A%E4%B9%89%E6%A0%B7%E5%BC%8F/</url>
<content type="html"><![CDATA[<link rel="stylesheet" type="text/css" href="/assets/css/DPlayer.min.css"><script src="/assets/js/DPlayer.min.js"> </script><script src="/assets/js/APlayer.min.js"> </script><p>NexT 主题 CSS 自定义样式,自己学习记录的一个过程,大家参考一下就好,可能不是很详细,还请大家见谅</p>
<a id="more"></a>
<h1 id="对-source-css-custom-custom-styl-文件进行操作"><a href="#对-source-css-custom-custom-styl-文件进行操作" class="headerlink" title="对 source/css/_custom/custom.styl 文件进行操作"></a>对 source/css/_custom/custom.styl 文件进行操作</h1><h2 id="首页文章阴影样式"><a href="#首页文章阴影样式" class="headerlink" title="首页文章阴影样式"></a>首页文章阴影样式</h2><figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div></pre></td><td class="code"><pre><div class="line">//首页文章阴影样式</div><div class="line">.post {</div><div class="line"> margin-top: 60px;</div><div class="line"> margin-bottom: 60px;</div><div class="line"> padding: 25px;</div><div class="line"> -webkit-box-shadow: 0 0 14px rgba(202, 203, 203, .5);</div><div class="line"> -moz-box-shadow: 0 0 14px rgba(202, 203, 204, .5);</div><div class="line">}</div></pre></td></tr></table></figure>
<h2 id="首页阅读全文样式"><a href="#首页阅读全文样式" class="headerlink" title="首页阅读全文样式"></a>首页阅读全文样式</h2><figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div></pre></td><td class="code"><pre><div class="line">//首页阅读全文样式</div><div class="line">.post-button {</div><div class="line"> margin-top: 30px;</div><div class="line"> text-align: center;</div><div class="line">}</div><div class="line">.post-button .btn {</div><div class="line"> color: #fff;</div><div class="line"> font-size: 15px;</div><div class="line"> background: #686868;</div><div class="line"> border-radius: 16px;</div><div class="line"> line-height: 2;</div><div class="line"> margin: 0 4px 8px 4px;</div><div class="line"> padding: 0 20px;</div><div class="line">}</div><div class="line">.post-button a{</div><div class="line"> border-bottom: 1px solid #666;</div><div class="line">}</div><div class="line">.post-button a:hover {</div><div class="line"> color: #7784ba;</div><div class="line">}</div></pre></td></tr></table></figure>
<h2 id="首页头部样式"><a href="#首页头部样式" class="headerlink" title="首页头部样式"></a>首页头部样式</h2><figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div></pre></td><td class="code"><pre><div class="line">//首页头部样式</div><div class="line">.header {</div><div class="line"> background: url("/images/header-bk.jpg");</div><div class="line">}</div><div class="line">.site-meta {</div><div class="line"> float: none;</div><div class="line">}</div><div class="line">.menu {</div><div class="line"> float: none;</div><div class="line">}</div><div class="line">.logo-line-before,</div><div class="line">.logo-line-after {</div><div class="line"> display: none;</div><div class="line">}</div><div class="line">.menu .menu-item a {</div><div class="line"> font-size: 14px;</div><div class="line"> color: rgb(15, 46, 65);</div><div class="line"> border-radius: 4px;</div><div class="line">}</div><div class="line">.site-meta {</div><div class="line"> margin-left: 0px;</div><div class="line"> text-align: center;</div><div class="line">}</div><div class="line">.site-meta .site-title {</div><div class="line"> font-size: 28px;</div><div class="line"> font-family: 'Comic Sans MS', sans-serif;</div><div class="line"> color: #fff;</div><div class="line">}</div></pre></td></tr></table></figure>
<h2 id="首页尾部样式"><a href="#首页尾部样式" class="headerlink" title="首页尾部样式"></a>首页尾部样式</h2><figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div></pre></td><td class="code"><pre><div class="line">//首页尾部样式</div><div class="line">.footer {</div><div class="line"> background: none;</div><div class="line"> font-size: 16px;</div><div class="line">}</div><div class="line">.footer-inner {</div><div class="line"> font-family: 'Comic Sans MS', sans-serif;</div><div class="line"> text-align: center;</div><div class="line"> color: #4c618f;</div><div class="line">}</div></pre></td></tr></table></figure>
<h2 id="热评文章样式"><a href="#热评文章样式" class="headerlink" title="热评文章样式"></a>热评文章样式</h2><figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div></pre></td><td class="code"><pre><div class="line">//热评文章</div><div class="line">.ds-top-threads li a {</div><div class="line"> padding-left: 5px;</div><div class="line"> transition: border-width 0.2s linear 0s, color 0.2s linear 0s;</div><div class="line"> border-bottom: none;</div><div class="line">}</div><div class="line">.ds-top-threads li a:hover {</div><div class="line"> border-left: 8px solid #4d768c;</div><div class="line">}</div></pre></td></tr></table></figure>
<h2 id="侧边栏的一些样式"><a href="#侧边栏的一些样式" class="headerlink" title="侧边栏的一些样式"></a>侧边栏的一些样式</h2><ul>
<li><p>侧边栏信息样式修改</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div></pre></td><td class="code"><pre><div class="line">//侧边栏信息样式修改</div><div class="line">.site-author-name {</div><div class="line"> margin: 48px 0 0;</div><div class="line"> color: #090909;</div><div class="line"> font-family: 'Comic Sans MS', sans-serif;</div><div class="line">}</div><div class="line">.links-of-blogroll {</div><div class="line"> font-size: 14px;</div><div class="line"> margin-bottom: 42px;</div><div class="line">}</div><div class="line">.links-of-author {</div><div class="line"> margin-top: 30px;</div><div class="line"> margin-bottom: 58px;</div><div class="line">}</div><div class="line">.sidebar-inner {</div><div class="line"> color: #649ab6;</div><div class="line">}</div><div class="line">.sidebar {</div><div class="line"> box-shadow: inset 2px 2px 40px #bdb2b2;</div><div class="line">}</div><div class="line">.sidebar a {</div><div class="line"> color: #649ab6;</div><div class="line"> border-bottom-color: #649ab6;</div><div class="line"> border-bottom: none;</div><div class="line">}</div><div class="line">.sidebar a:hover {</div><div class="line"> color: #0c0b0b;</div><div class="line">}</div><div class="line">.site-state-item {</div><div class="line"> display: inline-block;</div><div class="line"> padding: 8px 28px;</div><div class="line"> border-left: 1px solid #649ab6;</div><div class="line">}</div><div class="line">.sidebar-nav .sidebar-nav-active {</div><div class="line"> color: #649ab6;</div><div class="line"> border-bottom-color: #649ab6;</div><div class="line">}</div><div class="line">.sidebar-nav li:hover {</div><div class="line"> color: #0c0b0b;</div><div class="line">}</div></pre></td></tr></table></figure>
</li>
<li><p>侧栏按钮样式</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line">//侧栏按钮样式</div><div class="line">.sidebar-toggle {</div><div class="line"> background: #649ab6;</div><div class="line">}</div><div class="line">.back-to-top {</div><div class="line"> background: #649ab6;</div><div class="line">}</div></pre></td></tr></table></figure>
</li>
<li><p>侧栏文章目录样式</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div></pre></td><td class="code"><pre><div class="line">//文章目录样式</div><div class="line">.post-toc .nav .active>a {</div><div class="line"> color: #4f7e96;</div><div class="line">}</div><div class="line">.post-toc ol a:hover {</div><div class="line"> color: #7784ba;</div><div class="line">}</div><div class="line">.sidebar-nav .sidebar-nav-active:hover {</div><div class="line"> color: #37596c;</div><div class="line">}</div><div class="line">a {</div><div class="line"> border-bottom: none;</div><div class="line">}</div></pre></td></tr></table></figure>
</li>
</ul>
<h1 id="进阶CSS设置"><a href="#进阶CSS设置" class="headerlink" title="进阶CSS设置"></a>进阶CSS设置</h1><h2 id="添加背景特效"><a href="#添加背景特效" class="headerlink" title="添加背景特效"></a>添加背景特效</h2><ul>
<li><p>next/layout/_layout.swig,在 body 标签之前添加如下代码:</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">{% if theme.canvas_nest %}</div><div class="line"><script type="text/javascript" src="//cdn.bootcss.com/canvas-nest.js/1.0.0/canvas-nest.min.js"></script></div><div class="line">{% endif %}</div></pre></td></tr></table></figure>
</li>
<li><p>打开next/_config.yml,<code>Ctrl+F</code>搜索<code>Canvas-nest</code>添加以下代码:</p>
<figure class="highlight css"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line"># <span class="selector-tag">Canvas-nest</span></div><div class="line"><span class="selector-tag">canvas_nest</span>: <span class="selector-tag">true</span></div></pre></td></tr></table></figure>
</li>
</ul>
<h2 id="添加-Fork-me-on-GitHub"><a href="#添加-Fork-me-on-GitHub" class="headerlink" title="添加 Fork me on GitHub"></a>添加 Fork me on GitHub</h2><p>添加左上角 Fork me on GitHub,将如下代码添加到<code>themes\next\layout\_layout.swig</code>底部的<code>body</code> 标签之内即可,注意修改 <code>href</code> 为你自己的链接:</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line"><a href="https://github.com/Lunaleeguo"><img style="position: absolute; top: 0; left: 0; border: 0;" src="https://camo.githubusercontent.com/c6286ade715e9bea433b4705870de482a654f78a/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f6c6566745f77686974655f6666666666662e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_left_white_ffffff.png"></a></div></pre></td></tr></table></figure>
<h2 id="文章内链接文本样式"><a href="#文章内链接文本样式" class="headerlink" title="文章内链接文本样式"></a>文章内链接文本样式</h2><h3 id="样式一"><a href="#样式一" class="headerlink" title="样式一"></a>样式一</h3><p>修改文件 <code>themes\next\source\css\_common\components\post\post.styl</code>,在末尾添加如下<code>css</code>样式,:</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div></pre></td><td class="code"><pre><div class="line">// 文章内链接文本样式</div><div class="line">.post-body p a{</div><div class="line"> color: #0593d3;</div><div class="line"> border-bottom: none;</div><div class="line"> border-bottom: 1px solid #0593d3;</div><div class="line"> &:hover {</div><div class="line"> color: #fc6423;</div><div class="line"> border-bottom: none;</div><div class="line"> border-bottom: 1px solid #fc6423;</div><div class="line"> }</div><div class="line">}</div></pre></td></tr></table></figure>
<h3 id="样式二"><a href="#样式二" class="headerlink" title="样式二"></a>样式二</h3><p>将链接文本设置为蓝色,鼠标划过时文字颜色加深,并显示下划线。修改文件<code>themes\next\source\css\_common\components\post\post.styl</code>,添加如下 css 样式:</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div></pre></td><td class="code"><pre><div class="line">// 文章内链接文本样式</div><div class="line">.post-body p a{</div><div class="line"> color: #0593d3;</div><div class="line"> border-bottom: none;</div><div class="line"> &:hover {</div><div class="line"> color: #0477ab;</div><div class="line"> text-decoration: underline;</div><div class="line"> }</div><div class="line">}</div></pre></td></tr></table></figure>
<h2 id="动态-Title"><a href="#动态-Title" class="headerlink" title="动态 Title"></a>动态 Title</h2><h3 id="Step-1-新建一个-js-文件"><a href="#Step-1-新建一个-js-文件" class="headerlink" title="Step 1 : 新建一个 js 文件"></a>Step 1 : 新建一个 js 文件</h3><p>在 <code>next/source/js/src</code> 目录下新建一个<code>js文件</code>,文件为 <code>dytitle.js</code> ,js具体代码如下:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div></pre></td><td class="code"><pre><div class="line"><!--崩溃欺骗--></div><div class="line">var OriginTitile = document.title;</div><div class="line"> var titleTime;</div><div class="line"> document.addEventListener('visibilitychange', function () {</div><div class="line"> if (document.hidden) {</div><div class="line"> $('[rel="icon"]').attr('href', "/img/TEP.ico");</div><div class="line"> document.title = '╭(°A°`)╮ 页面崩溃啦 ~ | 东骧神骏';</div><div class="line"> clearTimeout(titleTime);</div><div class="line"> }</div><div class="line"> else {</div><div class="line"> $('[rel="icon"]').attr('href', "/favicon.ico");</div><div class="line"> document.title = '(ฅ>ω<*ฅ) 噫又好了~' + OriginTitile;</div><div class="line"> titleTime = setTimeout(function () {</div><div class="line"> document.title = OriginTitile;</div><div class="line"> }, 2000);</div><div class="line"> }</div><div class="line"> });</div></pre></td></tr></table></figure>
<h3 id="Step-2-引用-js-文件"><a href="#Step-2-引用-js-文件" class="headerlink" title="Step 2 : 引用 js 文件"></a>Step 2 : 引用 js 文件</h3><p>在 <code>\themes\next\layout\_layout.swig</code> 的 上方引用加入:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line"><!--崩溃欺骗--></div><div class="line"><script type="text/javascript" src="/js/src/dytitle.js"></script></div></pre></td></tr></table></figure>
<h2 id="首页博文置顶"><a href="#首页博文置顶" class="headerlink" title="首页博文置顶"></a>首页博文置顶</h2><h3 id="Step-1-修改自带插件"><a href="#Step-1-修改自带插件" class="headerlink" title="Step 1 : 修改自带插件"></a>Step 1 : 修改自带插件</h3><p>修改 <code>Hexo</code> 自带的 <code>hexo-generator-index</code> 插件,把文件:<code>node_modules/hexo-generator-index/lib/generator.js</code> 内的代码替换为:</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div></pre></td><td class="code"><pre><div class="line"><span class="meta">'use strict'</span>;</div><div class="line"><span class="keyword">var</span> pagination = <span class="built_in">require</span>(<span class="string">'hexo-pagination'</span>);</div><div class="line"><span class="built_in">module</span>.exports = <span class="function"><span class="keyword">function</span>(<span class="params">locals</span>)</span>{</div><div class="line"> <span class="keyword">var</span> config = <span class="keyword">this</span>.config;</div><div class="line"> <span class="keyword">var</span> posts = locals.posts;</div><div class="line"> posts.data = posts.data.sort(<span class="function"><span class="keyword">function</span>(<span class="params">a, b</span>) </span>{</div><div class="line"> <span class="keyword">if</span>(a.top && b.top) { <span class="comment">// 两篇文章top都有定义</span></div><div class="line"> <span class="keyword">if</span>(a.top == b.top) <span class="keyword">return</span> b.date - a.date; <span class="comment">// 若top值一样则按照文章日期降序排</span></div><div class="line"> <span class="keyword">else</span> <span class="keyword">return</span> b.top - a.top; <span class="comment">// 否则按照top值降序排</span></div><div class="line"> }</div><div class="line"> <span class="keyword">else</span> <span class="keyword">if</span>(a.top && !b.top) { <span class="comment">// 以下是只有一篇文章top有定义,那么将有top的排在前面(这里用异或操作居然不行233)</span></div><div class="line"> <span class="keyword">return</span> <span class="number">-1</span>;</div><div class="line"> }</div><div class="line"> <span class="keyword">else</span> <span class="keyword">if</span>(!a.top && b.top) {</div><div class="line"> <span class="keyword">return</span> <span class="number">1</span>;</div><div class="line"> }</div><div class="line"> <span class="keyword">else</span> <span class="keyword">return</span> b.date - a.date; <span class="comment">// 都没定义按照文章日期降序排</span></div><div class="line"> });</div><div class="line"> <span class="keyword">var</span> paginationDir = config.pagination_dir || <span class="string">'page'</span>;</div><div class="line"> <span class="keyword">return</span> pagination(<span class="string">''</span>, posts, {</div><div class="line"> <span class="attr">perPage</span>: config.index_generator.per_page,</div><div class="line"> <span class="attr">layout</span>: [<span class="string">'index'</span>, <span class="string">'archive'</span>],</div><div class="line"> <span class="attr">format</span>: paginationDir + <span class="string">'/%d/'</span>,</div><div class="line"> <span class="attr">data</span>: {</div><div class="line"> <span class="attr">__index</span>: <span class="literal">true</span></div><div class="line"> }</div><div class="line"> });</div><div class="line">};</div></pre></td></tr></table></figure>
<h3 id="Step-2-在要发布的文章中添加-top-值"><a href="#Step-2-在要发布的文章中添加-top-值" class="headerlink" title="Step 2 : 在要发布的文章中添加 top 值"></a>Step 2 : 在要发布的文章中添加 top 值</h3><p>在要发布的文章中添加 <code>top</code> 值,数值越大文章越靠前,如</p>
<figure class="highlight markdown"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div></pre></td><td class="code"><pre><div class="line">---</div><div class="line">title: 解决Charles乱码问题</div><div class="line">date: 2017-05-22 22:45:48</div><div class="line">tags: 技巧</div><div class="line">categories: 技巧</div><div class="line">copyright: true</div><div class="line"><span class="section">top: 100</span></div><div class="line">---</div></pre></td></tr></table></figure>
<h3 id="Tips-一劳永逸的小技巧"><a href="#Tips-一劳永逸的小技巧" class="headerlink" title="Tips : 一劳永逸的小技巧"></a>Tips : 一劳永逸的小技巧</h3><p>为了以后方便,我们可以将 Top 值放到发布的 post 模板中(blog/scaffolds/post.md),以后直接利用 hexo new 生成即可,达到一劳永逸的效果:</p>
<figure class="highlight markdown"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div></pre></td><td class="code"><pre><div class="line">title: {{ title }} # 文章页面上的显示名称,可以任意修改,不会出现在URL中</div><div class="line">date: {{ date }}</div><div class="line">tags: [] # 文章标签,多个分类使用[a,b,c]这种格式</div><div class="line">categories: # 文章分类目录,多个分类使用[a,b,c]这种格式</div><div class="line">comments: true</div><div class="line">images: "/images/摘要配图/"</div><div class="line">top: #文章置顶,数值越大文章越靠前</div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"><!--more--></div></pre></td></tr></table></figure>
<h2 id="文章首页配图"><a href="#文章首页配图" class="headerlink" title="文章首页配图"></a>文章首页配图</h2><h3 id="Step-1-css-样式"><a href="#Step-1-css-样式" class="headerlink" title="Step 1 : css 样式"></a>Step 1 : css 样式</h3><p>需要在<code>hexo/themes/next/source/css/ _custom/custom.styl</code>里为图片设计一个专用容器:</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div></pre></td><td class="code"><pre><div class="line">//图片外部的容器方框</div><div class="line">.out-img-topic {</div><div class="line"> display: block;</div><div class="line"> max-height:300px;</div><div class="line"> margin-bottom: 24px;</div><div class="line"> overflow: hidden;</div><div class="line">}</div><div class="line">//图片</div><div class="line">img.img-topic {</div><div class="line"> display: block ;</div><div class="line"> margin-left: .7em;</div><div class="line"> margin-right: .7em;</div><div class="line"> padding: 0;</div><div class="line"> float: right;</div><div class="line"> clear: right;</div><div class="line">}</div></pre></td></tr></table></figure>
<h3 id="Step-2-渲染"><a href="#Step-2-渲染" class="headerlink" title="Step 2 : 渲染"></a>Step 2 : 渲染</h3><p>修改 <code>/themes/next/layout/ _macro/post.swig</code> ,在 <code>if is_index</code> 与 <code>if post.description and theme.excerpt_description</code> 之间添加以下代码:</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">{% if post.images %}</div><div class="line"> <div class="out-img-topic"></div><div class="line"> <img src={{ post.images }} class="img-topic"></div><div class="line"> </div></div><div class="line">{% endif %}</div></pre></td></tr></table></figure>
<h3 id="Step-3-修改post模板"><a href="#Step-3-修改post模板" class="headerlink" title="Step 3 : 修改post模板"></a>Step 3 : 修改post模板</h3><figure class="highlight markdown"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div></pre></td><td class="code"><pre><div class="line">title: {{ title }} # 文章页面上的显示名称,可以任意修改,不会出现在URL中</div><div class="line">date: {{ date }}</div><div class="line">tags: [] # 文章标签,多个分类使用[a,b,c]这种格式</div><div class="line">categories: # 文章分类目录,多个分类使用[a,b,c]这种格式</div><div class="line">comments: true</div><div class="line">images: "/images/摘要配图/"</div><div class="line">top: #文章置顶,数值越大文章越靠前</div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"><!--more--></div></pre></td></tr></table></figure>
<h2 id="添加热度"><a href="#添加热度" class="headerlink" title="添加热度"></a>添加热度</h2><p>打开<code>/themes/next/layout/_macro/post.swig</code>, <code>Ctrl+F</code> 搜索 <code>leancloud-visitors-count</code> ,在其下面一行加入如下代码:</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line"><span class="tag"><<span class="name">span</span>></span>℃<span class="tag"></<span class="name">span</span>></span></div></pre></td></tr></table></figure>
<h2 id="修改侧边栏头像下面的字体及颜色"><a href="#修改侧边栏头像下面的字体及颜色" class="headerlink" title="修改侧边栏头像下面的字体及颜色"></a>修改侧边栏头像下面的字体及颜色</h2><p>修改侧边栏头像下面的字体及颜色,修改的文件具体位置是在<code>themes\next\source\css\_common\components\sidebar\sidebar-author.styl</code>中的<code>font-size</code>,将其调大即可:</p>
<figure class="highlight css"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div></pre></td><td class="code"><pre><div class="line"><span class="selector-class">.site-description</span> {</div><div class="line"> <span class="attribute">margin-top</span>: <span class="number">5px</span>;</div><div class="line"> <span class="attribute">font-size</span>: <span class="number">16px</span>;</div><div class="line"> <span class="attribute">color</span>: $site-author-name-color;</div><div class="line"> <span class="comment">/*</span></div><div class="line"> font-size: $site-description-font-size;</div><div class="line"> color: $site-description-color;</div><div class="line"> */</div><div class="line">}</div></pre></td></tr></table></figure>
<h2 id="侧边栏头像修改为圆形,且旋转"><a href="#侧边栏头像修改为圆形,且旋转" class="headerlink" title="侧边栏头像修改为圆形,且旋转"></a>侧边栏头像修改为圆形,且旋转</h2><p>具体修改文件的位置是<code>themes\next\source\css\_common\components\sidebar\sidebar-author.styl</code>中的内容如下:</p>
<figure class="highlight css"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div></pre></td><td class="code"><pre><div class="line"><span class="selector-class">.site-author-image</span> {</div><div class="line"> <span class="attribute">display</span>: block;</div><div class="line"> <span class="attribute">margin</span>: <span class="number">0</span> auto;</div><div class="line"> <span class="attribute">padding</span>: $site-author-image-padding;</div><div class="line"> <span class="attribute">max-width</span>: $site-author-image-width;</div><div class="line"> <span class="attribute">height</span>: $site-author-image-height;</div><div class="line"> <span class="attribute">border</span>: site-author-image-border-color;</div><div class="line"> <span class="comment">/* start*/</span></div><div class="line"> <span class="attribute">border-radius</span>: <span class="number">50%</span></div><div class="line"> webkit-transition: <span class="number">1.4s</span> all;</div><div class="line"> <span class="attribute">moz-transition</span>: <span class="number">1.4s</span> all;</div><div class="line"> <span class="attribute">ms-transition</span>: <span class="number">1.4s</span> all;</div><div class="line"> <span class="attribute">transition</span>: <span class="number">1.4s</span> all;</div><div class="line"> <span class="comment">/* end */</span></div><div class="line">}</div><div class="line"><span class="comment">/* start */</span></div><div class="line"><span class="selector-class">.site-author-image</span><span class="selector-pseudo">:hover</span> {</div><div class="line"> <span class="attribute">background-color</span>: <span class="number">#55DAE1</span>;</div><div class="line"> <span class="attribute">webkit-transform</span>: <span class="built_in">rotate</span>(360deg) <span class="built_in">scale</span>(1.1);</div><div class="line"> <span class="attribute">moz-transform</span>: <span class="built_in">rotate</span>(360deg) <span class="built_in">scale</span>(1.1);</div><div class="line"> <span class="attribute">ms-transform</span>: <span class="built_in">rotate</span>(360deg) <span class="built_in">scale</span>(1.1);</div><div class="line"> <span class="attribute">transform</span>: <span class="built_in">rotate</span>(360deg) <span class="built_in">scale</span>(1.1);</div><div class="line">}</div><div class="line"><span class="comment">/* end */</span></div></pre></td></tr></table></figure>
<h2 id="侧边栏添加网易云音乐"><a href="#侧边栏添加网易云音乐" class="headerlink" title="侧边栏添加网易云音乐"></a>侧边栏添加网易云音乐</h2><p>将外链插入到 hexo/themes/next/layout 中的文件中</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line"><iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width=280 height=86 src="//music.163.com/outchain/player?type=2&id=38358214&auto=0&height=66"></iframe></div></pre></td></tr></table></figure>
<h2 id="打赏字体不闪动"><a href="#打赏字体不闪动" class="headerlink" title="打赏字体不闪动"></a>打赏字体不闪动</h2><p>修改文件<code>next/source/css/_common/components/post/post-reward.styl</code>,然后注释其中的函数<code>wechat:hover</code>和<code>alipay:hover</code>,如下:</p>
<figure class="highlight css"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div></pre></td><td class="code"><pre><div class="line"><span class="comment">/* 注释文字闪动函数</span></div><div class="line"> #wechat:hover p{</div><div class="line"> animation: roll 0.1s infinite linear;</div><div class="line"> -webkit-animation: roll 0.1s infinite linear;</div><div class="line"> -moz-animation: roll 0.1s infinite linear;</div><div class="line">}</div><div class="line"> #alipay:hover p{</div><div class="line"> animation: roll 0.1s infinite linear;</div><div class="line"> -webkit-animation: roll 0.1s infinite linear;</div><div class="line"> -moz-animation: roll 0.1s infinite linear;</div><div class="line">}</div><div class="line">*/</div></pre></td></tr></table></figure>
<h2 id="隐藏网页底部powered-By-Hexo强力驱动"><a href="#隐藏网页底部powered-By-Hexo强力驱动" class="headerlink" title="隐藏网页底部powered By Hexo强力驱动"></a>隐藏网页底部powered By Hexo强力驱动</h2><p>打开<code>themes/next/layout/_partials/footer.swig</code>, 采用 <!-- --> 注释掉中间的代码,使用隐藏之间的代码即可,或者直接删除:</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div></pre></td><td class="code"><pre><div class="line"><!--</div><div class="line">{% if theme.copyright %}</div><div class="line"><div class="powered-by"></div><div class="line"> {{ __('footer.powered', '<a class="theme-link" href="https://hexo.io">Hexo</a>') }}</div><div class="line"></div></div><div class="line"></div><div class="line"><div class="theme-info"></div><div class="line"> {{ __('footer.theme') }} -</div><div class="line"> <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next"></div><div class="line"> NexT.{{ theme.scheme }}</div><div class="line"> </a></div><div class="line"></div></div><div class="line">--></div></pre></td></tr></table></figure>
<h2 id="自定义版权声明-HTML-代码"><a href="#自定义版权声明-HTML-代码" class="headerlink" title="自定义版权声明 HTML 代码"></a>自定义版权声明 HTML 代码</h2><ul>
<li><p>定位到<code>themes\next\layout\_macro\post.swig</code>文件,找到<code><footer class="post-footer"></code>节点,该节点包括了每篇文章底部的 tag、span 分割线等标签,可以根据自己的需要放置【版权声明】的位置。</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div></pre></td><td class="code"><pre><div class="line"><span class="tag"><<span class="name">footer</span> <span class="attr">class</span>=<span class="string">"post-footer"</span>></span></div><div class="line"> {# 版权声明节点 #}</div><div class="line"> <span class="tag"><<span class="name">div</span>></span> </div><div class="line"> {% if not is_index %}</div><div class="line"> <span class="tag"><<span class="name">ul</span> <span class="attr">class</span>=<span class="string">"post-copyright"</span>></span></div><div class="line"> <span class="tag"><<span class="name">li</span> <span class="attr">class</span>=<span class="string">"post-copyright-link"</span>></span></div><div class="line"> <span class="tag"><<span class="name">strong</span>></span>本文作者:<span class="tag"></<span class="name">strong</span>></span></div><div class="line"> <span class="tag"><<span class="name">a</span> <span class="attr">href</span>=<span class="string">"/"</span> <span class="attr">title</span>=<span class="string">"欢迎访问 {{ theme.author }} 的个人博客"</span>></span>{{ theme.author }}<span class="tag"></<span class="name">a</span>></span></div><div class="line"> <span class="tag"></<span class="name">li</span>></span></div><div class="line"> <span class="tag"><<span class="name">li</span> <span class="attr">class</span>=<span class="string">"post-copyright-link"</span>></span></div><div class="line"> <span class="tag"><<span class="name">strong</span>></span>本文标题:<span class="tag"></<span class="name">strong</span>></span></div><div class="line"> <span class="tag"><<span class="name">a</span> <span class="attr">href</span>=<span class="string">"{{ url_for(post.permalink) }}"</span> <span class="attr">title</span>=<span class="string">"{{ post.title }}"</span>></span>{{ post.title }}<span class="tag"></<span class="name">a</span>></span></div><div class="line"> <span class="tag"></<span class="name">li</span>></span></div><div class="line"> <span class="tag"><<span class="name">li</span> <span class="attr">class</span>=<span class="string">"post-copyright-link"</span>></span></div><div class="line"> <span class="tag"><<span class="name">strong</span>></span>本文链接:<span class="tag"></<span class="name">strong</span>></span></div><div class="line"> <span class="tag"><<span class="name">a</span> <span class="attr">href</span>=<span class="string">"{{ url_for(post.permalink) }}"</span> <span class="attr">title</span>=<span class="string">"{{ post.title }}"</span>></span>{{ post.permalink }}<span class="tag"></<span class="name">a</span>></span></div><div class="line"> <span class="tag"></<span class="name">li</span>></span></div><div class="line"> <span class="tag"><<span class="name">li</span> <span class="attr">class</span>=<span class="string">"post-copyright-date"</span>></span></div><div class="line"> <span class="tag"><<span class="name">strong</span>></span>发布时间:<span class="tag"></<span class="name">strong</span>></span>{{ post.date.format("YYYY年M月D日 - HH时MM分") }}</div><div class="line"> <span class="tag"></<span class="name">li</span>></span> </div><div class="line"> <span class="tag"><<span class="name">li</span> <span class="attr">class</span>=<span class="string">"post-copyright-license"</span>></span></div><div class="line"> <span class="tag"><<span class="name">strong</span>></span>版权声明: <span class="tag"></<span class="name">strong</span>></span></div><div class="line"> 本文由 {{theme.author}} 原创,所有文章除特别声明外,均采用 <span class="tag"><<span class="name">a</span> <span class="attr">href</span>=<span class="string">"https://creativecommons.org/licenses/by-nc-nd/4.0/deed.zh"</span> <span class="attr">rel</span>=<span class="string">"license"</span> <span class="attr">target</span>=<span class="string">"_blank"</span>></span>BY-NC-SA 4.0 CN<span class="tag"></<span class="name">a</span>></span> 许可协议。转载请注明出处!</div><div class="line"> <span class="tag"></<span class="name">li</span>></span></div><div class="line"> <span class="tag"></<span class="name">ul</span>></span></div><div class="line"> {% endif %}</div><div class="line"> <span class="tag"></<span class="name">div</span>></span></div><div class="line">...</div></pre></td></tr></table></figure>
</li>
<li><p>定位到<code>themes\next\source\css\_custom\custom.styl</code> 文件,通过类选择器添加 CSS 样式</p>
<figure class="highlight css"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line"><span class="selector-class">.post-copyright</span> {</div><div class="line"> <span class="attribute">margin</span>: <span class="number">2em</span> <span class="number">0</span> <span class="number">0</span>;</div><div class="line"> <span class="attribute">padding</span>: <span class="number">0.5em</span> <span class="number">1em</span>;</div><div class="line"> <span class="attribute">border-left</span>: <span class="number">3px</span> solid <span class="number">#FF1700</span>;</div><div class="line"> <span class="attribute">background-color</span>: <span class="number">#F9F9F9</span>;</div><div class="line"> <span class="attribute">list-style</span>: none;</div><div class="line">}</div></pre></td></tr></table></figure>
</li>
</ul>
<h2 id="文末统一添加-“本文结束”-标记"><a href="#文末统一添加-“本文结束”-标记" class="headerlink" title="文末统一添加 “本文结束” 标记"></a>文末统一添加 “本文结束” 标记</h2><p>在路径 <code>\themes\next\layout\_macro</code> 中新建 <code>passage-end-tag.swig</code> 文件, 并添加以下内容:</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line"><span class="tag"><<span class="name">div</span>></span></div><div class="line"> {% if not is_index %}</div><div class="line"> <span class="tag"><<span class="name">div</span> <span class="attr">style</span>=<span class="string">"text-align:center;color: #ccc;font-size:14px;"</span>></span>-------------本文结束<span class="tag"><<span class="name">i</span> <span class="attr">class</span>=<span class="string">"fa fa-paw"</span>></span><span class="tag"></<span class="name">i</span>></span>感谢您的阅读-------------<span class="tag"></<span class="name">div</span>></span></div><div class="line"> {% endif %}</div><div class="line"><span class="tag"></<span class="name">div</span>></span></div></pre></td></tr></table></figure>
<p>接着打开<code>\themes\next\layout\_macro\post.swig</code>文件,在<code>post-body</code> 之后, <code>post-footer</code> 之前添加如下代码(post-footer 之前两个 DIV):</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line"><div></div><div class="line"> {% if not is_index %}</div><div class="line"> {% include 'passage-end-tag.swig' %}</div><div class="line"> {% endif %}</div><div class="line"></div></div></pre></td></tr></table></figure>
<p>然后打开主题配置文件(<code>_config.yml</code>), 在末尾添加:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line"># 文章末尾添加“本文结束”标记</div><div class="line">passage_end_tag:</div><div class="line">enabled: true</div></pre></td></tr></table></figure>
<h2 id="网站底部字数统计"><a href="#网站底部字数统计" class="headerlink" title="网站底部字数统计"></a>网站底部字数统计</h2><p>在<code>/themes/next/layout/_partials/footer.swig</code>文件尾部加上:</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line"><div class="theme-info"></div><div class="line"> <div class="powered-by"></div></div><div class="line"> <span class="post-count">博客全站共{{ totalcount(site) }}字</span></div><div class="line"></div></div></pre></td></tr></table></figure>]]></content>
<categories>
<category> 博客建站 </category>
</categories>
<tags>
<tag> 学习笔记 </tag>
<tag> Next </tag>
<tag> CSS </tag>
</tags>
</entry>
<entry>
<title><![CDATA[微软 Surface Pro 4 macOS Sierra 10.12 黑苹果安装教程]]></title>
<url>/blog/2017/07/22/Surface%20Pro%204%20macOS%20Sierra%2010.12%20%E9%BB%91%E8%8B%B9%E6%9E%9C%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B/</url>
<content type="html"><![CDATA[<link rel="stylesheet" type="text/css" href="/assets/css/DPlayer.min.css"><script src="/assets/js/DPlayer.min.js"> </script><script src="/assets/js/APlayer.min.js"> </script><p> 在远景论坛里写过几次帖子,实在受不了远景的编辑器,于是自建了一个博客,以后有一些心得和体会就直接在这边编辑,到时候再搬运到论坛里去吧。本来想着配置文件和驱动分享完就行了,想了想 Surface Pro 4 的安装还是有一些注意事项值得提醒一下大家,所以就简单的说一下注意事项吧,安装教程论坛里有很多就不重复了,流程大致相同。</p>
<a id="more"></a>
<h1 id="Surface-Pro-4-Sierra"><a href="#Surface-Pro-4-Sierra" class="headerlink" title="Surface-Pro-4-Sierra"></a>Surface-Pro-4-Sierra</h1><p>微软 Surface Pro 4-macOS Sierra 10.12 黑苹果安装教程</p>
<h2 id="机器配置"><a href="#机器配置" class="headerlink" title="机器配置"></a>机器配置</h2><p>主板 微软 Surface Pro 4 ( 英特尔 PCI 标准主机 CPU 桥 - 100 Series 芯片组 )</p>
<h2 id="准备工作"><a href="#准备工作" class="headerlink" title="准备工作"></a>准备工作</h2><ul>
<li>安全启动<code>Secure Boot</code>关掉</li>
<li><code>BitLocker</code>关掉</li>
<li>从U盘启动的方法:长按音量减键保持,然后轻按一下开机键,直到出现Clvoer界面时就可松开音量键了</li>
<li><strong>安装Clvoer时不要安装CsmVideoDxe-64.efi,drivers64UEFI里检查下有的要删除,不删除会黑屏</strong></li>
</ul>
<h2 id="安装说明"><a href="#安装说明" class="headerlink" title="安装说明"></a>安装说明</h2><p><strong>安装原版系统的原则是:无须<code>DSDT</code>和<code>SSDT</code>,配置和驱动文件要尽量精简,便于后期五国查错</strong></p>
<ul>
<li><p><code>drivers64UEFI</code>文件包含:</p>
<blockquote>
<p>DataHubDxe-64.efi<br>EmuVariableUefi-64.efi<br>Fat-64.efi<br>OsxAptioFix2Drv-64.efi<br>PartitionDxe-64.efi<br>VBoxHfs-64.efi</p>
</blockquote>
</li>
</ul>
<ul>
<li><p>kexts中的<code>Others</code>文件包含:</p>
<blockquote>
<p>FakeSMC.kext<br>VoodooPS2Controller.kext<br>USBInjectAll.kext</p>
</blockquote>
</li>
</ul>
<h2 id="config配置需注意的几点"><a href="#config配置需注意的几点" class="headerlink" title="config配置需注意的几点"></a>config配置需注意的几点</h2><h3 id="NVMe直接Patch"><a href="#NVMe直接Patch" class="headerlink" title="NVMe直接Patch"></a>NVMe直接Patch</h3><p>自从10.12以后不需要安装单独的NVMe驱动了,直接利用Clvoer的Patch功能即可,<strong>特别注意安装不同版本对应的Patch不完全相同</strong></p>
<h3 id="Iris-540在安装时ig-platform-id注入为0x12345678"><a href="#Iris-540在安装时ig-platform-id注入为0x12345678" class="headerlink" title="Iris 540在安装时ig-platform-id注入为0x12345678"></a>Iris 540在安装时ig-platform-id注入为0x12345678</h3><p>目前HD 520/530/540显卡要想驱动一般要注入<code>ig-platform-id:0x19160000</code>,有的机型<code>DVMT</code>预读显存和苹果规定的大小不一致,就容易在安装过程中卡AppleIntelSKLGraphicsFramebuffer,这里远景论坛里面也有各种各样的解决办法。对于非Surface Pro 4的机器,大家可以借鉴一些解决办法,以下是在远景论坛上搜集的一些解决方法: </p>
<blockquote>
<ul>
<li><p>法一:有直接在BIOS里将DVMT改为96M以上<br>这个办法可以但是前提是要Bios里有这个修改选项,Pro4里就没有这个选项</p>
</li>
<li><p>法二:有的是通过直接升级Bios解决的<br>其他机器可能可行,但是Pro 4目前看来是没法升级Bios的</p>
</li>
<li><p>法三:有利用Clover的Patch直接对AppleIntelSKLGraphicsFramebuffer打二进制补丁解决的<br>正常情况下,Clover里Patch过后就能解决问题,实际上Clover的Patch功能经常抽风,远景论坛上大把的人打了补丁还是卡这儿,Pro4同样不行</p>
</li>
<li><p>法四:有的干脆直接上懒人版,然后替换SLE下的自己修改过的AppleIntelSKLGraphicsFramebuffer.kext<br>这个办法一般情况下是能够解决问题的,但是考虑到要用到懒人版,而且还得装HFS+这个软件,容易造成HFS分区不稳定,不是很建议大家使用</p>
</li>
</ul>
</blockquote>
<p><strong>综上所述,个人认为目前解决卡<code>AppleIntelSKLGraphicsFramebuffer</code>最好的办法就是直接仿冒一个无用的显卡ID如:<code>fakeID=0X12345678</code>,也可以不是这个,只要仿冒一个无用的显卡ID即可)就行,目的是保证在初次安装系统时不加载显卡驱动。等安装完毕进入系统后再替换修改的<code>AppleIntelSKLGraphicsFramebuffer.kext</code>,然后修复权限即可。具体操作流程分两步进行</strong></p>
<h4 id="Step-1:"><a href="#Step-1:" class="headerlink" title="Step 1:"></a><strong>Step 1:</strong></h4><p>初次安装,仿冒无用显卡ID以进入系统,<code>config</code>注入<code>ig-platform-id:0x12345678</code>,代码如下: </p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div></pre></td><td class="code"><pre><div class="line"><key>Graphics</key></div><div class="line"> <dict></div><div class="line"> <key>Inject</key></div><div class="line"> <dict></div><div class="line"> <key>ATI</key></div><div class="line"> <false/></div><div class="line"> <key>Intel</key></div><div class="line"> <true/></div><div class="line"> <key>NVidia</key></div><div class="line"> <false/></div><div class="line"> </dict></div><div class="line"> <key>NvidiaSingle</key></div><div class="line"> <false/></div><div class="line"> <key>VRAM</key></div><div class="line"> <integer>128</integer></div><div class="line"> <key>ig-platform-id</key></div><div class="line"> <string>0x12345678</string></div><div class="line"> </dict></div></pre></td></tr></table></figure>
<h4 id="Step-2:"><a href="#Step-2:" class="headerlink" title="Step 2:"></a><strong>Step 2:</strong></h4><p>利用原版镜像安装完成后注意:安装完成后替换<code>S/L/E</code>下的<code>AppleIntelSKLGraphicsFramebuffer.kext</code>,然后把<code>ig-platform-id</code>修改为注入为<code>0x19160000</code>,修复权限重启后即可驱动<code>Iris HD 540</code>,<code>config</code>注入代码如下:</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div></pre></td><td class="code"><pre><div class="line"><key>Graphics</key></div><div class="line"> <dict></div><div class="line"> <key>Inject</key></div><div class="line"> <dict></div><div class="line"> <key>ATI</key></div><div class="line"> <false/></div><div class="line"> <key>Intel</key></div><div class="line"> <true/></div><div class="line"> <key>NVidia</key></div><div class="line"> <false/></div><div class="line"> </dict></div><div class="line"> <key>NvidiaSingle</key></div><div class="line"> <false/></div><div class="line"> <key>VRAM</key></div><div class="line"> <integer>128</integer></div><div class="line"> <key>ig-platform-id</key></div><div class="line"> <string>0x19160000</string></div><div class="line"> </dict></div></pre></td></tr></table></figure>
<p>至此,Surface Pro 4通过仿冒无用显卡ID先安装原版镜像,进入系统后,替换修改版<code>AppleIntelSKLGraphicsFramebuffer.kext</code>并修复权限,再注入正确的显卡ID即可驱动显卡,并避免了在安装过程中卡<code>AppleIntelSKLGraphicsFramebuffer</code>的问题。</p>
<hr>
<h2 id="安装完成后对系统进行修正"><a href="#安装完成后对系统进行修正" class="headerlink" title="安装完成后对系统进行修正"></a>安装完成后对系统进行修正</h2><h3 id="ALC298声卡修正"><a href="#ALC298声卡修正" class="headerlink" title="- ALC298声卡修正"></a>- ALC298声卡修正</h3><ul>
<li><p>ALC298声卡的驱动</p>
<p>通过从<a href="">vit9696</a><a href="">1</a>的主页上下载<code>AppleALC</code>的源码,保留<code>ALC298</code>的相关文件,删除其他无用的文件,并利用<code>Xcode</code>编译得到ALC298的仿冒声卡驱动<code>AppleALC.kext</code>,然后注入声卡ID为3即可。其中,注入声卡ID有两种方法,任选其一即可:</p>
</li>
</ul>
<ol>
<li><p>方法一:利用Clover直接注入:</p>
<p><key>Devices</key> </p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line"> <dict> </div><div class="line"> <key>Audio</key> </div><div class="line"> <dict> </div><div class="line"> <key>Inject</key> </div><div class="line"> <string>3</string> </div><div class="line"> </dict> </div><div class="line"> </dict></div></pre></td></tr></table></figure>
</li>
<li><p>方法二:利用Rehabman的<code>HotPatches</code>直接通过<code>SSDT</code>注入:</p>
<p>在<code>SSDT-Config.dsl</code>修改<code>Name(AUDL, 你的id十进制)</code>,当然,对于Surfacre Pro 4则为<code>Name(AUDL, 3)</code>,然后编译成aml文件,放回<code>ACPI/patched</code></p>
<ul>
<li><p>ALC声卡唤醒无声的解决</p>
<p>直接利用Rehabman的<code>CodecCommander.kext</code>驱动便可解决</p>
</li>
</ul>
</li>
</ol>
<hr>
<h3 id="亮度修复"><a href="#亮度修复" class="headerlink" title="- 亮度修复"></a>- 亮度修复</h3><p>利用Rehabman的<code>HotPatches</code>加入<code>SSDT-PNLF.aml</code>放入<code>ACPI/patched</code>并配合<code>IntelBacklight.kext</code>,实现亮度可调</p>
<hr>
<h3 id="电池电量修复"><a href="#电池电量修复" class="headerlink" title="- 电池电量修复"></a>- 电池电量修复</h3><ul>
<li>电池电量修复分两步进行:<ul>
<li>Step 1 :<br>下载MaciASL,并添加Rehabman的补丁源网址:<a href="http://raw.github.com/RehabMan/Laptop-DSDT-Patch/master" target="_blank" rel="external">http://raw.github.com/RehabMan/Laptop-DSDT-Patch/master</a></li>
<li>Step 2 :<br>找到<code>bat Surface Pro v4</code>,打上对应的补丁,并配合<code>ACPIBatteryManager.kext</code>实现电池电量显示</li>
</ul>
</li>
</ul>
<hr>
<h3 id="网卡修正"><a href="#网卡修正" class="headerlink" title="- 网卡修正"></a>- 网卡修正</h3><ul>
<li>点击右上角的WiFi图标,选择最后一项,在左边列表删除掉所有网络。</li>
<li>终端执行<code>sudo rm /Library/Preferences/SystemConfiguration/NetworkInterfaces.plist</code></li>
<li>等系统重启完了,点击右上角的WiFi图标,选择最后一项,按顺序重新添加<strong>以太网</strong>,<strong>Wi-Fi</strong>,应用。蓝牙可以不添加,之后自动会加的。</li>
<li>利用Rehabman的<code>HotPatches</code>加入<code>ssdt-rmne.aml</code>放入<code>ACPI/patched</code>并配合<code>NullEthernet.kext</code>,实现App Store无障碍登录。</li>
</ul>
<hr>
<h3 id="TF卡读卡器的修正"><a href="#TF卡读卡器的修正" class="headerlink" title="- TF卡读卡器的修正"></a>- TF卡读卡器的修正</h3><p>配合<code>GenericUSBXHCI.kext</code>,可以完美使用TF读卡器,并且USB 3.0以及拓展坞的正常使用</p>
<hr>
<h3 id="电源管理及变频的修正"><a href="#电源管理及变频的修正" class="headerlink" title="- 电源管理及变频的修正"></a>- 电源管理及变频的修正</h3><p>由于苹果在 Skylake 平台已经不再使用 <code>AppleLPC</code> 机制,所以不再需要加载 AppleLPC 。特别的,在新的 <code>Skylake</code> 平台下,也不用像以前一样利用脚本产生SSDT来变频了,新平台下无须SSDT,直接在<code>Clover中的CPU</code>选项中开启<code>HWPEnable</code>即可,或者直接利用<code>HWPEnabler.kext</code>实现变频。</p>
<p>经过实际测试,在Surface Pro 4 上,利用<code>HWPEnable</code>可实现12级变频调节。</p>
<h2 id="完成情况"><a href="#完成情况" class="headerlink" title="完成情况"></a>完成情况</h2><ul>
<li>NVMe SSD可用</li>
<li>Iris 540显卡驱动,HIDPI模式开启</li>
<li>亮度可调节</li>
<li>电池电量显示正常</li>
<li>声卡ALC298可用,且唤醒有声</li>
<li>睡眠唤醒正常,合盖睡眠正常</li>
<li>电源管理可用,变频正常</li>
<li>USB3.0正常,TF卡读卡器可用,包括扩展坞可以正常使用</li>
<li>有线网卡正常驱动</li>
<li>Type Cover键盘可用</li>
</ul>
<h2 id="目前无解"><a href="#目前无解" class="headerlink" title="目前无解"></a>目前无解</h2><ul>
<li>Marvell的无线蓝牙二合一卡均无解</li>
<li>触控无解,Surface Pen无法使用</li>
<li>前后摄像头+红外线无解 </li>
</ul>
<h2 id="特别鸣谢"><a href="#特别鸣谢" class="headerlink" title="特别鸣谢"></a>特别鸣谢</h2><ul>
<li><a href="https://github.com/RehabMan" target="_blank" rel="external">RehabMan</a></li>
<li><a href="https://github.com/Piker-Alpha" target="_blank" rel="external"> Piker-Alpha </a></li>
<li><a href="https://github.com/vit9696" target="_blank" rel="external"> vit9696 </a></li>
</ul>]]></content>
<categories>
<category> 技术 </category>
</categories>
<tags>
<tag> 教程 </tag>
<tag> 黑苹果 </tag>
</tags>
</entry>
<entry>
<title><![CDATA[【置顶】Hexo搭建博客教程]]></title>
<url>/blog/2017/03/03/Hexo%E6%90%AD%E5%BB%BA%E5%8D%9A%E5%AE%A2%E6%95%99%E7%A8%8B/</url>
<content type="html"><![CDATA[<link rel="stylesheet" type="text/css" href="/assets/css/DPlayer.min.css"><script src="/assets/js/DPlayer.min.js"> </script><script src="/assets/js/APlayer.min.js"> </script><p><blockquote class="blockquote-center">所谓博客,都是孤芳自赏<br></blockquote><br>现在越来越多的人喜欢利用Github搭建静态网站,原因不外乎简单省钱。本人也利用hexo+github搭建了本博客,用于分享一些心得。在此过程中,折腾博客的各种配置以及功能占具了我一部分时间,在此详细记录下我是如何利用hexo+github搭建静态博客以及一些配置相关问题,以免过后遗忘,且当备份之用。<br><a id="more"></a></p>
<h3 id="准备工作"><a href="#准备工作" class="headerlink" title="准备工作"></a>准备工作</h3><ul>
<li>下载node.js并安装(官网下载安装),默认会安装npm。</li>
<li>下载安装git(官网下载安装)</li>
<li>下载安装hexo。方法:打开cmd 运行<em>npm install -g hexo</em>(要翻墙) </li>
</ul>
<h3 id="本地搭建hexo静态博客"><a href="#本地搭建hexo静态博客" class="headerlink" title="本地搭建hexo静态博客"></a>本地搭建hexo静态博客</h3><ul>
<li>新建一个文件夹,如MyBlog</li>
<li>进入该文件夹内,右击运行git,输入:<em>hexo init</em>(生成hexo模板,可能要翻墙)</li>
<li>生成完模板,运行<em>npm install</em>(目前貌似不用运行这一步)</li>
<li>最后运行:<em>hexo server</em> (运行程序,访问本地localhost:4000可以看到博客已经搭建成功)</li>
</ul>
<h3 id="将博客与Github关联"><a href="#将博客与Github关联" class="headerlink" title="将博客与Github关联"></a>将博客与Github关联</h3><ul>
<li><p>在Github上创建名字为XXX.github.io的项目,XXX为自己的github用户名。</p>
</li>
<li><p>打开本地的MyBlog文件夹项目内的_config.yml配置文件,将其中的type设置为git</p>
</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">deploy:</div><div class="line"> <span class="built_in">type</span>: git</div><div class="line"> repository: https://github.com/tengzhangchao/tengzhangchao.github.io.git</div><div class="line"> branch: master</div></pre></td></tr></table></figure>
<ul>
<li>运行:<em>npm install hexo-deployer-git –save</em></li>
<li>运行:<em>hexo g</em>(本地生成静态文件)</li>
<li>运行:<em>hexo d</em>(将本地静态文件推送至Github)</li>
</ul>
<p>此时,打开浏览器,访问<em><a href="http://tengzhangchao.github.io" target="_blank" rel="external">http://tengzhangchao.github.io</a></em></p>
<h3 id="绑定域名"><a href="#绑定域名" class="headerlink" title="绑定域名"></a>绑定域名</h3><p> 博客已经搭建好,也能通过github的域名访问,但总归还是用自己的域名比较舒服。因为我们需要设置将自己的域名绑定到github这个博客项目上。</p>
<ul>
<li><p>域名提供商设置</p>
<p>添加2条A记录:</p>
<p>@—>192.30.252.154</p>
<p>@—>192.30.252.153</p>
<p>添加一条CNAME记录:</p>
<p>CNAME—>tengzhangchao.github.io</p>
</li>
<li><p>博客添加CNAME文件</p>
<p>配置完域名解析后,进入博客目录,在source目录下新建CNAME文件,写入域名,如:thief.one</p>
</li>
<li><p>运行:<em>hexo g</em></p>
</li>
<li>运行:<em>hexo d</em></li>
</ul>
<h3 id="更新博客内容"><a href="#更新博客内容" class="headerlink" title="更新博客内容"></a>更新博客内容</h3><p> 至此博客已经搭建完毕,域名也已经正常解析,那么剩下的问题就是更新内容了。</p>
<h4 id="更新文章"><a href="#更新文章" class="headerlink" title="更新文章"></a>更新文章</h4><ul>
<li>在MyBlog目录下执行:<em>hexo new “我的第一篇文章”</em>,会在source->_posts文件夹内生成一个.md文件。</li>
<li>编辑该文件(遵循Markdown规则)</li>
<li>修改起始字段<ul>
<li>title 文章的标题 </li>
<li>date 创建日期 (文件的创建日期 )</li>
<li>updated 修改日期 ( 文件的修改日期) </li>
<li>comments 是否开启评论 true </li>
<li>tags 标签 </li>
<li>categories 分类 </li>
<li>permalink url中的名字(文件名)</li>
</ul>
</li>
<li>编写正文内容(MakeDown)</li>
<li>hexo clean 删除本地静态文件(Public目录),可不执行。</li>
<li>hexo g 生成本地静态文件(Public目录)</li>
<li>hexo deploy 将本地静态文件推送至github(hexo d)</li>
</ul>
<h4 id="添加菜单"><a href="#添加菜单" class="headerlink" title="添加菜单"></a>添加菜单</h4><p>进入theme目录,编辑_config_yml文件,找到menu:字段,在该字段下添加一个字段。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">menu:</div><div class="line"> home: /</div><div class="line"> about: /about</div><div class="line"> ......</div></pre></td></tr></table></figure>
<p>然后找到lanhuages目录,编辑zh-Hans.yml文件:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">menu:</div><div class="line"> home: 首页</div><div class="line"> about: 关于作者</div><div class="line"> ......</div></pre></td></tr></table></figure>
<p>更新页面显示的中文字符,最后进入theme目录下的Source目录,新增一个about目录,里面写一个index.html文件。</p>
<h4 id="文章内插入图片"><a href="#文章内插入图片" class="headerlink" title="文章内插入图片"></a>文章内插入图片</h4><p>在文章中写入:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">![](/upload_image/1.jpg)</div></pre></td></tr></table></figure>
<p> 然后进入themes-主题名-source-upload_image目录下(自己创建),将图片放到这个目录下,就可以了。</p>
<p>说明:当执行hexo g命令时,会自动把图片复制到 public文件的upload_image目录下。</p>
<h3 id="个性化设置"><a href="#个性化设置" class="headerlink" title="个性化设置"></a>个性化设置</h3><h4 id="基本信息"><a href="#基本信息" class="headerlink" title="基本信息"></a>基本信息</h4><p> 在根目录下的_config.yml文件中,可以修改标题,作者等信息。打开编辑该文件,注意:每一个值的冒号后面都有一个半角空格!</p>
<ul>
<li>未生效的写法:title:nMask的博客</li>
<li>能生效的写法:title:[空格]nMask的博客</li>
</ul>
<h4 id="主题"><a href="#主题" class="headerlink" title="主题"></a>主题</h4><p>访问<a href="http://www.zhihu.com/question/24422335" target="_blank" rel="external">主题列表</a>,获取主题代码。</p>
<p>进入themes目录,进入以下操作:</p>
<ul>
<li><p>下载主题 (以next主题为例)</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">git <span class="built_in">clone</span> https://github.com/iissnan/hexo-theme-next.git(主题的地址)</div></pre></td></tr></table></figure>
</li>
<li><p>打开__config.yml文件,将themes修改为next(下载到的主题文件夹的名字)</p>
</li>
<li>hexo g</li>
<li>hexo d</li>
</ul>
<p>关于hexo-next主题下的一些个性化配置,参考:<a href="http://theme-next.iissnan.com/" target="_blank" rel="external">Next主题配置</a></p>
<h3 id="主题美化"><a href="#主题美化" class="headerlink" title="主题美化"></a>主题美化</h3><h4 id="文章中添加居中模块"><a href="#文章中添加居中模块" class="headerlink" title="文章中添加居中模块"></a>文章中添加居中模块</h4><p>文章Markdown中填写如下:<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line"><blockquote class="blockquote-center">优秀的人,不是不合群,而是他们合群的人里面没有你</blockquote></div></pre></td></tr></table></figure></p>
<h4 id="在文章底部增加版权信息"><a href="#在文章底部增加版权信息" class="headerlink" title="在文章底部增加版权信息"></a>在文章底部增加版权信息</h4><p>在目录 next/layout/_macro/下添加 my-copyright.swig:<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div></pre></td><td class="code"><pre><div class="line">{% <span class="keyword">if</span> page.copyright %}</div><div class="line"><div class=<span class="string">"my_post_copyright"</span>></div><div class="line"> <script src=<span class="string">"//cdn.bootcss.com/clipboard.js/1.5.10/clipboard.min.js"</span>></script></div><div class="line"></div><div class="line"> <!-- JS库 sweetalert 可修改路径 --></div><div class="line"> <script <span class="built_in">type</span>=<span class="string">"text/javascript"</span> src=<span class="string">"http://jslibs.wuxubj.cn/sweetalert_mini/jquery-1.7.1.min.js"</span>></script></div><div class="line"> <script src=<span class="string">"http://jslibs.wuxubj.cn/sweetalert_mini/sweetalert.min.js"</span>></script></div><div class="line"> <link rel=<span class="string">"stylesheet"</span> <span class="built_in">type</span>=<span class="string">"text/css"</span> href=<span class="string">"http://jslibs.wuxubj.cn/sweetalert_mini/sweetalert.mini.css"</span>></div><div class="line"> <p><span>本文标题:</span><a href=<span class="string">"{{ url_for(page.path) }}"</span>>{{ page.title }}</a></p></div><div class="line"> <p><span>文章作者:</span><a href=<span class="string">"/"</span> title=<span class="string">"访问 {{ theme.author }} 的个人博客"</span>>{{ theme.author }}</a></p></div><div class="line"> <p><span>发布时间:</span>{{ page.date.format(<span class="string">"YYYY年MM月DD日 - HH:MM"</span>) }}</p></div><div class="line"> <p><span>最后更新:</span>{{ page.updated.format(<span class="string">"YYYY年MM月DD日 - HH:MM"</span>) }}</p></div><div class="line"> <p><span>原始链接:</span><a href=<span class="string">"{{ url_for(page.path) }}"</span> title=<span class="string">"{{ page.title }}"</span>>{{ page.permalink }}</a></div><div class="line"> <span class=<span class="string">"copy-path"</span> title=<span class="string">"点击复制文章链接"</span>><i class=<span class="string">"fa fa-clipboard"</span> data-clipboard-text=<span class="string">"{{ page.permalink }}"</span> aria-label=<span class="string">"复制成功!"</span>></i></span></div><div class="line"> </p></div><div class="line"> <p><span>许可协议:</span><i class=<span class="string">"fa fa-creative-commons"</span>></i> <a rel=<span class="string">"license"</span> href=<span class="string">"https://creativecommons.org/licenses/by-nc-nd/4.0/"</span> target=<span class="string">"_blank"</span> title=<span class="string">"Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)"</span>>署名-非商业性使用-禁止演绎 4.0 国际</a> 转载请保留原文链接及作者。</p> </div><div class="line"></div></div><div class="line"><script> </div><div class="line"> var clipboard = new Clipboard(<span class="string">'.fa-clipboard'</span>);</div><div class="line"> clipboard.on(<span class="string">'success'</span>, $(<span class="function"><span class="title">function</span></span>(){</div><div class="line"> $(<span class="string">".fa-clipboard"</span>).click(<span class="function"><span class="title">function</span></span>(){</div><div class="line"> swal({ </div><div class="line"> title: <span class="string">""</span>, </div><div class="line"> text: <span class="string">'复制成功'</span>, </div><div class="line"> html: <span class="literal">false</span>,</div><div class="line"> timer: 500, </div><div class="line"> showConfirmButton: <span class="literal">false</span></div><div class="line"> });</div><div class="line"> });</div><div class="line"> })); </div><div class="line"></script></div><div class="line">{% endif %}</div></pre></td></tr></table></figure></p>
<p>在目录next/source/css/_common/components/post/下添加my-post-copyright.styl:<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div></pre></td><td class="code"><pre><div class="line">.my_post_copyright {</div><div class="line"> width: 85%;</div><div class="line"> max-width: 45em;</div><div class="line"> margin: 2.8em auto 0;</div><div class="line"> padding: 0.5em 1.0em;</div><div class="line"> border: 1px solid <span class="comment">#d3d3d3;</span></div><div class="line"> font-size: 0.93rem;</div><div class="line"> line-height: 1.6em;</div><div class="line"> word-break: <span class="built_in">break</span>-all;</div><div class="line"> background: rgba(255,255,255,0.4);</div><div class="line">}</div><div class="line">.my_post_copyright p{margin:0;}</div><div class="line">.my_post_copyright span {</div><div class="line"> display: inline-block;</div><div class="line"> width: 5.2em;</div><div class="line"> color: <span class="comment">#b5b5b5;</span></div><div class="line"> font-weight: bold;</div><div class="line">}</div><div class="line">.my_post_copyright .raw {</div><div class="line"> margin-left: 1em;</div><div class="line"> width: 5em;</div><div class="line">}</div><div class="line">.my_post_copyright a {</div><div class="line"> color: <span class="comment">#808080;</span></div><div class="line"> border-bottom:0;</div><div class="line">}</div><div class="line">.my_post_copyright a:hover {</div><div class="line"> color: <span class="comment">#a3d2a3;</span></div><div class="line"> text-decoration: underline;</div><div class="line">}</div><div class="line">.my_post_copyright:hover .fa-clipboard {</div><div class="line"> color: <span class="comment">#000;</span></div><div class="line">}</div><div class="line">.my_post_copyright .post-url:hover {</div><div class="line"> font-weight: normal;</div><div class="line">}</div><div class="line">.my_post_copyright .copy-path {</div><div class="line"> margin-left: 1em;</div><div class="line"> width: 1em;</div><div class="line"> +<span class="function"><span class="title">mobile</span></span>(){display:none;}</div><div class="line">}</div><div class="line">.my_post_copyright .copy-path:hover {</div><div class="line"> color: <span class="comment">#808080;</span></div><div class="line"> cursor: pointer;</div><div class="line">}</div></pre></td></tr></table></figure></p>
<p>修改next/layout/_macro/post.swig,在代码<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line"><div></div><div class="line"> {% <span class="keyword">if</span> not is_index %}</div><div class="line"> {% include <span class="string">'wechat-subscriber.swig'</span> %}</div><div class="line"> {% endif %}</div><div class="line"></div></div></pre></td></tr></table></figure></p>
<p>之前添加增加如下代码:<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line"><div></div><div class="line"> {% <span class="keyword">if</span> not is_index %}</div><div class="line"> {% include <span class="string">'my-copyright.swig'</span> %}</div><div class="line"> {% endif %}</div><div class="line"></div></div></pre></td></tr></table></figure></p>
<p>修改next/source/css/_common/components/post/post.styl文件,在最后一行增加代码:<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">@import <span class="string">"my-post-copyright"</span></div></pre></td></tr></table></figure></p>
<p>如果要在该博文下面增加版权信息的显示,需要在 Markdown 中增加copyright: true的设置,类似:<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line">---</div><div class="line">title: </div><div class="line">date: </div><div class="line">tags: </div><div class="line">categories: </div><div class="line">copyright: <span class="literal">true</span></div><div class="line">---</div></pre></td></tr></table></figure></p>
<h4 id="自定义hexo-new生成md文件的选项"><a href="#自定义hexo-new生成md文件的选项" class="headerlink" title="自定义hexo new生成md文件的选项"></a>自定义hexo new生成md文件的选项</h4><p>在/scaffolds/post.md文件中添加:<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div></pre></td><td class="code"><pre><div class="line">---</div><div class="line">title: {{ title }}</div><div class="line">date: {{ date }}</div><div class="line">tags:</div><div class="line">categories: </div><div class="line">copyright: <span class="literal">true</span></div><div class="line">permalink: 01</div><div class="line">top: 0</div><div class="line">password:</div><div class="line">---</div></pre></td></tr></table></figure></p>
<h4 id="隐藏网页底部powered-By-Hexo-强力驱动"><a href="#隐藏网页底部powered-By-Hexo-强力驱动" class="headerlink" title="隐藏网页底部powered By Hexo / 强力驱动"></a>隐藏网页底部powered By Hexo / 强力驱动</h4><p>打开themes/next/layout/_partials/footer.swig,使用”<!-- -->”隐藏之间的代码即可,或者直接删除。<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div></pre></td><td class="code"><pre><div class="line"><!--</div><div class="line"><div class=<span class="string">"powered-by"</span>></div><div class="line"> {{ __(<span class="string">'footer.powered'</span>, <span class="string">'<a class="theme-link" rel="external nofollow" href="https://hexo.io">Hexo</a>'</span>) }}</div><div class="line"></div></div><div class="line"></div><div class="line"><div class=<span class="string">"theme-info"</span>></div><div class="line"> {{ __(<span class="string">'footer.theme'</span>) }} -</div><div class="line"> <a class=<span class="string">"theme-link"</span> rel=<span class="string">"external nofollow"</span> href=<span class="string">"https://github.com/iissnan/hexo-theme-next"</span>></div><div class="line"> NexT.{{ theme.scheme }}</div><div class="line"> </a></div><div class="line"></div></div><div class="line">--></div></pre></td></tr></table></figure></p>
<h4 id="文章加密访问"><a href="#文章加密访问" class="headerlink" title="文章加密访问"></a>文章加密访问</h4><p>打开themes->next->layout->_partials->head.swig文件,在meta标签后面插入这样一段代码:<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div></pre></td><td class="code"><pre><div class="line"><script></div><div class="line"> (<span class="function"><span class="title">function</span></span>(){</div><div class="line"> <span class="keyword">if</span>(<span class="string">'{{ page.password }}'</span>){</div><div class="line"> <span class="keyword">if</span> (prompt(<span class="string">'请输入文章密码'</span>) !== <span class="string">'{{ page.password }}'</span>){</div><div class="line"> alert(<span class="string">'密码错误!'</span>);</div><div class="line"> history.back();</div><div class="line"> }</div><div class="line"> }</div><div class="line"> })();</div><div class="line"></script></div></pre></td></tr></table></figure></p>
<p>然后文章中添加:<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">password: nmask</div></pre></td></tr></table></figure></p>
<p>如果password后面为空,则表示不用密码。</p>
<h4 id="博文置顶"><a href="#博文置顶" class="headerlink" title="博文置顶"></a>博文置顶</h4><p>修改 hero-generator-index 插件,把文件:node_modules/hexo-generator-index/lib/generator.js 内的代码替换为:<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div></pre></td><td class="code"><pre><div class="line"><span class="string">'use strict'</span>;</div><div class="line">var pagination = require(<span class="string">'hexo-pagination'</span>);</div><div class="line">module.exports = <span class="keyword">function</span>(locals){</div><div class="line"> var config = this.config;</div><div class="line"> var posts = locals.posts;</div><div class="line"> posts.data = posts.data.sort(<span class="keyword">function</span>(a, b) {</div><div class="line"> <span class="keyword">if</span>(a.top && b.top) { // 两篇文章top都有定义</div><div class="line"> <span class="keyword">if</span>(a.top == b.top) <span class="built_in">return</span> b.date - a.date; // 若top值一样则按照文章日期降序排</div><div class="line"> <span class="keyword">else</span> <span class="built_in">return</span> b.top - a.top; // 否则按照top值降序排</div><div class="line"> }</div><div class="line"> <span class="keyword">else</span> <span class="keyword">if</span>(a.top && !b.top) { // 以下是只有一篇文章top有定义,那么将有top的排在前面(这里用异或操作居然不行233)</div><div class="line"> <span class="built_in">return</span> -1;</div><div class="line"> }</div><div class="line"> <span class="keyword">else</span> <span class="keyword">if</span>(!a.top && b.top) {</div><div class="line"> <span class="built_in">return</span> 1;</div><div class="line"> }</div><div class="line"> <span class="keyword">else</span> <span class="built_in">return</span> b.date - a.date; // 都没定义按照文章日期降序排</div><div class="line"> });</div><div class="line"> var paginationDir = config.pagination_dir || <span class="string">'page'</span>;</div><div class="line"> <span class="built_in">return</span> pagination(<span class="string">''</span>, posts, {</div><div class="line"> perPage: config.index_generator.per_page,</div><div class="line"> layout: [<span class="string">'index'</span>, <span class="string">'archive'</span>],</div><div class="line"> format: paginationDir + <span class="string">'/%d/'</span>,</div><div class="line"> data: {</div><div class="line"> __index: <span class="literal">true</span></div><div class="line"> }</div><div class="line"> });</div><div class="line">};</div></pre></td></tr></table></figure></p>
<p>在文章中添加 top 值,数值越大文章越靠前,如:<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">---</div><div class="line">......</div><div class="line">copyright: <span class="literal">true</span></div><div class="line">top: 100</div><div class="line">---</div></pre></td></tr></table></figure></p>
<p>默认不设置则为0,数值相同时按时间排序。</p>
<h4 id="添加顶部加载条"><a href="#添加顶部加载条" class="headerlink" title="添加顶部加载条"></a>添加顶部加载条</h4><p>打开/themes/next/layout/_partials/head.swig文件,在maximum-scale=1”/>后添加如下代码:<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line"><script src=<span class="string">"//cdn.bootcss.com/pace/1.0.2/pace.min.js"</span>></script></div><div class="line"><link href=<span class="string">"//cdn.bootcss.com/pace/1.0.2/themes/pink/pace-theme-flash.css"</span> rel=<span class="string">"stylesheet"</span>></div></pre></td></tr></table></figure></p>
<p>但是,默认的是粉色的,要改变颜色可以在/themes/next/layout/_partials/head.swig文件中添加如下代码(接在刚才link的后面)<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div></pre></td><td class="code"><pre><div class="line"><style></div><div class="line"> .pace .pace-progress {</div><div class="line"> background: <span class="comment">#1E92FB; /*进度条颜色*/</span></div><div class="line"> height: 3px;</div><div class="line"> }</div><div class="line"> .pace .pace-progress-inner {</div><div class="line"> box-shadow: 0 0 10px <span class="comment">#1E92FB, 0 0 5px #1E92FB; /*阴影颜色*/</span></div><div class="line"> }</div><div class="line"> .pace .pace-activity {</div><div class="line"> border-top-color: <span class="comment">#1E92FB; /*上边框颜色*/</span></div><div class="line"> border-left-color: <span class="comment">#1E92FB; /*左边框颜色*/</span></div><div class="line"> }</div><div class="line"></style></div></pre></td></tr></table></figure></p>
<h4 id="添加热度"><a href="#添加热度" class="headerlink" title="添加热度"></a>添加热度</h4><p>next主题集成leanCloud,打开/themes/next/layout/_macro/post.swig<br>在”leancloud-visitors-count”>标签后面添加<span>℃</span>。<br>然后打开,/themes/next/languages/zh-Hans.yml,将visitors内容改为<em>热度</em>即可。</p>
<h4 id="主页文章添加阴影效果"><a href="#主页文章添加阴影效果" class="headerlink" title="主页文章添加阴影效果"></a>主页文章添加阴影效果</h4><p>打开\themes\next\source\css_custom\custom.styl,向里面加入:<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div></pre></td><td class="code"><pre><div class="line">// 主页文章添加阴影效果</div><div class="line"> .post {</div><div class="line"> margin-top: 60px;</div><div class="line"> margin-bottom: 60px;</div><div class="line"> padding: 25px;</div><div class="line"> -webkit-box-shadow: 0 0 5px rgba(202, 203, 203, .5);</div><div class="line"> -moz-box-shadow: 0 0 5px rgba(202, 203, 204, .5);</div><div class="line"> }</div></pre></td></tr></table></figure></p>
<h4 id="修改文章底部的那个带-号的标签"><a href="#修改文章底部的那个带-号的标签" class="headerlink" title="修改文章底部的那个带#号的标签"></a>修改文章底部的那个带#号的标签</h4><p>修改模板/themes/next/layout/_macro/post.swig,搜索 rel=”tag”>#,将 # 换成<i class="fa fa-tag"></i></p>
<h4 id="鼠标点击小红心的设置"><a href="#鼠标点击小红心的设置" class="headerlink" title="鼠标点击小红心的设置"></a>鼠标点击小红心的设置</h4><p>将 <a href="https://github.com/Neveryu/Neveryu.github.io/blob/master/js/src/love.js" target="_blank" rel="external">love.js</a> 文件添加到 \themes\next\source\js\src 文件目录下。<br>找到 \themes\next\layout_layout.swing 文件, 在文件的后面, 标签之前 添加以下代码:<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line"><!-- 页面点击小红心 --></div><div class="line"><script <span class="built_in">type</span>=<span class="string">"text/javascript"</span> src=<span class="string">"/js/src/love.js"</span>></script></div></pre></td></tr></table></figure></p>
<h4 id="背景的设置"><a href="#背景的设置" class="headerlink" title="背景的设置"></a>背景的设置</h4><p>将 <a href="https://github.com/Neveryu/Neveryu.github.io/blob/master/js/src/particle.js" target="_blank" rel="external">particle.js</a> 文件添加到 \themes\next\source\js\src 文件目录下。<br>找到 \themes\next\layout_layout.swing 文件, 在文件的后面,标签之前 添加以下代码:<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line"><!-- 背景动画 --></div><div class="line"><script <span class="built_in">type</span>=<span class="string">"text/javascript"</span> src=<span class="string">"/js/src/particle.js"</span>></script></div></pre></td></tr></table></figure></p>
<h4 id="修改文章内链接文本样式"><a href="#修改文章内链接文本样式" class="headerlink" title="修改文章内链接文本样式"></a>修改文章内链接文本样式</h4><p>将链接文本设置为蓝色,鼠标划过时文字颜色加深,并显示下划线。<br>找到文件 themes\next\source\css\_custom\custom.styl ,添加如下 css 样式:<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div></pre></td><td class="code"><pre><div class="line">.post-body p a {</div><div class="line"> color: <span class="comment">#0593d3;</span></div><div class="line"> border-bottom: none;</div><div class="line"> &:hover {</div><div class="line"> color: <span class="comment">#0477ab;</span></div><div class="line"> text-decoration: underline;</div><div class="line"> }</div><div class="line">}</div></pre></td></tr></table></figure></p>
<h4 id="博文压缩"><a href="#博文压缩" class="headerlink" title="博文压缩"></a>博文压缩</h4><p>在站点的根目录下执行以下命令:<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">$ npm install gulp -g</div><div class="line">$ npm install gulp-minify-css gulp-uglify gulp-htmlmin gulp-htmlclean gulp --save</div></pre></td></tr></table></figure></p>
<p>在博客根目录下新建 gulpfile.js ,并填入以下内容:<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div></pre></td><td class="code"><pre><div class="line">var gulp = require(<span class="string">'gulp'</span>);</div><div class="line">var minifycss = require(<span class="string">'gulp-minify-css'</span>);</div><div class="line">var uglify = require(<span class="string">'gulp-uglify'</span>);</div><div class="line">var htmlmin = require(<span class="string">'gulp-htmlmin'</span>);</div><div class="line">var htmlclean = require(<span class="string">'gulp-htmlclean'</span>);</div><div class="line">// 压缩 public 目录 css</div><div class="line">gulp.task(<span class="string">'minify-css'</span>, <span class="function"><span class="title">function</span></span>() {</div><div class="line"> <span class="built_in">return</span> gulp.src(<span class="string">'./public/**/*.css'</span>)</div><div class="line"> .pipe(minifycss())</div><div class="line"> .pipe(gulp.dest(<span class="string">'./public'</span>));</div><div class="line">});</div><div class="line">// 压缩 public 目录 html</div><div class="line">gulp.task(<span class="string">'minify-html'</span>, <span class="function"><span class="title">function</span></span>() {</div><div class="line"> <span class="built_in">return</span> gulp.src(<span class="string">'./public/**/*.html'</span>)</div><div class="line"> .pipe(htmlclean())</div><div class="line"> .pipe(htmlmin({</div><div class="line"> removeComments: <span class="literal">true</span>,</div><div class="line"> minifyJS: <span class="literal">true</span>,</div><div class="line"> minifyCSS: <span class="literal">true</span>,</div><div class="line"> minifyURLs: <span class="literal">true</span>,</div><div class="line"> }))</div><div class="line"> .pipe(gulp.dest(<span class="string">'./public'</span>))</div><div class="line">});</div><div class="line">// 压缩 public/js 目录 js</div><div class="line">gulp.task(<span class="string">'minify-js'</span>, <span class="function"><span class="title">function</span></span>() {</div><div class="line"> <span class="built_in">return</span> gulp.src(<span class="string">'./public/**/*.js'</span>)</div><div class="line"> .pipe(uglify())</div><div class="line"> .pipe(gulp.dest(<span class="string">'./public'</span>));</div><div class="line">});</div><div class="line">// 执行 gulp 命令时执行的任务</div><div class="line">gulp.task(<span class="string">'default'</span>, [</div><div class="line"> <span class="string">'minify-html'</span>,<span class="string">'minify-css'</span>,<span class="string">'minify-js'</span></div><div class="line">]);</div></pre></td></tr></table></figure></p>
<p>生成博文是执行 hexo g && gulp 就会根据 gulpfile.js 中的配置,对 public 目录中的静态资源文件进行压缩。</p>
<h4 id="增加阅读排行统计页面"><a href="#增加阅读排行统计页面" class="headerlink" title="增加阅读排行统计页面"></a>增加阅读排行统计页面</h4><p>首先我们可以使用leancloud来统计页面阅读数量,以及储存这些信息,然后通过leancloud提供的api编写js脚本来获取阅读数量信息,并展示在页面上。<br>首先新建一个page页面,hexo new page “”,然后编辑此.md文件,写下:<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div></pre></td><td class="code"><pre><div class="line"><script src=<span class="string">"https://cdn1.lncld.net/static/js/av-core-mini-0.6.1.js"</span>></script></div><div class="line"></div><div class="line"><script>AV.initialize(<span class="string">""</span>, <span class="string">""</span>);</script> //需要写上leancloud的key</div><div class="line"></div><div class="line"><script <span class="built_in">type</span>=<span class="string">"text/javascript"</span>></div><div class="line"> var time=0</div><div class="line"> var title=<span class="string">""</span></div><div class="line"> var url=<span class="string">""</span></div><div class="line"> var query = new AV.Query(<span class="string">'Counter'</span>);//表名</div><div class="line"> query.notEqualTo(<span class="string">'id'</span>,0); //id不为0的结果</div><div class="line"> query.descending(<span class="string">'time'</span>); //结果按阅读次数降序排序</div><div class="line"> query.limit(20); //最终只返回10条结果</div><div class="line"> query.find().<span class="keyword">then</span>(<span class="keyword">function</span> (todo) {</div><div class="line"> <span class="keyword">for</span> (var i=0;i<10;i++){ </div><div class="line"> var result=todo[i].attributes;</div><div class="line"> time=result.time; //阅读次数</div><div class="line"> title=result.title; //文章标题</div><div class="line"> url=result.url; //文章url</div><div class="line"> var content=<span class="string">"<p>"</span>+<span class="string">"<font color='#0477ab'>"</span>+<span class="string">"【阅读次数:"</span>+time+<span class="string">"】"</span>+<span class="string">"<a href='"</span>+<span class="string">"http://thief.one"</span>+url+<span class="string">"'>"</span>+title+<span class="string">"</font>"</span>+<span class="string">"</a>"</span>+<span class="string">"</p>"</span>;</div><div class="line"> // document.write(<span class="string">"<a href='"</span>+<span class="string">"http://thief.one/"</span>+url+<span class="string">"'>"</span>+title+<span class="string">"</a>"</span>+<span class="string">" Readtimes:"</span>+time+<span class="string">"<br>"</span>);</div><div class="line"> document.getElementById(<span class="string">"heheda"</span>).innerHTML+=content</div><div class="line"> }</div><div class="line"> }, <span class="keyword">function</span> (error) {</div><div class="line"> console.log(<span class="string">"error"</span>);</div><div class="line"> });</div><div class="line"></script></div></pre></td></tr></table></figure></p>
<p>最终的效果查看:<a href="http://thief.one/count" target="_blank" rel="external">http://thief.one/count</a></p>
<h4 id="多说替换成来必力评论"><a href="#多说替换成来必力评论" class="headerlink" title="多说替换成来必力评论"></a>多说替换成来必力评论</h4><p>更新于@2017年5月18日<br>多说已经宣布下线了,因此我找了个来必力评论系统来替换,以下是替换的教程,教程内容来自:<a href="https://blog.smoker.cc/web/add-comments-livere-for-hexo-theme-next.html" target="_blank" rel="external">https://blog.smoker.cc/web/add-comments-livere-for-hexo-theme-next.html</a></p>
<p>来必力评价<br>优点:界面美观<br>缺点:不支持数据导入,加载慢</p>
<p>首先在 _config.yml 文件中添加如下配置:<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">livere_uid: your uid</div></pre></td></tr></table></figure></p>
<p>其中 livere_uid 即注册来必力获取到的 uid。<br>在 layout/_scripts/third-party/comments/ 目录中添加 livere.swig,文件内容如下:<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div></pre></td><td class="code"><pre><div class="line">{% <span class="keyword">if</span> not (theme.duoshuo and theme.duoshuo.shortname) and not theme.duoshuo_shortname and not theme.disqus_shortname and not theme.hypercomments_id and not theme.gentie_productKey %}</div><div class="line"> {% <span class="keyword">if</span> theme.livere_uid %}</div><div class="line"> <script <span class="built_in">type</span>=<span class="string">"text/javascript"</span>></div><div class="line"> (<span class="keyword">function</span>(d, s) {</div><div class="line"> var j, e = d.getElementsByTagName(s)[0];</div><div class="line"> <span class="keyword">if</span> (typeof LivereTower === <span class="string">'function'</span>) { <span class="built_in">return</span>; }</div><div class="line"> j = d.createElement(s);</div><div class="line"> j.src = <span class="string">'https://cdn-city.livere.com/js/embed.dist.js'</span>;</div><div class="line"> j.async = <span class="literal">true</span>;</div><div class="line"> e.parentNode.insertBefore(j, e);</div><div class="line"> })(document, <span class="string">'script'</span>);</div><div class="line"> </script></div><div class="line"> {% endif %}</div><div class="line">{% endif %}</div></pre></td></tr></table></figure></p>
<p>优先使用其他评论插件,如果其他评论插件没有开启,且LiveRe评论插件配置开启了,则使用LiveRe。其中脚本代码为上一步管理页面中获取到的。在layout/_scripts/third-party/comments.swig文件中追加:<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">{% include <span class="string">'./comments/livere.swig'</span> %}</div></pre></td></tr></table></figure></p>
<p>引入 LiveRe 评论插件。<br>最后,在 layout/_partials/comments.swig 文件中条件最后追加LiveRe插件是否引用的判断逻辑:<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">{% elseif theme.livere_uid %}</div><div class="line"> <div id=<span class="string">"lv-container"</span> data-id=<span class="string">"city"</span> data-uid=<span class="string">"{{ theme.livere_uid }}"</span>></div></div><div class="line">{% endif %}</div></pre></td></tr></table></figure></p>
<p>最后打开博客瞧瞧吧!</p>
<h4 id="多说替换成网易云跟贴"><a href="#多说替换成网易云跟贴" class="headerlink" title="多说替换成网易云跟贴"></a>多说替换成网易云跟贴</h4><p>最好的方法就是更新next主题,因为最新版本的主题已经支持这几种评论。<br>如果不想更新主题,则往下看:</p>
<p>网易云跟贴评价:<br>性能稳定,功能中规中矩,支持数据导入</p>
<p>首先在 _config.yml 文件中添加如下配置:<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">gentie_productKey: <span class="comment">#your-gentie-product-key</span></div></pre></td></tr></table></figure></p>
<p>其中 gentie_productKey 即注册网易云跟贴获取到的key。<br>在 layout/_scripts/third-party/comments/ 目录中添加 gentie.swig,文件内容如下:<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div></pre></td><td class="code"><pre><div class="line">{% <span class="keyword">if</span> not (theme.duoshuo and theme.duoshuo.shortname) and not theme.duoshuo_shortname and not theme.disqus_shortname and not theme.hypercomments_id %}</div><div class="line"></div><div class="line"> {% <span class="keyword">if</span> theme.gentie_productKey %}</div><div class="line"> {% <span class="built_in">set</span> gentie_productKey = theme.gentie_productKey %}</div><div class="line"> <script></div><div class="line"> var cloudTieConfig = {</div><div class="line"> url: document.location.href, </div><div class="line"> sourceId: <span class="string">""</span>,</div><div class="line"> productKey: <span class="string">"{{gentie_productKey}}"</span>,</div><div class="line"> target: <span class="string">"cloud-tie-wrapper"</span></div><div class="line"> };</div><div class="line"> </script></div><div class="line"> <script src=<span class="string">"https://img1.ws.126.net/f2e/tie/yun/sdk/loader.js"</span>></script></div><div class="line"> {% endif %}</div><div class="line"></div><div class="line">{% endif %}</div></pre></td></tr></table></figure></p>
<p>在layout/_scripts/third-party/comments.swig文件中追加:<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">{% include <span class="string">'./comments/gentie.swig'</span> %}</div></pre></td></tr></table></figure></p>
<p>最后,在 layout/_partials/comments.swig 文件中条件最后追加网易云跟帖插件引用的判断逻辑:<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">{% elseif theme.gentie_productKey %}</div><div class="line"> <div id=<span class="string">"cloud-tie-wrapper"</span> class=<span class="string">"cloud-tie-wrapper"</span>></div><div class="line"> </div></div></pre></td></tr></table></figure></p>
<h3 id="报错解决"><a href="#报错解决" class="headerlink" title="报错解决"></a>报错解决</h3><h4 id="(一)Deployer-not-found-git"><a href="#(一)Deployer-not-found-git" class="headerlink" title="(一)Deployer not found: git"></a>(一)Deployer not found: git</h4><p>当编辑__config.yml文件,将type: git设置完成后,运行hexo g 报错:<em>git not found</em><br>解决方案:可以在MyBlog目录下运行: <em>npm install hexo-deployer-git –save</em>。</p>
<h4 id="(二)permission-denied"><a href="#(二)permission-denied" class="headerlink" title="(二)permission denied"></a>(二)permission denied</h4><p>当执行: hexo deploy 报错时,把__config.yml中的github连接形式从ssh改成http。</p>
<h4 id="(三)当在themes目录下载主题时,报错。"><a href="#(三)当在themes目录下载主题时,报错。" class="headerlink" title="(三)当在themes目录下载主题时,报错。"></a>(三)当在themes目录下载主题时,报错。</h4><p>将该目录只读属性取消。</p>
<h4 id="(四)genrnate-报错"><a href="#(四)genrnate-报错" class="headerlink" title="(四)genrnate 报错"></a>(四)genrnate 报错</h4><p>检查_config.yml配置中,键值对冒号后面是否已经预留了一个半角空格。</p>
<h4 id="(五)ERROR-Plugin-load-failed-hexo-generator-feed"><a href="#(五)ERROR-Plugin-load-failed-hexo-generator-feed" class="headerlink" title="(五)ERROR Plugin load failed: hexo-generator-feed"></a>(五)ERROR Plugin load failed: hexo-generator-feed</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">npm install hexo-generator-feed</div><div class="line">npm install hexo-generator-feed --save</div></pre></td></tr></table></figure>
<h4 id="(六)fatal-The-remote-end-hung-up-unexpectedly"><a href="#(六)fatal-The-remote-end-hung-up-unexpectedly" class="headerlink" title="(六)fatal: The remote end hung up unexpectedly"></a>(六)fatal: The remote end hung up unexpectedly</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">$ git config https.postBuffer 524288000</div><div class="line">$ git config http.postBuffer 524288000</div><div class="line">$ git config ssh.postBuffer 524288000</div></pre></td></tr></table></figure>
<h4 id="(七)hero-d推送的内容有问题"><a href="#(七)hero-d推送的内容有问题" class="headerlink" title="(七)hero d推送的内容有问题"></a>(七)hero d推送的内容有问题</h4><p> 首先检查下.deploy_git文件夹下的.git文件是否存在,此.git文件指定了hexo d时推送public文件夹,而不是所有的内容。如果此.git文件不存在,则会出现推送内容错误。<br> 用npm install hexo-deployer-git –save生成的.deploy_git不包含.git文件,因此正确的做法是.deploy_git文件夹也需要备份,然后再用npm install hexo-deployer-git –save更新一下其内容即可。</p>
<h3 id="异地同步博客内容"><a href="#异地同步博客内容" class="headerlink" title="异地同步博客内容"></a>异地同步博客内容</h3><p> 现在电脑已经很普及了,因为一般来说我们都是公司一台电脑,家里一台电脑,那么如何将两台电脑上博客的内容同步内,即两台电脑上都可以编辑更新博客?<br>要解决这个问题,首先我们要清楚我们博客文件的组成:</p>
<ul>
<li>node_modules</li>
<li>public</li>
<li>scaffolds</li>
<li>source</li>
<li>themes</li>
<li>_config_yml</li>
<li>db.json</li>
<li>package.json</li>
<li>.deploy_git</li>
</ul>
<p> 以上为利用hexo生成的博客全部内容,那么当我们执行hexo d时,正真被推送到github上的又有哪些内容呢?<br> 我们可以看下github上的tengzhangchao.github.io项目,发现里面只有Public目录下的内容。也就是说,我们博客上呈现的内容,其实就是public下的文件内容。那么这个Pulic目录是怎么生成的呢?<br> 一开始hexo init的时候是没有public目录的,而当我们运行hexo g命令时,public目录被生成了,换句话说hexo g命令就是用来生成博客文件的(会根据_config.yml,source目录文件以及themes目录下文件生成)。同样当我们运行hexo clean命令时,public目录被删除了。<br> 好了,既然我们知道了决定博客显示内容的只有一个Public目录,而public目录又是可以动态生成的,那么其实我们只要在不同电脑上同步可以生成Public目录的文件即可。</p>
<p>以下文件以及目录是必须要同步的:</p>
<ul>
<li>source</li>
<li>themes</li>
<li>_config.yml</li>
<li>db.json</li>
<li>package.json</li>
<li>.deploy_git</li>
</ul>
<p> 同步的方式有很多种,可以每次更新后都备份到一个地址。我采用github去备份,也就是新建一个项目用来存放以上文件,每次更新后推送到github上,用作备份同步。<br> 同步完必须的文件后,怎么再其他电脑上也可以更新博客呢?<br> 前提假设我们现在配置了一台新电脑,里面没有安装任何有关博客的东西,那么我们开始吧:</p>
<ul>
<li>下载node.js并安装(官网下载安装),默认会安装npm。</li>
<li>下载安装git(官网下载安装)</li>
<li>下载安装hexo。方法:打开cmd 运行<em>npm install -g hexo</em>(要翻墙) </li>
<li>新建一个文件夹,如MyBlog</li>
<li>进入该文件夹内,右击运行git,输入:<em>hexo init</em>(生成hexo模板,可能要翻墙)</li>
</ul>
<p> 我们重复了一开始搭建博客的步骤,重新生成了一个新的模板,这个模板中包含了hexo生成的一些文件。</p>
<ul>
<li>git clone 我们备份的项目,生成一个文件夹,如:MyBlogData</li>
<li>将MyBlog里面的node_modules、scaffolds文件夹复制到MyBlogData里面。</li>
</ul>
<p> 做完这些,从表面上看,两台电脑上MyBlogData目录下的文件应该都是一样的了。那么我们运行hexo g<br>hexo d试试,如果会报错,则往下看。</p>
<ul>
<li>这是因为.deploy_git没有同步,在MyBlogData目录内运行:<em>npm install hexo-deployer-git –save</em>后再次推送即可</li>
</ul>
<p> 总结流程:当我们每次更新MyBlog内容后,先利用hexo将public推送到github,然后再将其余必须同步的文件利用git推送到github。</p>
<h3 id="SEO优化"><a href="#SEO优化" class="headerlink" title="SEO优化"></a>SEO优化</h3><p>seo优化对于网站是否能被搜索引擎快速收录有很大帮助,因此适当做一些seo还是有必要的,以下内容参考:<a href="https://lancelot_lewis.coding.me/2016/08/16/blog/Hexo-NexT-SEO/" target="_blank" rel="external">https://lancelot_lewis.coding.me/2016/08/16/blog/Hexo-NexT-SEO/</a></p>
<h4 id="添加sitemap文件"><a href="#添加sitemap文件" class="headerlink" title="添加sitemap文件"></a>添加sitemap文件</h4><p>安装以下2个插件,然后重启hexo后,网站根目录(source)下会生成sitemap.xml与baidusitemap.xml文件,搜索引擎在爬取时会参照文件中的url去收录。<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">npm install hexo-generator-sitemap --save-dev</div><div class="line">hexo d -g</div><div class="line">npm install hexo-generator-baidu-sitemap --save-dev</div><div class="line">hexo d -g</div></pre></td></tr></table></figure></p>
<h4 id="添加robots-txt"><a href="#添加robots-txt" class="headerlink" title="添加robots.txt"></a>添加robots.txt</h4><p>新建robots.txt文件,添加以下文件内容,把robots.txt放在hexo站点的source文件下。<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div></pre></td><td class="code"><pre><div class="line">User-agent: * Allow: /</div><div class="line">Allow: /archives/</div><div class="line">Disallow: /vendors/</div><div class="line">Disallow: /js/</div><div class="line">Disallow: /css/</div><div class="line">Disallow: /fonts/</div><div class="line">Disallow: /vendors/</div><div class="line">Disallow: /fancybox/</div><div class="line"></div><div class="line">Sitemap: http://thief.one/sitemap.xml</div><div class="line">Sitemap: http://thief.one/baidusitemap.xml</div></pre></td></tr></table></figure></p>
<h4 id="首页title的优化"><a href="#首页title的优化" class="headerlink" title="首页title的优化"></a>首页title的优化</h4><p>更改index.swig文件,文件路径是your-hexo-site\themes\next\layout,将下面代码<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">{% block title %} {{ config.title }} {% endblock %}</div></pre></td></tr></table></figure></p>
<p>改成<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">{% block title %} {{ config.title }} - {{ theme.description }} {% endblock</div></pre></td></tr></table></figure></p>
<p>观察首页title就是标题+描述了。</p>
<h3 id="MakeDown语法"><a href="#MakeDown语法" class="headerlink" title="MakeDown语法"></a>MakeDown语法</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div></pre></td><td class="code"><pre><div class="line">[hexo](http://www.baidu.com) 表示超链接</div><div class="line"><span class="comment">##大标题</span></div><div class="line"><span class="comment">###小标题</span></div><div class="line"><!-- more --></div><div class="line"><!-- 标签别名 --></div><div class="line">{% cq %}blah blah blah{% endcq %}</div><div class="line">空格 中文全角空格表示</div><div class="line">---</div><div class="line">文章标题</div><div class="line">---</div><div class="line">>内容 区块引用</div><div class="line">*1</div><div class="line">*2</div><div class="line">*3</div><div class="line">列表</div><div class="line">*内容* 表示强调内容</div><div class="line">![Alt text](/path/to/img.jpg) 图片</div><div class="line">![](/upload_image/20161012/1.png)</div></pre></td></tr></table></figure>
<p>详细Markdown语法请参考:<a href="http://www.appinn.com/markdown/" target="_blank" rel="external">MakeDown语法</a></p>
<h3 id="参考文章"><a href="#参考文章" class="headerlink" title="参考文章"></a>参考文章</h3><p><a href="http://www.jianshu.com/p/f054333ac9e6" target="_blank" rel="external">http://www.jianshu.com/p/f054333ac9e6</a><br><a href="https://neveryu.github.io/2016/09/30/hexo-next-two/" target="_blank" rel="external">https://neveryu.github.io/2016/09/30/hexo-next-two/</a></p>
<p><em>提醒:在更新博客内容时,最好先在本地调试完毕后(hexo server),再推送到github上。</em></p>]]></content>
<categories>
<category> 技术研究 </category>
</categories>
<tags>
<tag> hexo </tag>
<tag> 博客搭建 </tag>
</tags>
</entry>
</search>