-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.xml
2588 lines (2566 loc) · 187 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
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="utf-8"?>
<search>
<entry>
<title>博客折腾笔记①:hexo 部署与自定义</title>
<url>/posts/c54c0f26.html</url>
<content><![CDATA[<p>今天重新部署了一次 Hexo,记录一下过程。<br>
方案:静态页面部署在 gitpage,hexo 文件备份到 github 私有库</p>
<blockquote>
<p><em><strong>注意:</strong></em><br>
<strong>博客配置文件</strong>:<code>/_config.yml</code> (位于博客根目录下)<br>
<strong>主题配置文件</strong>:<code>/themes/ThemeName/_config.yml</code> (位于各主题文件夹下)<br>
请注意区分二者</p>
</blockquote>
<h1 id="zhun-bei-gong-zuo">准备工作</h1>
<p>github 上建一个 xxxx.github.io 的公开仓库和一个私有库<br>
其中 xxxx 是你的 github 用户名,xxxx.github.io 是博客域名</p>
<p><a href="https://hexo.io/zh-cn/">hexo 官网</a><br>
下载安装 <a href="http://nodejs.org/">Node.js</a>、<a href="http://git-scm.com/">Git</a> ,git 配置好信息<br>
然后 Cmd/Powershell 执行</p>
<pre><code>npm install -g hexo-cli
</code></pre>
<span id="more"></span>
<h1 id="chu-shi-hua-hexo">初始化 hexo</h1>
<p>先建好博客的文件夹<br>
然后命令行</p>
<pre><code>hexo init <folder>
cd <folder>
npm install
</code></pre>
<p>然后修改文件下的_config.yml 参数</p>
<blockquote>
<p>参数详见 <a href="https://hexo.io/zh-cn/docs/configuration">https://hexo.io/zh-cn/docs/configuration</a><br>
记得修改域名</p>
</blockquote>
<p>修改_config.yml 的 deploy 部分</p>
<pre><code># Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
type: git
repo: https://github.com/yyyy/xxxx.github.io.git
branch: master
</code></pre>
<p>修改完后执行</p>
<pre><code>hexo g
hexo d
</code></pre>
<p>稍等一会,应该就能访问到了</p>
<h1 id="ji-ben-diao-zheng">基本调整</h1>
<h2 id="设置备份"><a class="header-anchor" href="#设置备份"></a>设置备份</h2>
<p>安装插件 <code>hexo-git-backup</code> 把 hexo 文件备份到建好的私有库</p>
<pre><code>npm install hexo-git-backup --save
</code></pre>
<p>安装后在_config.yml 加入以下内容,填好私有库的信息</p>
<pre><code>backup:
type: git
theme: landscape,next
repository:
origin: https://github.com/yyyy/xxxx.github.io.git,branchName
</code></pre>
<p>theme 里填写你要同步的主题名<br>
这里预先填了个 next,稍后再进行主题的安装</p>
<p>有需要的话,还可以编辑根目录下的<code>.gitinore</code> 来选择备份的文件,这里默认已经配置好不用修改了</p>
<figure class="highlight plaintext"><table><tbody><tr><td class="code"><pre><span class="line">.DS_Store</span><br><span class="line">Thumbs.db</span><br><span class="line">db.json</span><br><span class="line">*.log</span><br><span class="line">node_modules/</span><br><span class="line">public/</span><br><span class="line">.deploy*/</span><br></pre></td></tr></tbody></table></figure>
<blockquote>
<p><strong>附录</strong>:Hexo 的源文件说明:<br>
1、<code>_config.yml</code> 站点的配置文件,需要拷贝;<br>
2、<code>themes/</code> 主题文件夹,需要拷贝;<br>
3、<code>source</code> 博客文章的.md 文件,需要拷贝;<br>
4、<code>scaffolds/</code> 文章的模板,需要拷贝;<br>
5、<code>package.json</code> 安装包的名称,需要拷贝;<br>
6、<code>.gitignore</code> 限定在 push 时哪些文件可以忽略,需要拷贝;<br>
7、<code>.git/</code> 主题和站点都有,标志这是一个 git 项目,不需要拷贝;<br>
8、<code>node_modules/</code> 是安装包的目录,在执行 npm install 的时候会重新生成,不需要拷贝;<br>
9、<code>public</code> 是 hexo g 生成的静态网页,不需要拷贝;<br>
10、<code>.deploy_git</code> 同上,hexo g 也会生成,不需要拷贝;<br>
11、<code>db.json</code> 文件,不需要拷贝。</p>
<p>引用自:<a href="https://www.jianshu.com/p/baab042849023">https://www.jianshu.com/p/baab042849023</a></p>
</blockquote>
<h3 id="备份操作"><a class="header-anchor" href="#备份操作"></a>备份操作</h3>
<pre><code>hexo backup
</code></pre>
<p>或者</p>
<pre><code>hexo b
</code></pre>
<p>进行备份</p>
<h3 id="还原操作"><a class="header-anchor" href="#还原操作"></a>还原操作</h3>
<ol>
<li>
<p>安装 git、node.js</p>
</li>
<li>
<p>使用 <code>git clone</code> 将备份库克隆到本地</p>
</li>
<li>
<p><code>cd</code> 进博客根目录,依次执行</p>
<figure class="highlight plaintext"><table><tbody><tr><td class="code"><pre><span class="line">$ npm install hexo-cli -g</span><br><span class="line">$ npm install</span><br><span class="line">$ npm install hexo-deployer-git</span><br></pre></td></tr></tbody></table></figure>
</li>
</ol>
<h3 id="排错指南"><a class="header-anchor" href="#排错指南"></a><strong>排错指南</strong></h3>
<ol>
<li>尝试提权 /sudo</li>
<li> 出现类似 </li>
</ol>
<pre><code>events.js:167
throw er; // Unhandled 'error' event
^
Error: spawn rm ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:232:19)
at onErrorNT (internal/child_process.js:407:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:238:12)
at onErrorNT (internal/child_process.js:407:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
</code></pre>
<p>的错误时可以尝试删掉主题文件夹中的.git 隐藏文件夹试试</p>
<blockquote>
<p>参考 <a href="https://github.com/coneycode/hexo-git-backup/issues/27">备份报错 #27</a></p>
</blockquote>
<h2 id="设置分类,建立模板"><a class="header-anchor" href="#设置分类,建立模板"></a>设置分类,建立模板</h2>
<p>略</p>
<h2 id="更换hexo-renderer-markdown-it渲染器"><a class="header-anchor" href="#更换hexo-renderer-markdown-it渲染器"></a>更换 <code>hexo-renderer-markdown-it</code> 渲染器</h2>
<pre><code>npm un hexo-renderer-marked --save
npm i hexo-renderer-markdown-it --save
</code></pre>
<p>然后再安装几个相关插件</p>
<pre><code>npm install markdown-it-emoji markdown-it-checkbox markdown-it-katex
</code></pre>
<p>安装后复制下列内容到_config.yml</p>
<pre><code># Markdown-it config
## Docs: https://github.com/celsomiranda/hexo-renderer-markdown-it/wiki
markdown:
render:
html: true
xhtmlOut: false
breaks: true
linkify: true
typographer: true
quotes: '“”‘’'
plugins:
- markdown-it-abbr
- markdown-it-footnote
- markdown-it-ins
- markdown-it-sub
- markdown-it-sup
- markdown-it-emoji
- markdown-it-checkbox
</code></pre>
<p>安装后新增的功能:</p>
<ul>
<li>emoji:<br>
😄</li>
</ul>
<figure class="highlight plaintext"><table><tbody><tr><td class="code"><pre><span class="line">:smile:</span><br></pre></td></tr></tbody></table></figure>
<ul>
<li><s>KateX</s>(存在显示 bug,已弃用,目前实现方式见后)</li>
</ul>
<p><mjx-container class="MathJax" jax="SVG"><svg style="vertical-align: -0.566ex" xmlns="http://www.w3.org/2000/svg" width="18.882ex" height="2.646ex" role="img" focusable="false" viewBox="0 -919.5 8345.9 1169.5"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><g data-mml-node="math"><g data-mml-node="msqrt"><g transform="translate(853, 0)"><g data-mml-node="mn"><path data-c="33" d="M127 463Q100 463 85 480T69 524Q69 579 117 622T233 665Q268 665 277 664Q351 652 390 611T430 522Q430 470 396 421T302 350L299 348Q299 347 308 345T337 336T375 315Q457 262 457 175Q457 96 395 37T238 -22Q158 -22 100 21T42 130Q42 158 60 175T105 193Q133 193 151 175T169 130Q169 119 166 110T159 94T148 82T136 74T126 70T118 67L114 66Q165 21 238 21Q293 21 321 74Q338 107 338 175V195Q338 290 274 322Q259 328 213 329L171 330L168 332Q166 335 166 348Q166 366 174 366Q202 366 232 371Q266 376 294 413T322 525V533Q322 590 287 612Q265 626 240 626Q208 626 181 615T143 592T132 580H135Q138 579 143 578T153 573T165 566T175 555T183 540T186 520Q186 498 172 481T127 463Z"></path></g><g data-mml-node="mi" transform="translate(500, 0)"><path data-c="1D465" d="M52 289Q59 331 106 386T222 442Q257 442 286 424T329 379Q371 442 430 442Q467 442 494 420T522 361Q522 332 508 314T481 292T458 288Q439 288 427 299T415 328Q415 374 465 391Q454 404 425 404Q412 404 406 402Q368 386 350 336Q290 115 290 78Q290 50 306 38T341 26Q378 26 414 59T463 140Q466 150 469 151T485 153H489Q504 153 504 145Q504 144 502 134Q486 77 440 33T333 -11Q263 -11 227 52Q186 -10 133 -10H127Q78 -10 57 16T35 71Q35 103 54 123T99 143Q142 143 142 101Q142 81 130 66T107 46T94 41L91 40Q91 39 97 36T113 29T132 26Q168 26 194 71Q203 87 217 139T245 247T261 313Q266 340 266 352Q266 380 251 392T217 404Q177 404 142 372T93 290Q91 281 88 280T72 278H58Q52 284 52 289Z"></path></g><g data-mml-node="mo" transform="translate(1294.2, 0)"><path data-c="2212" d="M84 237T84 250T98 270H679Q694 262 694 250T679 230H98Q84 237 84 250Z"></path></g><g data-mml-node="mn" transform="translate(2294.4, 0)"><path data-c="31" d="M213 578L200 573Q186 568 160 563T102 556H83V602H102Q149 604 189 617T245 641T273 663Q275 666 285 666Q294 666 302 660V361L303 61Q310 54 315 52T339 48T401 46H427V0H416Q395 3 257 3Q121 3 100 0H88V46H114Q136 46 152 46T177 47T193 50T201 52T207 57T213 61V578Z"></path></g></g><g data-mml-node="mo" transform="translate(0, 59.5)"><path data-c="221A" d="M95 178Q89 178 81 186T72 200T103 230T169 280T207 309Q209 311 212 311H213Q219 311 227 294T281 177Q300 134 312 108L397 -77Q398 -77 501 136T707 565T814 786Q820 800 834 800Q841 800 846 794T853 782V776L620 293L385 -193Q381 -200 366 -200Q357 -200 354 -197Q352 -195 256 15L160 225L144 214Q129 202 113 190T95 178Z"></path></g><rect width="2794.4" height="60" x="853" y="799.5"></rect></g><g data-mml-node="mo" transform="translate(3869.7, 0)"><path data-c="2B" d="M56 237T56 250T70 270H369V420L370 570Q380 583 389 583Q402 583 409 568V270H707Q722 262 722 250T707 230H409V-68Q401 -82 391 -82H389H387Q375 -82 369 -68V230H70Q56 237 56 250Z"></path></g><g data-mml-node="mo" transform="translate(4869.9, 0)"><path data-c="28" d="M94 250Q94 319 104 381T127 488T164 576T202 643T244 695T277 729T302 750H315H319Q333 750 333 741Q333 738 316 720T275 667T226 581T184 443T167 250T184 58T225 -81T274 -167T316 -220T333 -241Q333 -250 318 -250H315H302L274 -226Q180 -141 137 -14T94 250Z"></path></g><g data-mml-node="mn" transform="translate(5258.9, 0)"><path data-c="31" d="M213 578L200 573Q186 568 160 563T102 556H83V602H102Q149 604 189 617T245 641T273 663Q275 666 285 666Q294 666 302 660V361L303 61Q310 54 315 52T339 48T401 46H427V0H416Q395 3 257 3Q121 3 100 0H88V46H114Q136 46 152 46T177 47T193 50T201 52T207 57T213 61V578Z"></path></g><g data-mml-node="mo" transform="translate(5981.1, 0)"><path data-c="2B" d="M56 237T56 250T70 270H369V420L370 570Q380 583 389 583Q402 583 409 568V270H707Q722 262 722 250T707 230H409V-68Q401 -82 391 -82H389H387Q375 -82 369 -68V230H70Q56 237 56 250Z"></path></g><g data-mml-node="mi" transform="translate(6981.3, 0)"><path data-c="1D465" d="M52 289Q59 331 106 386T222 442Q257 442 286 424T329 379Q371 442 430 442Q467 442 494 420T522 361Q522 332 508 314T481 292T458 288Q439 288 427 299T415 328Q415 374 465 391Q454 404 425 404Q412 404 406 402Q368 386 350 336Q290 115 290 78Q290 50 306 38T341 26Q378 26 414 59T463 140Q466 150 469 151T485 153H489Q504 153 504 145Q504 144 502 134Q486 77 440 33T333 -11Q263 -11 227 52Q186 -10 133 -10H127Q78 -10 57 16T35 71Q35 103 54 123T99 143Q142 143 142 101Q142 81 130 66T107 46T94 41L91 40Q91 39 97 36T113 29T132 26Q168 26 194 71Q203 87 217 139T245 247T261 313Q266 340 266 352Q266 380 251 392T217 404Q177 404 142 372T93 290Q91 281 88 280T72 278H58Q52 284 52 289Z"></path></g><g data-mml-node="msup" transform="translate(7553.3, 0)"><g data-mml-node="mo"><path data-c="29" d="M60 749L64 750Q69 750 74 750H86L114 726Q208 641 251 514T294 250Q294 182 284 119T261 12T224 -76T186 -143T145 -194T113 -227T90 -246Q87 -249 86 -250H74Q66 -250 63 -250T58 -247T55 -238Q56 -237 66 -225Q221 -64 221 250T66 725Q56 737 55 738Q55 746 60 749Z"></path></g><g data-mml-node="mn" transform="translate(389, 363) scale(0.707)"><path data-c="32" d="M109 429Q82 429 66 447T50 491Q50 562 103 614T235 666Q326 666 387 610T449 465Q449 422 429 383T381 315T301 241Q265 210 201 149L142 93L218 92Q375 92 385 97Q392 99 409 186V189H449V186Q448 183 436 95T421 3V0H50V19V31Q50 38 56 46T86 81Q115 113 136 137Q145 147 170 174T204 211T233 244T261 278T284 308T305 340T320 369T333 401T340 431T343 464Q343 527 309 573T212 619Q179 619 154 602T119 569T109 550Q109 549 114 549Q132 549 151 535T170 489Q170 464 154 447T109 429Z"></path></g></g></g></g></svg></mjx-container></p>
<figure class="highlight plaintext"><table><tbody><tr><td class="code"><pre><span class="line">$\sqrt{3x-1}+(1+x)^2$</span><br></pre></td></tr></tbody></table></figure>
<ul>
<li>Checkbox 选框,TO-DO 用</li>
<li><input type="checkbox" id="checkbox0"><label for="checkbox0">无</label></li>
<li><input type="checkbox" id="checkbox1" checked="true"><label for="checkbox1">有 </label></li>
</ul>
<figure class="highlight plaintext"><table><tbody><tr><td class="code"><pre><span class="line">- [ ] 无</span><br><span class="line">- [x] 有</span><br></pre></td></tr></tbody></table></figure>
<ul>
<li>注脚<br>
1234[^1]</li>
</ul>
<figure class="highlight plaintext"><table><tbody><tr><td class="code"><pre><span class="line">1234[^1]</span><br><span class="line"> [1]: 注脚演示。</span><br></pre></td></tr></tbody></table></figure>
<p>[1]: 注脚演示。</p>
<ul>
<li>荧光标记<br>
<mark>荧光 </mark></li>
</ul>
<figure class="highlight plaintext"><table><tbody><tr><td class="code"><pre><span class="line">==荧光==</span><br></pre></td></tr></tbody></table></figure>
<ul>
<li>上标、下标<br>
19<sup>th</sup><br>
H<sub>2</sub>O</li>
</ul>
<figure class="highlight plaintext"><table><tbody><tr><td class="code"><pre><span class="line">19^th^</span><br><span class="line">H~2~O</span><br></pre></td></tr></tbody></table></figure>
<ul>
<li><a href="https://markdown-it.github.io/">以及其他……</a></li>
</ul>
<h1 id="zhu-ti-an-zhuang-pei-zhi">主题安装配置</h1>
<p>这里主题选择的是 <a href="https://github.com/theme-next/hexo-theme-next">next</a></p>
<pre><code>$ cd hexo
$ git clone https://github.com/theme-next/hexo-theme-next themes/next
</code></pre>
<p>下载后前往博客根目录的_config.yml 切换主题</p>
<pre><code># Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: next
</code></pre>
<p>随后打开编辑 /themes/next/_config.yml 进行主题配置</p>
<blockquote>
<p>官方文档:<a href="https://theme-next.org/docs/">https://theme-next.org/docs/</a></p>
</blockquote>
<h2 id="基本设置"><a class="header-anchor" href="#基本设置"></a>基本设置</h2>
<h3 id="切换风格"><a class="header-anchor" href="#切换风格"></a>切换风格</h3>
<p>官方提供了 Muse、Mist、Pisces、Gemini 四种布局风格,这里选择 Gemini</p>
<pre><code># Schemes
#scheme: Muse
#scheme: Mist
#scheme: Pisces
scheme: Gemini
</code></pre>
<h3 id="开启夜间模式适配"><a class="header-anchor" href="#开启夜间模式适配"></a>开启夜间模式适配</h3>
<pre><code>darkmode: true
</code></pre>
<h3 id="切换语言"><a class="header-anchor" href="#切换语言"></a>切换语言</h3>
<pre><code>language: zh-CN
</code></pre>
<h3 id="设置站点图标"><a class="header-anchor" href="#设置站点图标"></a>设置站点图标</h3>
<pre><code>favicon:
small: /images/favicon-16x16-next.png
medium: /images/favicon-32x32-next.png
apple_touch_icon: /images/apple-touch-icon-next.png
safari_pinned_tab: /images/logo.svg
</code></pre>
<h3 id="备案展示"><a class="header-anchor" href="#备案展示"></a>备案展示</h3>
<pre><code># Beian ICP and gongan information for Chinese users. See: http://www.beian.miit.gov.cn, http://www.beian.gov.cn
beian:
enable: false
icp:
# The digit in the num of gongan beian.
gongan_id:
# The full num of gongan beian.
gongan_num:
# The icon for gongan beian. See: http://www.beian.gov.cn/portal/download
gongan_icon_url:
</code></pre>
<h3 id="CC标识"><a class="header-anchor" href="#CC标识"></a>CC 标识</h3>
<p>这里我选择的是 by-nc-sa</p>
<pre><code># Creative Commons 4.0 International License.
# See: https://creativecommons.org/share-your-work/licensing-types-examples
# Available values of license: by | by-nc | by-nc-nd | by-nc-sa | by-nd | by-sa | zero
# You can set a language value if you prefer a translated version of CC license, e.g. deed.zh
# CC licenses are available in 39 languages, you can find the specific and correct abbreviation you need on https://creativecommons.org
creative_commons:
license: by-nc-sa
sidebar: true
post: true
language: deed.zh
</code></pre>
<h3 id="设置菜单栏"><a class="header-anchor" href="#设置菜单栏"></a>设置菜单栏</h3>
<pre><code># Usage: `Key: /link/ || icon`
# Key is the name of menu item. If the translation for this item is available, the translated text will be loaded, otherwise the Key name will be used. Key is case-senstive.
# Value before `||` delimiter is the target link, value after `||` delimiter is the name of Font Awesome icon.
# When running the site in a subdirectory (e.g. yoursite.com/blog), remove the leading slash from link value (/archives -> archives).
# External url should start with http:// or https://
menu:
home: / || home
tags: /tags/ || tags
categories: /categories/ || th
archives: /archives/ || archive
#schedule: /schedule/ || calendar
#sitemap: /sitemap.xml || sitemap
#commonweal: /404/ || heartbeat
about: /about/ || user
# Enable / Disable menu icons / item badges.
menu_settings:
icons: true
badges: false
</code></pre>
<h2 id="设置侧边栏"><a class="header-anchor" href="#设置侧边栏"></a>设置侧边栏</h2>
<pre><code># Sidebar Settings
# See: https://theme-next.org/docs/theme-settings/sidebar
</code></pre>
<h3 id="侧边栏大小位置"><a class="header-anchor" href="#侧边栏大小位置"></a>侧边栏大小位置</h3>
<pre><code>sidebar:
# Sidebar Position.
position: left
#position: right
# Manual define the sidebar width. If commented, will be default for:
# Muse | Mist: 320
# Pisces | Gemini: 240
#width: 300
# Sidebar padding in pixels.
padding: 18
# Sidebar offset from top menubar in pixels (only for Pisces | Gemini).
offset: 12
# Enable sidebar on narrow view (only for Muse | Mist).
onmobile: false
</code></pre>
<h3 id="头像"><a class="header-anchor" href="#头像"></a>头像</h3>
<pre><code># Sidebar Avatar
avatar:
# Replace the default image and set the url here.
url: /images/avatar.png
# If true, the avatar will be dispalyed in circle.
rounded: false
# If true, the avatar will be rotated with the cursor.
rotated: false
# Posts / Categories / Tags in sidebar.
site_state: true
</code></pre>
<h3 id="友情链接"><a class="header-anchor" href="#友情链接"></a>友情链接</h3>
<pre><code># Social Links
# Usage: `Key: permalink || icon`
# Key is the link label showing to end users.
# Value before `||` delimiter is the target permalink, value after `||` delimiter is the name of Font Awesome icon.
social:
GitHub: https://github.com/xxxx || github
E-Mail: mailto:xxxx@xxxxx.com || envelope
RSS: /atom.xml || rss
#Weibo: https://weibo.com/yourname || weibo
#Google: https://plus.google.com/yourname || google
#Twitter: https://twitter.com/yourname || twitter
#FB Page: https://www.facebook.com/yourname || facebook
#StackOverflow: https://stackoverflow.com/yourname || stack-overflow
#YouTube: https://youtube.com/yourname || youtube
#Instagram: https://instagram.com/yourname || instagram
#Skype: skype:yourname?call|chat || skype
social_icons:
enable: true
icons_only: true
transition: true
# Blog rolls
links_settings:
icon: link
title: Links
# Available values: block | inline
layout: block
links:
#Title: http://yoursite.com
# Table of Contents in the Sidebar
# Front-matter variable (unsupport wrap expand_all).
</code></pre>
<h3 id="TOC"><a class="header-anchor" href="#TOC"></a>TOC</h3>
<pre><code># Table of Contents in the Sidebar
# Front-matter variable (unsupport wrap expand_all).
toc:
enable: true
# Automatically add list number to toc.
number: true
# If true, all words will placed on next lines if header width longer then sidebar width.
wrap: false
# If true, all level of TOC in a post will be displayed, rather than the activated part of it.
expand_all: false
# Maximum heading depth of generated toc.
max_depth: 6
</code></pre>
<h3 id="即时交谈"><a class="header-anchor" href="#即时交谈"></a>即时交谈</h3>
<pre><code># A button to open designated chat widget in sidebar.
# Firstly, you need enable the chat service you want to activate its sidebar button.
chat:
enable: false
#service: chatra
#service: tidio
icon: comment # Icon name in Font Awesome, set false to disable icon.
text: Chat # Button text, change it as you wish.
</code></pre>
<h2 id="帖子页面"><a class="header-anchor" href="#帖子页面"></a>帖子页面</h2>
<pre><code># ---------------------------------------------------------------
# Post Settings
# See: https://theme-next.org/docs/theme-settings/posts
# ---------------------------------------------------------------
</code></pre>
<p>在文章中使用 <code><!-- more --></code> 来使文章在首页不完全展示</p>
<pre><code># Automatically excerpt description in homepage as preamble text.
excerpt_description: true
# Read more button
# If true, the read more button will be displayed in excerpt section.
read_more_btn: true
</code></pre>
<h3 id="文章信息"><a class="header-anchor" href="#文章信息"></a>文章信息</h3>
<pre><code># Post meta display settings
post_meta:
item_text: true
created_at: true
updated_at:
enable: true
another_day: true
categories: true
</code></pre>
<p>安装插件 <code>hexo-symbols-count-time</code> 来显示字数信息和阅读时间预计</p>
<pre><code>$ npm install hexo-symbols-count-time
</code></pre>
<p>然后修改博客根目录_config.yml, 添加</p>
<pre><code>symbols_count_time:
symbols: true
time: true
total_symbols: true
total_time: false
exclude_codeblock: false
awl: 2
wpm: 300
suffix: "mins."
</code></pre>
<blockquote>
<p><strong>Note for Chinese users:</strong> because in Chinese language average word length about ~1.5 and if you at most cases write posts in Chinese (without mixed English), recommended to set awl to 2 and wpm to 300.<br>
But if you usualy mix your posts with English, awl to 4 and wpm to 275 will be nice.<br>
然后修改主题的_config.yml</p>
</blockquote>
<pre><code># Post wordcount display settings
# Dependencies: https://github.com/theme-next/hexo-symbols-count-time
symbols_count_time:
separated_meta: true
item_text_post: true
item_text_total: false
</code></pre>
<h3 id="底部标签样式"><a class="header-anchor" href="#底部标签样式"></a>底部标签样式</h3>
<pre><code># Use icon instead of the symbol # to indicate the tag at the bottom of the post
tag_icon: true
</code></pre>
<h3 id="打赏、文末信息"><a class="header-anchor" href="#打赏、文末信息"></a>打赏、文末信息</h3>
<pre><code># Reward (Donate)
# Front-matter variable (unsupport animation).
reward_settings:
# If true, reward will be displayed in every article by default.
enable: false
animation: false
#comment: Donate comment here.
reward:
#wechatpay: /images/wechatpay.png
#alipay: /images/alipay.png
#paypal: /images/paypal.png
#bitcoin: /images/bitcoin.png
# Subscribe through Telegram Channel, Twitter, etc.
# Usage: `Key: permalink || icon` (Font Awesome)
follow_me:
#Twitter: https://twitter.com/username || twitter
#Telegram: https://t.me/channel_name || telegram
#WeChat: /images/wechat_channel.jpg || wechat
#RSS: /atom.xml || rss
</code></pre>
<h3 id="相关主题推荐"><a class="header-anchor" href="#相关主题推荐"></a>相关主题推荐</h3>
<p>安装 <code>hexo-related-popular-posts</code></p>
<pre><code>npm install hexo-related-popular-posts
</code></pre>
<p>修改主题的配置文件</p>
<pre><code># Related popular posts
# Dependencies: https://github.com/tea3/hexo-related-popular-posts
related_posts:
enable: true
title: # Custom header, leave empty to use the default one
display_in_home: false
params:
maxCount: 5
#PPMixingRate: 0.0
#isDate: false
#isImage: false
#isExcerpt: false
</code></pre>
<h3 id="标签页面"><a class="header-anchor" href="#标签页面"></a>标签页面</h3>
<p>先创建标签页面</p>
<pre><code>hexo new page Tags
</code></pre>
<p>然后打开 /source/tags/index.md,编辑成</p>
<pre><code>---
title: Tags
date: 2020-03-19 16:21:51
type: tags
comments: false
---
</code></pre>
<p>然后修改主题的对应配置文件</p>
<pre><code># TagCloud settings for tags page.
tagcloud:
# All values below are same as default, change them by yourself.
min: 12 # Minimun font size in px
max: 30 # Maxium font size in px
start: "#ccc" # Start color (hex, rgba, hsla or color keywords)
end: "#111" # End color (hex, rgba, hsla or color keywords)
amount: 200 # Amount of tags, change it if you have more than 200 tags
</code></pre>
<h3 id="分类页面"><a class="header-anchor" href="#分类页面"></a>分类页面</h3>
<p>同上</p>
<pre><code>hexo new page Categories
</code></pre>
<p>编辑生成的 <code>index.md</code></p>
<pre><code>---
title: Categories
date: 2020-03-19 16:19:06
type: categories
comments: false
---
</code></pre>
<h3 id="404界面"><a class="header-anchor" href="#404界面"></a>404 界面</h3>
<p>把 404.html 放在 /source/ 下,然后修改博客根目录的配置文件</p>
<pre><code>skip_render: "404.html"
</code></pre>
<h3 id="谷歌日历-(未配置)"><a class="header-anchor" href="#谷歌日历-(未配置)"></a>谷歌日历 (未配置)</h3>
<pre><code># Google Calendar
# Share your recent schedule to others via calendar page.
calendar:
calendar_id: <required> # Your Google account E-Mail
api_key: <required>
orderBy: startTime
offsetMax: 24 # Time Range
offsetMin: 4 # Time Range
showDeleted: false
singleEvents: true
maxResults: 250
</code></pre>
<h3 id="安卓上chrome的沉浸颜色?(不是很明白)"><a class="header-anchor" href="#安卓上chrome的沉浸颜色?(不是很明白)"></a>安卓上 chrome 的沉浸颜色?(不是很明白)</h3>
<pre><code># Android Chrome header panel color ($brand-bg / $headband-bg => $black-deep).
android_chrome_color: "#222"
</code></pre>
<h3 id="自定义logo,在网站标题菜单栏上面的位置"><a class="header-anchor" href="#自定义logo,在网站标题菜单栏上面的位置"></a>自定义 logo,在网站标题菜单栏上面的位置</h3>
<pre><code># Custom Logo (Do not support scheme Mist)
custom_logo: #/uploads/custom-logo.jpg
</code></pre>
<h3 id="代码块的风格"><a class="header-anchor" href="#代码块的风格"></a>代码块的风格</h3>
<p>配色方案预览:<a href="https://github.com/chriskempson/tomorrow-theme">https://github.com/chriskempson/tomorrow-theme</a></p>
<pre><code>codeblock:
# Code Highlight theme
# Available values: normal | night | night eighties | night blue | night bright | solarized | solarized dark | galactic
# See: https://github.com/chriskempson/tomorrow-theme
highlight_theme: night
# Add copy button on codeblock
copy_button:
enable: true
# Show text copy result.
show_result: true
# Available values: default | flat | mac
style: flat
</code></pre>
<h3 id="返回顶部样式"><a class="header-anchor" href="#返回顶部样式"></a>返回顶部样式</h3>
<pre><code>back2top:
enable: true
# Back to top in sidebar.
sidebar: false
# Scroll percent label in b2t button.
scrollpercent: true
# Reading progress bar
reading_progress:
enable: false
# Available values: top | bottom
position: top
color: "#37c6c0"
height: 3px
</code></pre>
<h3 id="阅读进度记忆、书签"><a class="header-anchor" href="#阅读进度记忆、书签"></a>阅读进度记忆、书签</h3>
<pre><code># Bookmark Support
bookmark:
enable: true
# Customize the color of the bookmark.
color: "#222"
# If auto, save the reading progress when closing the page or clicking the bookmark-icon.
# If manual, only save it by clicking the bookmark-icon.
save: manual
</code></pre>
<h3 id="右上角来Github叉我啊图标"><a class="header-anchor" href="#右上角来Github叉我啊图标"></a>右上角<s>来 Github 叉我啊</s>图标</h3>
<pre><code># `Follow me on GitHub` banner in the top-right corner.
github_banner:
enable: false
permalink: https://github.com/yourname
title: Follow me on GitHub
</code></pre>
<h3 id="字体设置"><a class="header-anchor" href="#字体设置"></a>字体设置</h3>
<p>详见 <a href="https://theme-next.org/docs/theme-settings/#Fonts-Customization">https://theme-next.org/docs/theme-settings/#Fonts-Customization</a><br>
这里用的是默认,只添加了中科大的源,其他的就不展示了</p>
<pre><code># Uri of fonts host, e.g. https://fonts.googleapis.com (Default).
host: //fonts.lug.ustc.edu.cn
</code></pre>
<h3 id="SEO相关"><a class="header-anchor" href="#SEO相关"></a>SEO 相关</h3>
<p>禁用百度移动页面转换</p>
<pre><code># Disable Baidu transformation on mobile devices.
disable_baidu_transformation: true
</code></pre>
<p>其他没有设置,略</p>
<h3 id="高级设置"><a class="header-anchor" href="#高级设置"></a>高级设置</h3>
<h3 id="RSS订阅"><a class="header-anchor" href="#RSS订阅"></a>RSS 订阅</h3>
<pre><code>$ npm install hexo-generator-feed
</code></pre>
<p>然后在博客配置文件中添加:</p>
<pre><code>feed:
type: atom
path: atom.xml
limit: 20
hub:
content: true
#content_limit: 140
content_limit_delim: ' '
order_by: -date
icon: icon.png
autodiscovery: true
template:
</code></pre>
<p>参数参考文档:<a href="https://github.com/hexojs/hexo-generator-feed">https://github.com/hexojs/hexo-generator-feed</a></p>
<h3 id="MathJax-数学公式渲染"><a class="header-anchor" href="#MathJax-数学公式渲染"></a>MathJax 数学公式渲染</h3>
<p>参考:<a href="https://github.com/stevenjoezhang/hexo-filter-mathjax">https://github.com/stevenjoezhang/hexo-filter-mathjax</a></p>
<pre><code>$ npm install hexo-filter-mathjax
</code></pre>
<p>博客配置文件加上</p>
<pre><code>mathjax:
tags: none # or 'ams' or 'all'
single_dollars: true # enable single dollar signs as in-line math delimiters
cjk_width: 0.9 # relative CJK char width
normal_width: 0.6 # relative normal (monospace) width
</code></pre>
<p>排错指南:如果出现无法渲染页面的情况,重新安装 <code>hexo-renderer-markdown-it</code> 即可</p>
<blockquote>
<p><em><strong>注意:</strong></em></p>
<ol>
<li>注意符号冲突,如 <code>$</code> 前加 <code>\</code> 来避免冲突</li>
<li>需要渲染数学公式,请先在文章开头 font-matter 中加入 <code>mathjax: true</code><br>
eg:</li>
</ol>
<figure class="highlight plaintext"><table><tbody><tr><td class="code"><pre><span class="line"><!-- This post will render the Math Equations --></span><br><span class="line"> ---</span><br><span class="line"> title: Will Render Math</span><br><span class="line"> mathjax: true </span><br><span class="line"> ---</span><br></pre></td></tr></tbody></table></figure>
</blockquote>
<h3 id="pjax"><a class="header-anchor" href="#pjax"></a>pjax</h3>
<p>采用 CDN 方式安装<br>
先修改</p>
<pre><code>pjax: true
</code></pre>
<p>然后修改下方</p>
<pre><code>vendors:
...
pjax: //cdn.jsdelivr.net/gh/theme-next/theme-next-pjax@0/pjax.min.js
</code></pre>
<h3 id="FancyBox"><a class="header-anchor" href="#FancyBox"></a>FancyBox</h3>
<p>同上,先</p>
<pre><code>fancybox: true
</code></pre>
<p>然后</p>
<pre><code>vendors:
...
jquery: //cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js
fancybox: //cdn.jsdelivr.net/npm/fancybox@3/dist/js/jquery.fancybox.pack.js
fancybox_css: //cdn.jsdelivr.net/npm/fancybox@3/dist/css/jquery.fancybox.min.css
...
</code></pre>
<h3 id="Lazyload-图片懒加载"><a class="header-anchor" href="#Lazyload-图片懒加载"></a>Lazyload 图片懒加载</h3>
<p>同上,先</p>
<pre><code>lazyload: true
</code></pre>
<p>然后</p>
<pre><code>vendors:
...
lazyload: //cdn.jsdelivr.net/npm/lozad@1/dist/lozad.min.js
...
</code></pre>
<h3 id="Pangu-Autospace-中英文自动空格分离-(未配置)"><a class="header-anchor" href="#Pangu-Autospace-中英文自动空格分离-(未配置)"></a>Pangu Autospace 中英文自动空格分离 (未配置)</h3>
<p><a href="https://theme-next.org/docs/third-party-services/external-libraries#Pangu-Autospace">https://theme-next.org/docs/third-party-services/external-libraries#Pangu-Autospace</a></p>
<h3 id="Quicklink-(与pajx冲突,未配置)"><a class="header-anchor" href="#Quicklink-(与pajx冲突,未配置)"></a>Quicklink (与 pajx 冲突,未配置)</h3>
<p><a href="https://theme-next.org/docs/third-party-services/external-libraries#Quicklink">https://theme-next.org/docs/third-party-services/external-libraries#Quicklink</a></p>
<h3 id="Animation-Effect-过度动画设置(未配置)"><a class="header-anchor" href="#Animation-Effect-过度动画设置(未配置)"></a>Animation Effect 过度动画设置(未配置)</h3>
<p><a href="https://theme-next.org/docs/third-party-services/external-libraries#Animation-Effect">https://theme-next.org/docs/third-party-services/external-libraries#Animation-Effect</a></p>
<h3 id="Progress-Bar-网页加载进度条动画"><a class="header-anchor" href="#Progress-Bar-网页加载进度条动画"></a>Progress Bar 网页加载进度条动画</h3>
<p>同上,先</p>
<pre><code>pace:
enable: true
</code></pre>
<p>然后配置 css</p>
<pre><code>vendors:
...
pace: //cdn.jsdelivr.net/npm/pace-js@1/pace.min.js
pace_css: //cdn.jsdelivr.net/npm/pace-js@1/themes/black/pace-theme-minimal.css
...
</code></pre>
<p>上方<code> pace_css</code> 中可以设置颜色(修改 black)<br>
可选效果一览:<a href="https://github.hubspot.com/pace/docs/welcome/">https://github.hubspot.com/pace/docs/welcome/</a><br>
可选颜色:<a href="https://www.jsdelivr.com/package/npm/pace-js?path=themes">https://www.jsdelivr.com/package/npm/pace-js?path=themes</a></p>
<h3 id="Valine-评论系统"><a class="header-anchor" href="#Valine-评论系统"></a>Valine 评论系统</h3>
<p>这里使用 <a href="https://valine.js.org/">Valine</a><br>
先注册登录 <a href="https://leancloud.app/">Leanclub 国际站</a>(需要验证手机号),然后参考 https://theme-next.org/docs/third-party-services/comments#Valine-China</p>
<blockquote>
<p><em><strong>注意:</strong></em> 中国站需要实名验证,且网站似乎还要已备案才能用</p>
</blockquote>
<h3 id="LeanCloud-访问数据统计"><a class="header-anchor" href="#LeanCloud-访问数据统计"></a>LeanCloud 访问数据统计</h3>
<p><a href="https://github.com/theme-next/hexo-theme-next/blob/master/docs/zh-CN/LEANCLOUD-COUNTER-SECURITY.md">https://github.com/theme-next/hexo-theme-next/blob/master/docs/zh-CN/LEANCLOUD-COUNTER-SECURITY.md</a></p>
<blockquote>
<p><em><strong>注意:</strong></em> 涉及域名,更换域名时注意修改!</p>
</blockquote>
<h3 id="Local-Search-本地搜索"><a class="header-anchor" href="#Local-Search-本地搜索"></a>Local Search 本地搜索</h3>
<pre><code>$ npm install hexo-generator-searchdb
</code></pre>
<p>然后编辑博客配置文件,加入</p>
<pre><code>search:
path: search.xml
field: post
format: html
limit: 10000
</code></pre>
<p>再编辑主题配置文件</p>
<pre><code># Local Search
# Dependencies: https://github.com/theme-next/hexo-generator-searchdb
local_search:
enable: true
# If auto, trigger search by changing input.
# If manual, trigger search by pressing enter key or search button.
trigger: auto
# Show top n results per article, show all results by setting to -1
top_n_per_article: 1
# Unescape html strings to the readable one.
unescape: false
# Preload the search data when the pag
preload: false
</code></pre>
<h3 id="特殊标签"><a class="header-anchor" href="#特殊标签"></a>特殊标签</h3>
<p>使用文档:<a href="https://hexo.io/zh-cn/docs/tag-plugins.html">https://hexo.io/zh-cn/docs/tag-plugins.html</a><br>
这里仅提供示例</p>
<h4 id="引言"><a class="header-anchor" href="#引言"></a>引言</h4>
<blockquote class="blockquote-center">
<p>Elegant in code, simple in core</p>
</blockquote>
<blockquote><p>Every interaction is both precious and an opportunity to delight.</p>
<footer><strong>Seth Godin</strong><cite><a href="http://sethgodin.typepad.com/seths_blog/2009/07/welcome-to-island-marketing.html">Welcome to Island Marketing</a></cite></footer></blockquote>
<blockquote><p>Do not just seek happiness for yourself. Seek happiness for all. Through kindness. Through mercy.</p>
<footer><strong>David Levithan</strong><cite>Wide Awake</cite></footer></blockquote>
<h4 id="Note"><a class="header-anchor" href="#Note"></a>Note</h4>
<p>文档:<a href="https://theme-next.org/docs/tag-plugins/note">https://theme-next.org/docs/tag-plugins/note</a></p>
<div class="note "><h4 id="Header"><a class="header-anchor" href="#Header"></a>Header</h4>
<p>(without define class style)</p>
</div>
<div class="note primary"><h4 id="Primary-Header"><a class="header-anchor" href="#Primary-Header"></a>Primary Header</h4>
<p><strong>Welcome</strong> to <a href="https://hexo.io">Hexo!</a></p>
</div>
<div class="note default"><h4 id="Lists-in-note"><a class="header-anchor" href="#Lists-in-note"></a>Lists in note</h4>
<ul>
<li>ul</li>
<li>ul
<ul>
<li>ul</li>
<li>ul</li>
</ul>
</li>
<li>ul</li>
</ul>
<ol>
<li>ol</li>
<li>ol</li>
<li>ol</li>
<li>ol</li>
<li>ol</li>
</ol>
</div>
<h4 id="Tabs"><a class="header-anchor" href="#Tabs"></a>Tabs</h4>
<p>文档:<a href="https://theme-next.org/docs/tag-plugins/tabs">https://theme-next.org/docs/tag-plugins/tabs</a><br>
<s>我真的不懂啊</s></p>
<div class="tabs" id="first-unique-name"><ul class="nav-tabs"><li class="tab active"><a href="#first-unique-name-1">First unique name 1</a></li><li class="tab"><a href="#first-unique-name-2">First unique name 2</a></li><li class="tab"><a href="#first-unique-name-3">First unique name 3</a></li></ul><div class="tab-content"><div class="tab-pane active" id="first-unique-name-1"><p><strong>This is Tab 1.</strong></p></div><div class="tab-pane" id="first-unique-name-2"><p><strong>This is Tab 2.</strong></p></div><div class="tab-pane" id="first-unique-name-3"><p><strong>This is Tab 3.</strong></p></div></div></div>
<h4 id="PDF"><a class="header-anchor" href="#PDF"></a>PDF</h4>
<p>文档:<a href="https://theme-next.org/docs/tag-plugins/pdf">https://theme-next.org/docs/tag-plugins/pdf</a></p>
<div class="pdf-container" data-target="/test.pdf" data-height="600px"></div>
<h3 id="Mermaid-流程图"><a class="header-anchor" href="#Mermaid-流程图"></a>Mermaid 流程图</h3>
<p>文档:<a href="https://theme-next.org/docs/tag-plugins/mermaid">https://theme-next.org/docs/tag-plugins/mermaid</a></p>
<p><s>其他官方文档有的就自己看去吧</s></p>
]]></content>
<categories>
<category>站点日志</category>
</categories>
<tags>
<tag>hexo</tag>
</tags>
</entry>
<entry>
<title>博客折腾笔记②:hexo 的优化</title>
<url>/posts/3a4e373e.html</url>
<content><![CDATA[<h1 id="wen-zhang-yong-jiu-lian-jie-wei-yi-hua">文章永久链接唯一化</h1>
<p>为解决 hexo 默认设置下改变源文件名或使用中文标题带来的文章链接问题,这里使用 <code>hexo-abbrlink</code> 插件来解决问题</p>
<figure class="highlight nginx"><table><tbody><tr><td class="code"><pre><span class="line"><span class="attribute">npm</span> install hexo-abbrlink --save</span><br></pre></td></tr></tbody></table></figure>
<span id="more"></span>
<p>然后更改博客配置文件<code>_config.yml</code>, 这里我改成</p>
<figure class="highlight yaml"><table><tbody><tr><td class="code"><pre><span class="line"><span class="attr">permalink:</span> <span class="string">:posts/:year/:abbrlink/</span></span><br></pre></td></tr></tbody></table></figure>
<p>还可以设置永久链接的生成算法,在博客配置文件中加入</p>
<figure class="highlight yaml"><table><tbody><tr><td class="code"><pre><span class="line"><span class="attr">abbrlink:</span></span><br><span class="line"> <span class="attr">alg:</span> <span class="string">crc32</span> <span class="comment"># support crc16(default) and crc32</span></span><br><span class="line"> <span class="attr">rep:</span> <span class="string">hex</span> <span class="comment"># support dec(default) and hex</span></span><br></pre></td></tr></tbody></table></figure>
<p>不同算法的生成效果:</p>
<figure class="highlight plaintext"><table><tbody><tr><td class="code"><pre><span class="line">crc16 & hex</span><br><span class="line">https://post.zz173.com/posts/66c8.html</span><br><span class="line">crc16 & dec</span><br><span class="line">https://post.zz173.com/posts/65535.html</span><br><span class="line">crc32 & hex</span><br><span class="line">https://post.zz173.com/posts/8ddf18fb.html</span><br><span class="line">crc32 & dec</span><br><span class="line">https://post.zz173.com/posts/1690090958.html</span><br></pre></td></tr></tbody></table></figure>
<p>一些知识补充:</p>
<blockquote>
<blockquote>
<p>百度蜘蛛抓取网页的规则:对于蜘蛛说网页权重越高、信用度越高抓取越频繁,例如网站的首页和内页。蜘蛛先抓取网站的首页,因为首页权重更高,并且大部分的链接都是指向首页。然后通过首页抓取网站的内页,并不是所有内页蜘蛛都会去抓取。</p>
</blockquote>
<p>搜索引擎认为对于一般的中小型站点,3 层足够承受所有的内容了,所以蜘蛛经常抓取的内容是前三层,而超过三层的内容蜘蛛认为那些内容并不重要,所以不经常爬取。出于这个原因所以 permalink 后面跟着的最好不要超过 2 个斜杠。[^]</p>
</blockquote>
<h1 id="xin-she-bei-shang-hui-fu-bo-ke-bei-fen-de-wen-ti-jie-jue">新设备上恢复博客备份的问题解决</h1>
<h2 id="code-sudo-npm-install-code-shi-bai"><a class="header-anchor" href="#sudo-npm-install-失败"></a><code>sudo npm install </code>失败</h2>
<p>解决方案:不要用 <code>sudo</code>, 直接 <code>npm install</code> 就好</p>
<h2 id="code-hexo-b-code-bao-cuo"><a class="header-anchor" href="#hexo-b报错"></a><code>hexo b</code> 报错</h2>
<p>在新装的 UTG 上恢复 Blog,最后执行 <code>hexo b</code> 的时候报错了</p>
<figure class="highlight bash"><table><tbody><tr><td class="code"><pre><span class="line">fatal: <span class="string">'github'</span> does not appear to be a git repository</span><br><span class="line">fatal: 无法读取远程仓库。</span><br><span class="line"></span><br><span class="line">请确认您有正确的访问权限并且仓库存在。</span><br></pre></td></tr></tbody></table></figure>
<p>翻了翻插件的 issuse,看到了相似的问题<a href="https://github.com/coneycode/hexo-git-backup/issues/20">#20</a></p>
<p>参考里面的内容,修改<strong>博客配置文件</strong>里插件的相关配置,把 <code>github</code> 换成 <code>origin</code></p>
<figure class="highlight plaintext"><table><tbody><tr><td class="code"><pre><span class="line">backup:</span><br><span class="line"> type: git</span><br><span class="line"> repository:</span><br><span class="line"> origin: git@github:bx_reader/bx-reader-api.git,master</span><br></pre></td></tr></tbody></table></figure>
<p>这里顺便把 git 的 https 连接改成了 git 连接,这样就不用每次都输入账号密码了</p>
<p>再次尝试,问题解决</p>
<h1 id="hexo-wen-zhang-jia-mi">Hexo 文章加密</h1>
<p>使用插件 <a href="https://github.com/MikeCoder/hexo-blog-encrypt">hexo-blog-encrypt</a></p>
<h2 id="an-zhuang"><a class="header-anchor" href="#安装"></a>安装</h2>
<figure class="highlight bash"><table><tbody><tr><td class="code"><pre><span class="line">npm install --save hexo-blog-encrypt</span><br></pre></td></tr></tbody></table></figure>
<h2 id="shi-yong"><a class="header-anchor" href="#使用"></a>使用</h2>
<p>在文章信息头添加 <code>password</code> 字段</p>
<figure class="highlight yaml"><table><tbody><tr><td class="code"><pre><span class="line"><span class="meta">---</span></span><br><span class="line"><span class="attr">title:</span> <span class="string">Hello</span> <span class="string">World</span></span><br><span class="line"><span class="attr">date:</span> <span class="number">2016-03-30 21:18:02</span></span><br><span class="line"><span class="attr">password:</span> <span class="string">mikemessi</span></span><br><span class="line"><span class="meta">---</span></span><br></pre></td></tr></tbody></table></figure>
<p>也可以在文章信息头单独自定义密码输入交互信息</p>
<figure class="highlight yaml"><table><tbody><tr><td class="code"><pre><span class="line"><span class="meta">---</span></span><br><span class="line"><span class="attr">title:</span> <span class="string">Hello</span> <span class="string">World</span></span><br><span class="line"><span class="attr">tags:</span></span><br><span class="line"><span class="bullet">-</span> <span class="string">作为日记加密</span></span><br><span class="line"><span class="attr">date:</span> <span class="number">2016-03-30 21:12:21</span></span><br><span class="line"><span class="attr">password:</span> <span class="string">mikemessi</span></span><br><span class="line"><span class="attr">abstract:</span> <span class="string">有东西被加密了,</span> <span class="string">请输入密码查看.</span></span><br><span class="line"><span class="attr">message:</span> <span class="string">您好,</span> <span class="string">这里需要密码.</span></span><br><span class="line"><span class="attr">wrong_pass_message:</span> <span class="string">抱歉,</span> <span class="string">这个密码看着不太对,</span> <span class="string">请再试试.</span></span><br><span class="line"><span class="attr">wrong_hash_message:</span> <span class="string">抱歉,</span> <span class="string">这个文章不能被校验,</span> <span class="string">不过您还是能看看解密后的内容.</span></span><br><span class="line"><span class="meta">---</span></span><br></pre></td></tr></tbody></table></figure>
<h2 id="jin-jie"><a class="header-anchor" href="#进阶"></a>进阶</h2>
<h3 id="quan-ju-pei-zhi"><a class="header-anchor" href="#全局配置"></a>全局配置</h3>
<p>在站点根目录下的<code>_config.yml</code> 里可以添加以下内容进行全局配置</p>
<figure class="highlight yaml"><table><tbody><tr><td class="code"><pre><span class="line"><span class="comment"># Security</span></span><br><span class="line"><span class="attr">encrypt:</span> <span class="comment"># hexo-blog-encrypt</span></span><br><span class="line"> <span class="attr">abstract:</span> <span class="string">有东西被加密了,</span> <span class="string">请输入密码查看.</span></span><br><span class="line"> <span class="attr">message:</span> <span class="string">您好,</span> <span class="string">这里需要密码.</span></span><br><span class="line"> <span class="attr">tags:</span></span><br><span class="line"> <span class="bullet">-</span> {<span class="attr">name:</span> <span class="string">tagName</span>, <span class="attr">password:</span> <span class="string">密码A</span>}</span><br><span class="line"> <span class="bullet">-</span> {<span class="attr">name:</span> <span class="string">tagName</span>, <span class="attr">password:</span> <span class="string">密码B</span>}</span><br><span class="line"> <span class="attr">template:</span> <span class="string"><div</span> <span class="string">id="hexo-blog-encrypt"</span> <span class="string">data-wpm="{{hbeWrongPassMessage}}"</span> <span class="string">data-whm="{{hbeWrongHashMessage}}"><div</span> <span class="string">class="hbe-input-container"><input</span> <span class="string">type="password"</span> <span class="string">id="hbePass"</span> <span class="string">placeholder="{{hbeMessage}}"</span> <span class="string">/><label>{{hbeMessage}}</label><div</span> <span class="string">class="bottom-line"></div></div><script</span> <span class="string">id="hbeData"</span> <span class="string">type="hbeData"</span> <span class="string">data-hmacdigest="{{hbeHmacDigest}}">{{hbeEncryptedData}}</script></div></span></span><br><span class="line"> <span class="attr">wrong_pass_message:</span> <span class="string">抱歉,</span> <span class="string">这个密码看着不太对,</span> <span class="string">请再试试.</span></span><br><span class="line"> <span class="attr">wrong_hash_message:</span> <span class="string">抱歉,</span> <span class="string">这个文章不能被校验,</span> <span class="string">不过您还是能看看解密后的内容.</span></span><br></pre></td></tr></tbody></table></figure>
<p>配置优先级是</p>
<p><strong>文章信息头 > <code>_config.yml</code> (站点根目录下的) > 默认配置</strong></p>
]]></content>
<categories>
<category>站点日志</category>
</categories>
<tags>
<tag>hexo</tag>
</tags>
</entry>
<entry>
<title>博客折腾笔记③:搭建个人动态页面 iM</title>
<url>/posts/2b426e0a.html</url>
<content><![CDATA[<p>今天在少数派上看到一篇搭建类似微博的个人动态页面的指南,我非常感高兴:出于对实现私密树洞分享心情的需要以及言论审查的苦恼,我想在博客上实现这样的功能很久了。感谢原作者为不懂技术的脚本小子我造好了轮子,接下来只需简单配置即可实现所需功能了。</p>
<p>以下是我的配置过程:</p>
<blockquote>
<p>参考文章:<a href="https://sspai.com/post/60024">保卫表达:用后端 BaaS 快速搭建专属无点赞评论版微博 ——b 言 b 语</a></p>
</blockquote>
<span id="more"></span>
<h1 id="pei-zhi-hou-duan-baa-s">配置后端 BaaS</h1>
<p>这里使用 <a href="https://leancloud.app/">LeanCloud 国际版</a></p>
<p>登入后创建应用并命名</p>
<p>进入新建好的应用,点击<code>新建Class</code>,将新建的 Class 命名为 content</p>
<p>同时设置下方 create 、delete 、update 三项权限为” 指定用户 “,其他权限默认即可</p>
<p><img data-src="https://i.loli.net/2020/04/20/cgBW2ryuwPd1iXf.png" alt=""></p>
<p>点击刚创建的 content Class</p>
<p>点击 添加列 并创建名称为 content 的「列」,类型为 String</p>
<p><img data-src="https://i.loli.net/2020/04/20/vLmAcuBIGPUZK4x.png" alt=""></p>
<p><img data-src="https://i.loli.net/2020/04/20/czwJRK4F75DsPbA.png" alt=""></p>
<p>完成后点击左侧<code>设置</code> - <code>应用 Keys</code>,记录三组 Keys 备用</p>
<p><img data-src="https://i.loli.net/2020/04/20/Kaxt5GOo3LRgMmy.png" alt=""></p>
<h1 id="pei-zhi-ke-hu-duan-fa-song-gong-ju">配置客户端发送工具</h1>
<h2 id="winodws-shi-yong-a-href-https-www-getquicker-net-quicker-a"><a class="header-anchor" href="#Winodws:使用Quicker"></a>Winodws:使用 <a href="https://www.getquicker.net/">Quicker</a></h2>
<p>Quicker 模板地址:<a href="https://getquicker.net/sharedaction?code=eeb80278-5f53-4b0d-d333-08d7e0dd26a9">点击安装</a></p>
<p>安装模板后右键编辑模板,修改变量定义和其他内容</p>
<p><img data-src="https://i.loli.net/2020/04/20/QAK8tCqRg79GyNL.png" alt=""></p>
<p>尝试发送一次请求,如果配置正确,在 LeanCloud 的后台刷新就能看到一条记录了。<strong>此后的删除、修改,都需要通过该后台进行。</strong></p>
<h2 id="android"><a class="header-anchor" href="#Android"></a>Android</h2>
<p>请参考我的<a href="https://jiml.ee/posts/4394c3fa.html">另一篇文章</a></p>
<h1 id="zai-bo-ke-shang-tian-jia-jie-mian">在博客上添加界面</h1>
<p>在博客 <code>/source</code> 下新建文件夹 <code>iM</code></p>
<p>下载作者提供的<a href="https://github.com/daibor/nonsense.fun">页面文件</a></p>
<p>将其复制到 <code>/source/iM</code> 下,打开编辑器自行修改其中内容</p>
<p>请注意填写 53-54 行的 <code>appId</code> 和 <code>appKey</code></p>
<p>修改后打开博客根目录<code>_config.yml</code>,在 <code>skip_render</code> 添加新建好的 <code>iM</code> 文件夹</p>
<figure class="highlight yaml"><table><tbody><tr><td class="code"><pre><span class="line"><span class="attr">skip_render:</span> </span><br><span class="line"> <span class="bullet">-</span> <span class="string">"404.html"</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">"iM/**"</span></span><br></pre></td></tr></tbody></table></figure>
<p>保存后打开所用主题文件夹下的<code>_config.yml</code>,向菜单栏添加 iM 的入口</p>
<p>这里以主题 NeXT 为例:编辑 <code>menu</code> 下面的内容,添加<code> iM: /iM/ || user</code></p>
<figure class="highlight yaml"><table><tbody><tr><td class="code"><pre><span class="line"><span class="comment"># Usage: `Key: /link/ || icon`</span></span><br><span class="line"><span class="comment"># Key is the name of menu item. If the translation for this item is available, the translated text will be loaded, otherwise the Key name will be used. Key is case-senstive.</span></span><br><span class="line"><span class="comment"># Value before `||` delimiter is the target link, value after `||` delimiter is the name of Font Awesome icon.</span></span><br><span class="line"><span class="comment"># When running the site in a subdirectory (e.g. yoursite.com/blog), remove the leading slash from link value (/archives -> archives).</span></span><br><span class="line"><span class="comment"># External url should start with http:// or https://</span></span><br><span class="line"><span class="attr">menu:</span></span><br><span class="line"> <span class="attr">home:</span> <span class="string">/</span> <span class="string">||</span> <span class="string">home</span></span><br><span class="line"> <span class="attr">categories:</span> <span class="string">/categories/</span> <span class="string">||</span> <span class="string">th</span></span><br><span class="line"> <span class="attr">tags:</span> <span class="string">/tags/</span> <span class="string">||</span> <span class="string">tags</span></span><br><span class="line"> <span class="attr">archives:</span> <span class="string">/archives/</span> <span class="string">||</span> <span class="string">archive</span></span><br><span class="line"> <span class="attr">iM:</span> <span class="string">/iM/</span> <span class="string">||</span> <span class="string">user</span> </span><br></pre></td></tr></tbody></table></figure>
<p>完成后终端依次输入</p>
<figure class="highlight bash"><table><tbody><tr><td class="code"><pre><span class="line">hexo clean</span><br><span class="line">hexo g</span><br><span class="line">hexo s</span><br></pre></td></tr></tbody></table></figure>
<p>打开 localhost:4000 查看效果</p>
<h1 id="to-do">To-Do</h1>
<ul>
<li><input type="checkbox" id="checkbox2"><label for="checkbox2">修改美化 iM 的页面文件</label><code>index.md</code>,参考 Cytus2 里的界面魔改?</li>
<li><input type="checkbox" id="checkbox3"><label for="checkbox3">尝试用</label><code>hexo-blog-encrypt</code> 加密页面?</li>
<li><input type="checkbox" id="checkbox4"><label for="checkbox4">直接在页面处添加一个在线输入框方便输入?</label></li>
</ul>
]]></content>
<categories>
<category>站点日志</category>
</categories>
<tags>
<tag>hexo</tag>
</tags>
</entry>
<entry>
<title>博客折腾笔记⑤:修整、更新与展望</title>
<url>/posts/b1b3bd39.html</url>
<content><![CDATA[<p>真的好久没打理博客了。虽然偶尔也会在摸鱼的日子里想着 “稍微试着往那个吃灰的博客上写点东西吧”,但很快又把写博客这事给忘记了。终于在最近,我又提起了写博客的兴致,趁着刚好有空,着手把博客更新修整了一番。</p>
<span id="more"></span>
<h1 id="bo-ke-de-geng-xin-xiu-zheng">博客的更新修整</h1>
<h2 id="bang-ding-yu-ming"><a class="header-anchor" href="#绑定域名"></a>绑定域名</h2>
<p>这次折腾,干的第一件事就是给博客绑了个域名。</p>
<p>一开始打算的是在腾讯云或者阿里云上随便注册一个便宜域名的,偶然发现还有一个契合我名字的创意域名 <code>jiml.ee</code> 可以注册。网上搜了一圈,<code>.ee</code> 后缀比较冷门,国内只有一个没听说过的注册商提供注册。价格虽然比腾讯云上的便宜域名贵些,但价格还可以接受。尽管<code>.ee</code> 现在没办法备案,作为 ccTLD 也有许多不稳定因素,但自己实在是太喜欢这个域名了,最后咬咬牙还是注册了 <code>jiml.ee</code> 这个域名。</p>
<p>注册完域名,我把它挂到了 DnsPod 上解析。考虑到 Github Pages 在国内的访问并不理想,一开始打算托管到之前就用过的 Netlify 上绑域名。但实际体验下来,Netlify 目前在国内的打开速度实在不比 Github Pages 快多少,于是在一波寻找后,转用与 Netlify 相似,但国内访问更快的 Vercel 部署托管。虽然国内访问速度仍然谈不上多快,但已经比 Github Pages 上好上不少了。等以后经济充裕了,再考虑托管到国内的对象储存或者用七牛 / 又拍加速,弄个双线部署吧。</p>
<h2 id="geng-xin-hexo-he-nex-t"><a class="header-anchor" href="#更新-Hexo-和-NexT"></a>更新 Hexo 和 NexT</h2>
<p>许久不见,Hexo 的版本号已经来到了 5.0+,NexT 也已经更到了 8.2.1。</p>
<p>5.0 的 Hexo 引入了独立的主题配置文件,新版本的 NexT 也提供了 <code>npm</code> 的安装方式,这比原来用 <code>git</code> 安装要方便可靠多了,备份好旧有主题配置后果断用 <code>npm</code> 重装 NexT。</p>
<p>之后就是对着最新的主题配置文件合并原有主题设置了。在重新配置主题的过程中,还顺带启用了 Pangu 和 Quicklink。</p>
<h2 id="qian-yi-ping-lun-xi-tong-zhi-twikoo"><a class="header-anchor" href="#迁移评论系统至-Twikoo"></a>迁移评论系统至 Twikoo</h2>
<p>了解到旧有评论系统 Valine 存在的安全问题,把博客的评论系统迁移到了 <a href="https://twikoo.js.org/">Twikoo</a> 上,在引入 Akismet 反垃圾服务的同时配置了博客评论的邮件提醒。</p>
<h2 id="xin-de-cha-jian"><a class="header-anchor" href="#新的插件"></a>新的插件</h2>
<ul>
<li><code>hexo-excerpt</code>:从 v7.6.0 开始 NexT 移除了主题自带的文章摘要折叠。参照指南,安装这个插件实现自动折叠功能。</li>
<li><code>markdown-it-named-headings</code>:解决 <code>hexo-renderer-markdown-it</code> 在 NexT 上 TOC 显示异常的问题。</li>
<li>更新 <code>hexo-blog-encrypt</code>:现在可以设置加密特定标签的页面了。</li>
</ul>
<h2 id="yi-chu-ge-ren-dong-tai-jie-mian-i-m"><a class="header-anchor" href="#移除个人动态界面-iM"></a>移除个人动态界面 iM</h2>
<p>尽管先前我在安卓上设法制作了一个发送动态的 Tasker 工程,但由于其使用上仍存在各种不便与问题,我逐渐地不再使用它记录个人动态了。</p>
<p>如果你对制作一个个人动态页面感兴趣,不妨试试这些项目:</p>
<ul>
<li>
<p><a href="https://bb.js.org/">BBtalk 中文文档</a></p>
</li>
<li>
<p><a href="https://artitalk.js.org/">Artitalk.js</a></p>
</li>
</ul>
<blockquote>
<p>现在,我主要使用 <a href="https://flomo.app">浮墨笔记 Flomo</a> 记录每天的琐碎想法。首先,它更隐秘,只有自己可见;同时,它基于 PWA,在各个平台只需浏览器就能方便的发送内容,还能通过微信公众号随时发送想法;在内容上,它支持插入图片、插入列表、简单地加粗或添加下划线,同时能够加入标签,通过标签组织管理起自己的所思所想…… 这些闪光点是我选择它的原因 —— 它真的完美满足了目前的我对自我记录的所有需求。<br>
最重要的是,上面的这些功能都是免费的!付费开通会员后,你还能享受每日回顾、随机漫步、API、数据导出等附加功能。如果你对它感兴趣,不妨通过我的<a href="https://flomoapp.com/register2/?MzIwMjA">邀请链接</a>试试看!</p>
</blockquote>
<h2 id="xin-zeng-ye-mian"><a class="header-anchor" href="#新增页面"></a>新增页面</h2>
<p>既然都挂了域名了,博客也自然得正式点了。</p>
<ul>
<li><strong><a href="/about">关于</a></strong>:作为个人站点,一个简短的自我介绍还是要有的。😆</li>
<li><strong><a href="/guestbook">留言</a></strong>:有什么想说的,欢迎在这里留言!🍻</li>
</ul>
<h1 id="zhan-wang">展望</h1>
<p>过去的一年里经历了太多太多。回顾我跌宕起伏的 2020,愈发觉得自己需要进行更多的记录与写作。在新的一年里,我打算好好地在博客上写些东西,内容也不会再局限于先前简单的折腾笔记,从今往后还会发自己的作品、一些思考见解,以及更生活化的个人记录。</p>
<p>无论如何,不能再让折腾了这么久的博客吃灰了,希望新的一年里我不会再咕咕咕下去吧!</p>
<p>你好,2021!你好,<a href="jiml.ee">jiml.ee</a>!</p>
]]></content>
<categories>
<category>站点日志</category>
</categories>
<tags>
<tag>hexo</tag>
</tags>
</entry>
<entry>
<title>使用 watchtower 自动更新 Docker 容器的镜像</title>
<url>/posts/5770fa20.html</url>
<content><![CDATA[<p>本文以在群晖下,使用 docker compose 部署为例:</p>
<ol>
<li>
<p>在 <code>docker</code> 文件夹下,新建文件夹 <code>watchtower</code></p>
</li>
<li>
<p>创建文件 <code>docker-compose.yml</code>,内容如下,根据需要修改参数:</p>
<figure class="highlight yaml"><table><tbody><tr><td class="code"><pre><span class="line"><span class="attr">services:</span></span><br><span class="line"> <span class="attr">watchtower:</span></span><br><span class="line"> <span class="attr">image:</span> <span class="string">containrrr/watchtower</span></span><br><span class="line"> <span class="attr">container_name:</span> <span class="string">watchtower</span></span><br><span class="line"> <span class="attr">environment:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">TZ=Asia/Shanghai</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">WATCHTOWER_CLEANUP=true</span> <span class="comment"># 更新后移除旧的镜像</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">WATCHTOWER_SCHEDULE=0</span> <span class="number">0</span> <span class="number">7</span> <span class="string">*</span> <span class="string">*</span> <span class="string">*</span> <span class="comment"># 设置 cron 定时任务</span></span><br><span class="line"> <span class="attr">volumes:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">/var/run/docker.sock:/var/run/docker.sock</span></span><br><span class="line"> <span class="attr">restart:</span> <span class="string">unless-stopped</span></span><br></pre></td></tr></tbody></table></figure>
<blockquote>
<p>更多配置项及其环境变量,请参考<a href="https://containrrr.dev/watchtower/arguments/">官方文档</a></p>
</blockquote>
<p>将文件保存到刚才创建的 <code>docker/watchtower</code> 文件夹里</p>
</li>
<li>
<p>SSH 连接群晖,挂载到 <code>docker/watchtower</code>,执行命令</p>
<figure class="highlight shell"><table><tbody><tr><td class="code"><pre><span class="line">sudo docker-compose up -d</span><br></pre></td></tr></tbody></table></figure>
<p>容器启动后,将按照设定自动检查更新。如检测到某容器的镜像有更新,将下载最新镜像,并自动重启该容器。</p>
</li>
</ol>
<hr>
<p><strong>Q</strong>:我不想某容器被 watchtower 自动更新重启,应该怎么做?</p>
<p><strong>A</strong>:在容器运行时添加 Label <code>com.centurylinklabs.watchtower.enable=false</code> 即可。请参见<a href="https://containrrr.dev/watchtower/container-selection/">官方文档介绍</a>。</p>
<p>这里提供一个 <code>docker-compose.yml</code> 的例子:</p>
<figure class="highlight yaml"><table><tbody><tr><td class="code"><pre><span class="line"><span class="attr">services:</span></span><br><span class="line"> <span class="attr">qbittorrent:</span></span><br><span class="line"> <span class="attr">container_name:</span> <span class="string">qbittorrent</span></span><br><span class="line"> <span class="attr">image:</span> <span class="string">linuxserver/qbittorrent</span></span><br><span class="line"> <span class="attr">labels:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">com.centurylinklabs.watchtower.enable=false</span></span><br></pre></td></tr></tbody></table></figure>
]]></content>
<categories>
<category>解决方案</category>
</categories>
<tags>
<tag>docker</tag>
<tag>群晖</tag>
</tags>
</entry>
<entry>
<title>Markdown 语法学习笔记①</title>
<url>/posts/6c2e314d.html</url>
<content><![CDATA[<h2 id="biao-ti"><a class="header-anchor" href="#标题"></a>标题</h2>
<p>两种语法,分别为类 Setext 和类 atx 形式。</p>
<h3 id="lei-setext-shi"><a class="header-anchor" href="#类-Setext-式"></a>类 Setext 式</h3>
<p>利用 <code>=</code> 和 <code>-</code>:</p>
<pre><code>标题
=====
标题
-----
</code></pre>
<h3 id="lei-atx-shi"><a class="header-anchor" href="#类-atx-式"></a>类 atx 式</h3>
<p>在行首插入 1 到 6 个<code>#</code>, 对应到标题 1 到 6 阶。</p>
<pre><code># 标题
## 标题
### 标题
#### 标题
##### 标题
###### 标题
</code></pre>
<p>也可以</p>
<pre><code># 标题 #
## 标题 ##
### 标题 ###
</code></pre>
<blockquote>
<p><strong>注意:</strong> 不要忘记<code>#</code>与标题文字间的空格<br>
错误示范:<code>##标题</code></p>
</blockquote>
<span id="more"></span>
<h2 id="qu-kuai-yin-yong"><a class="header-anchor" href="#区块引用"></a>区块引用</h2>
<p>使用 <code>></code></p>
<pre><code>> 一些文字
</code></pre>