-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocal-search.xml
137 lines (66 loc) · 32 KB
/
local-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
<?xml version="1.0" encoding="utf-8"?>
<search>
<entry>
<title>DevOps</title>
<link href="/2021/06/05/DevOps/"/>
<url>/2021/06/05/DevOps/</url>
<content type="html"><![CDATA[<h1 id="博客开发步骤"><a href="#博客开发步骤" class="headerlink" title="博客开发步骤"></a>博客开发步骤</h1><h2 id="本地环境搭建"><a href="#本地环境搭建" class="headerlink" title="本地环境搭建"></a>本地环境搭建</h2><p>需要安装Nodejs、npm、Hexo和额外插件。</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><code class="hljs bash">frankyoung@Franks-MacBook-Pro ~ % mkdir ~/.npm-global<br>frankyoung@Franks-MacBook-Pro ~ % npm config <span class="hljs-built_in">set</span> prefix <span class="hljs-string">'~/.npm-global'</span><br>frankyoung@Franks-MacBook-Pro ~ % vim ~/.profile<br>frankyoung@Franks-MacBook-Pro ~ % <span class="hljs-built_in">source</span> ~/.profile<br>frankyoung@Franks-MacBook-Pro ~ % npm install -g jshint<br>/Users/frankyoung/.npm-global/bin/jshint -> /Users/frankyoung/.npm-global/lib/node_modules/jshint/bin/jshint<br>+ [email protected]<br>added 31 packages from 15 contributors <span class="hljs-keyword">in</span> 4.799s<br><br>frankyoung@Franks-MacBook-Pro ~ % npm install -g hexo-cli <br>/Users/frankyoung/.npm-global/bin/hexo -> /Users/frankyoung/.npm-global/lib/node_modules/hexo-cli/bin/hexo<br>+ [email protected]<br>added 63 packages from 56 contributors <span class="hljs-keyword">in</span> 5.937s<br><br>frankyoung@Franks-MacBook-Pro blog % hexo init blog<br>INFO Cloning hexo-starter https://github.com/hexojs/hexo-starter.git<br>INFO Install dependencies<br>added 187 packages from 159 contributors and audited 193 packages <span class="hljs-keyword">in</span> 7.984s<br>15 packages are looking <span class="hljs-keyword">for</span> funding<br> run `npm fund` <span class="hljs-keyword">for</span> details<br>found 0 vulnerabilities<br><br>INFO Start blogging with Hexo!<br></code></pre></td></tr></table></figure><h2 id="页面设置"><a href="#页面设置" class="headerlink" title="页面设置"></a>页面设置</h2><p>主要设置内容为:文章首页、文章显示页、导航栏菜单</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br></pre></td><td class="code"><pre><code class="hljs bash"><span class="hljs-comment">#---------------------------</span><br><span class="hljs-comment"># 首页</span><br>index:<br> <span class="hljs-comment"># 首页 Banner 头图</span><br> banner_img: /img/star.jpg<br><br> <span class="hljs-comment"># 头图高度,屏幕百分比</span><br> <span class="hljs-comment"># Available: 0 - 100</span><br> banner_img_height: 100<br><br> <span class="hljs-comment"># 头图黑色蒙版的不透明度,available: 0 - 1.0, 1 是完全不透明</span><br> <span class="hljs-comment"># Available: 0 - 1.0</span><br> banner_mask_alpha: 0.3<br><br> <span class="hljs-comment"># 首页副标题的独立设置</span><br> slogan:<br> <span class="hljs-built_in">enable</span>: <span class="hljs-literal">true</span><br><br> <span class="hljs-comment"># 为空则按 hexo config.subtitle 显示</span><br> <span class="hljs-comment"># If empty, text based on `subtitle` in hexo config</span><br> text: <span class="hljs-string">"每一个不曾努力的日子都是对生命的辜负"</span><br><br> <span class="hljs-comment"># 自动截取文章摘要</span><br> auto_excerpt:<br> <span class="hljs-built_in">enable</span>: <span class="hljs-literal">true</span><br><br> <span class="hljs-comment"># 是否显示文章信息(时间、分类、标签)</span><br> post_meta:<br> date: <span class="hljs-literal">true</span><br> category: <span class="hljs-literal">true</span><br> tag: <span class="hljs-literal">true</span><br><br> <span class="hljs-comment"># 文章通过 sticky 排序后,在首页文章标题前显示图标</span><br> post_sticky:<br> <span class="hljs-built_in">enable</span>: <span class="hljs-literal">true</span><br> icon: <span class="hljs-string">"iconfont icon-top"</span><br><span class="hljs-comment">#---------------------------</span><br><br><span class="hljs-comment">#---------------------------</span><br><span class="hljs-comment"># 文章页</span><br>post:<br> banner_img: /img/code.jpg<br> banner_img_height: 70<br> banner_mask_alpha: 0.3<br><br> <span class="hljs-comment"># 文章标题下方的元信息</span><br> meta:<br> <span class="hljs-comment"># 作者</span><br> author: <br> <span class="hljs-built_in">enable</span>: <span class="hljs-literal">true</span><br><br> <span class="hljs-comment"># 文章日期,优先根据 front-matter 里 date 字段,其次是 md 文件日期</span><br> date:<br> <span class="hljs-built_in">enable</span>: <span class="hljs-literal">true</span><br> <span class="hljs-comment"># 格式参照 ISO-8601 日期格式化</span><br> <span class="hljs-comment"># ISO-8601 date format</span><br> <span class="hljs-comment"># See: http://momentjs.cn/docs/#/parsing/string-format/</span><br> format: <span class="hljs-string">"YYYY.M.D ah:mm:ss"</span><br><br> <span class="hljs-comment"># 浏览量计数</span><br> views:<br> <span class="hljs-built_in">enable</span>: <span class="hljs-literal">true</span><br> <span class="hljs-comment"># 统计数据来源</span><br> <span class="hljs-built_in">source</span>: <span class="hljs-string">"leancloud"</span><br> format: <span class="hljs-string">"{} 次"</span><br><br> <span class="hljs-comment"># 文章右侧目录</span><br> toc:<br> <span class="hljs-built_in">enable</span>: <span class="hljs-literal">true</span><br> <span class="hljs-comment"># 目录会选择这些节点作为标题</span><br> headingSelector: <span class="hljs-string">"h1,h2,h3,h4,h5,h6"</span><br> <span class="hljs-comment"># 层级的折叠深度,0 是全部折叠,大于 0 后如果存在下级标题则默认展开</span><br> collapseDepth: 10<br><br> <span class="hljs-comment"># 文章底部上一篇下一篇功能</span><br> prev_next:<br> <span class="hljs-built_in">enable</span>: <span class="hljs-literal">true</span><br><span class="hljs-comment">#---------------------------</span><br><br><span class="hljs-comment">#---------------------------</span><br><span class="hljs-comment"># 导航栏菜单,可自行增减,key 用来关联 languages/*.yml,如不存在关联则显示 key 本身的值;icon 是 css class,可以省略;增加 name 可以强制显示指定名称</span><br> menu:<br> - { key: <span class="hljs-string">"home"</span>, link: <span class="hljs-string">"/"</span>, icon: <span class="hljs-string">"iconfont icon-home-fill"</span> }<br> - { key: <span class="hljs-string">"archive"</span>, link: <span class="hljs-string">"/archives/"</span>, icon: <span class="hljs-string">"iconfont icon-archive-fill"</span> }<br> - { key: <span class="hljs-string">"category"</span>, link: <span class="hljs-string">"/categories/"</span>, icon: <span class="hljs-string">"iconfont icon-category-fill"</span> }<br> - { key: <span class="hljs-string">"tag"</span>, link: <span class="hljs-string">"/tags/"</span>, icon: <span class="hljs-string">"iconfont icon-tags-fill"</span> }<br> - { key: <span class="hljs-string">"about"</span>, link: <span class="hljs-string">"/about/"</span>, icon: <span class="hljs-string">"iconfont icon-user-fill"</span> }<br><span class="hljs-comment">#---------------------------</span><br></code></pre></td></tr></table></figure><h2 id="构件编译并发布"><a href="#构件编译并发布" class="headerlink" title="构件编译并发布"></a>构件编译并发布</h2><p>构件编译主要有四步:<br>清除本地缓存、编译本地文件、启动本地网页端口调试、发布到服务器仓库</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br></pre></td><td class="code"><pre><code class="hljs bash">frankyoung@Franks-MacBook-Pro blog % hexo clean<br>INFO Validating config<br>INFO Deleted database.<br>INFO Deleted public folder.<br><br>frankyoung@Franks-MacBook-Pro blog % hexo generate<br>INFO Validating config<br>INFO Start processing<br>INFO Files loaded <span class="hljs-keyword">in</span> 342 ms<br>INFO Generated: tags/index.html<br>INFO Generated: local-search.xml<br>INFO Generated: tags/Solved/index.html<br>INFO Generated: tags/Issues/index.html<br>INFO Generated: tags/Blog/index.html<br>INFO Generated: tags/HTML/index.html<br>INFO Generated: tags/Tests/index.html<br>INFO Generated: tags/HelloWorld/index.html<br>INFO Generated: tags/Intro/index.html<br>INFO Generated: categories/others/index.html<br>INFO Generated: categories/issues/index.html<br>INFO Generated: tags/Dev/index.html<br>INFO Generated: tags/Mac/index.html<br>INFO Generated: categories/index.html<br>INFO Generated: links/index.html<br>INFO Generated: archives/index.html<br>INFO Generated: tags/Hexo/index.html<br>INFO Generated: tags/Commands/index.html<br>INFO Generated: about/index.html<br>INFO Generated: index.html<br>INFO Generated: 404.html<br>INFO Generated: xml/local-search.xml<br>INFO Generated: archives/2021/06/index.html<br>INFO Generated: archives/2021/05/index.html<br>INFO Generated: archives/2021/index.html<br>INFO Generated: css/gitalk.css<br>INFO Generated: js/boot.js<br>INFO Generated: js/events.js<br>INFO Generated: js/local-search.js<br>INFO Generated: js/plugins.js<br>INFO Generated: js/leancloud.js<br>INFO Generated: js/utils.js<br>INFO Generated: js/img-lazyload.js<br>INFO Generated: js/color-schema.js<br>INFO Generated: lib/hint/hint.min.css<br>INFO Generated: 2021/06/04/Tags/index.html<br>INFO Generated: css/main.css<br>INFO Generated: 2021/05/21/hello-world/index.html<br>INFO Generated: 2021/06/04/found/index.html<br>INFO 65 files generated <span class="hljs-keyword">in</span> 650 ms<br><br>frankyoung@Franks-MacBook-Pro blog % hexo server<br>INFO Validating config<br>INFO Start processing<br>INFO Hexo is running at http://localhost:4000 . Press Ctrl+C to stop.<br>^C<br>INFO Bye!<br><br>frankyoung@Franks-MacBook-Pro blog % hexo deploy<br>INFO Validating config<br>INFO Deploying: git<br>INFO Clearing .deploy_git folder...<br>INFO Copying files from public folder...<br>INFO Copying files from extend <span class="hljs-built_in">dirs</span>...<br>[master 93b2ef5] Site updated: 2021-06-04 21:04:25<br> 29 files changed, 3935 insertions(+), 45 deletions(-)<br> create mode 100644 2021/06/04/Tags/index.html<br> delete mode 100644 img/hit.jpg<br> create mode 100644 img/hit.png<br> create mode 100644 tags/Blog/index.html<br> create mode 100644 tags/Commands/index.html<br> create mode 100644 tags/Dev/index.html<br> create mode 100644 tags/HTML/index.html<br> create mode 100644 tags/Intro/index.html<br> create mode 100644 tags/Issues/index.html<br> create mode 100644 tags/Mac/index.html<br> create mode 100644 tags/Solved/index.html<br> create mode 100644 tags/Tests/index.html<br>Enumerating objects: 94, <span class="hljs-keyword">done</span>.<br>Counting objects: 100% (94/94), <span class="hljs-keyword">done</span>.<br>Delta compression using up to 4 threads<br>Compressing objects: 100% (36/36), <span class="hljs-keyword">done</span>.<br>Writing objects: 100% (59/59), 661.63 KiB | 18.38 MiB/s, <span class="hljs-keyword">done</span>.<br>Total 59 (delta 27), reused 0 (delta 0)<br>remote: Resolving deltas: 100% (27/27), completed with 15 <span class="hljs-built_in">local</span> objects.<br>To https://github.com/franklegolasyoung/franklegolasyoung.github.io.git<br> 1b0b760..93b2ef5 HEAD -> gh-pages<br>Branch <span class="hljs-string">'master'</span> <span class="hljs-built_in">set</span> up to track remote branch <span class="hljs-string">'gh-pages'</span> from <span class="hljs-string">'https://github.com/franklegolasyoung/franklegolasyoung.github.io.git'</span>.<br>INFO Deploy <span class="hljs-keyword">done</span>: git<br></code></pre></td></tr></table></figure><h2 id="评论功能"><a href="#评论功能" class="headerlink" title="评论功能"></a>评论功能</h2><p>需注册LeanCloud账号并创建仓库,获得AppID和AppKey。<br>部署Valine插件。<br>测试评论功能。</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><code class="hljs yaml"><span class="hljs-comment"># 评论插件</span><br> <span class="hljs-attr">comments:</span><br> <span class="hljs-attr">enable:</span> <span class="hljs-literal">true</span><br> <span class="hljs-attr">type:</span> <span class="hljs-string">valine</span><br><br><span class="hljs-comment"># Valine</span><br><span class="hljs-comment"># 基于 LeanCloud</span><br><span class="hljs-comment"># See: https://valine.js.org/</span><br><span class="hljs-attr">valine:</span><br> <span class="hljs-attr">appId:</span> <span class="hljs-string">klTOoxzHLpBGSqgQ2z9NgQkK-gzGzoHsz</span><br> <span class="hljs-attr">appKey:</span> <span class="hljs-string">R3IFAcMNDIAG82yVJFwpRN4y</span><br> <span class="hljs-attr">path:</span> <span class="hljs-string">window.location.pathname</span><br> <span class="hljs-attr">avatar:</span> <span class="hljs-string">retro</span><br> <span class="hljs-attr">meta:</span> [<span class="hljs-string">'nick'</span>, <span class="hljs-string">'mail'</span>, <span class="hljs-string">'link'</span>]<br> <span class="hljs-attr">pageSize:</span> <span class="hljs-number">10</span><br> <span class="hljs-attr">lang:</span> <span class="hljs-string">zh-CN</span><br> <span class="hljs-attr">highlight:</span> <span class="hljs-literal">false</span><br> <span class="hljs-attr">recordIP:</span> <span class="hljs-literal">false</span><br> <span class="hljs-attr">serverURLs:</span> <span class="hljs-string">''</span><br> <span class="hljs-attr">emojiCDN:</span><br> <span class="hljs-attr">emojiMaps:</span><br> <span class="hljs-attr">enableQQ:</span> <span class="hljs-literal">false</span><br> <span class="hljs-attr">requiredFields:</span> []<br></code></pre></td></tr></table></figure><h2 id="浏览量和访客量"><a href="#浏览量和访客量" class="headerlink" title="浏览量和访客量"></a>浏览量和访客量</h2><p>注册百度统计账号。<br>绑定博客网页并安装统计代码。<br>测试是否成功并添加运行。<br>显示实时数据。</p><figure class="highlight apache"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><code class="hljs apache"><span class="hljs-comment"># 网页访问统计</span><br><span class="hljs-attribute">web_analytics</span>:<br> <span class="hljs-attribute">enable</span>: true<br><br> <span class="hljs-comment"># 百度统计的 Key,值需要获取下方链接中 `hm.js?` 后边的字符串</span><br> <span class="hljs-comment"># See: https://tongji.baidu.com/sc-web/10000033910/home/site/getjs?siteId=13751376</span><br> <span class="hljs-attribute">baidu</span>: ccdba<span class="hljs-number">5599</span>f<span class="hljs-number">68</span>aab<span class="hljs-number">0</span>fb<span class="hljs-number">754</span>b<span class="hljs-number">58</span>cdcf<span class="hljs-number">0</span>e<span class="hljs-number">04</span><br><br> <span class="hljs-comment"># LeanCloud 计数统计,可用于 PV UV 展示</span><br> <span class="hljs-attribute">leancloud</span>: <br> <span class="hljs-attribute">app_id</span>: klTOoxzHLpBGSqgQ<span class="hljs-number">2</span>z<span class="hljs-number">9</span>NgQkK-gzGzoHsz<br> <span class="hljs-attribute">app_key</span>: R<span class="hljs-number">3</span>IFAcMNDIAG<span class="hljs-number">82</span>yVJFwpRN<span class="hljs-number">4</span>y<br> <span class="hljs-comment"># REST API 服务器地址</span><br> <span class="hljs-attribute">server_url</span>: https://kltooxzh.lc-cn-n<span class="hljs-number">1</span>-shared.com<br></code></pre></td></tr></table></figure>]]></content>
<categories>
<category>Dev</category>
</categories>
<tags>
<tag>Hexo</tag>
<tag>Dev</tag>
<tag>Blog</tag>
<tag>Mac</tag>
</tags>
</entry>
<entry>
<title>Test on Tags</title>
<link href="/2021/06/04/Tags/"/>
<url>/2021/06/04/Tags/</url>
<content type="html"><![CDATA[<p>This is a test blog to enrich tags.</p>]]></content>
<categories>
<category>others</category>
</categories>
<tags>
<tag>Hexo</tag>
<tag>Dev</tag>
<tag>Tests</tag>
<tag>Blog</tag>
</tags>
</entry>
<entry>
<title>Hexo command not found</title>
<link href="/2021/06/04/found/"/>
<url>/2021/06/04/found/</url>
<content type="html"><![CDATA[<p>Welcome to my blog! This is the first blog I write about some issues in using Hexo. After building up this blog, I haven’t using Hexo for about two weeks. Now the hexo commands are not available. </p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">$ zsh: <span class="hljs-built_in">command</span> not found: hexo<br></code></pre></td></tr></table></figure><h2 id="问题:"><a href="#问题:" class="headerlink" title="问题:"></a>问题:</h2><p>在搭建博客后进入新终端,重新编辑使用hexo,发现hexo命令无效的问题。</p><h2 id="排查步骤"><a href="#排查步骤" class="headerlink" title="排查步骤"></a>排查步骤</h2><h3 id="1-查看nodejs和npm版本"><a href="#1-查看nodejs和npm版本" class="headerlink" title="1. 查看nodejs和npm版本"></a>1. 查看nodejs和npm版本</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><code class="hljs bash">frankyoung@Franks-MacBook-Pro blog % node -v<br>v14.17.0<br>frankyoung@Franks-MacBook-Pro blog % npm -v<br>6.14.13<br></code></pre></td></tr></table></figure><p>正确无误,排除二者影响。</p><h3 id="2-使用npm重新安装hexo"><a href="#2-使用npm重新安装hexo" class="headerlink" title="2. 使用npm重新安装hexo"></a>2. 使用npm重新安装hexo</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><code class="hljs bash">frankyoung@Franks-MacBook-Pro blog % npm install hexo-cli -g<br>/Users/frankyoung/.npm-global/bin/hexo -> /Users/frankyoung/.npm-global/lib/node_modules/hexo-cli/bin/hexo<br>+ [email protected]<br>updated 4 packages <span class="hljs-keyword">in</span> 13.861s<br>frankyoung@Franks-MacBook-Pro blog % hexo<br>zsh: <span class="hljs-built_in">command</span> not found: hexo<br></code></pre></td></tr></table></figure><p>重新安装成功,并没有解决问题。</p><h3 id="3-检查系统环境变量"><a href="#3-检查系统环境变量" class="headerlink" title="3. 检查系统环境变量"></a>3. 检查系统环境变量</h3><p>系统环境变量中并没有hexo和npm的链接项,说明第一次安装并没有配置好hexo的环境变量,导致再次访问终端后,丢失之前配置的环境,无法正常使用hexo。</p><h2 id="解决方法"><a href="#解决方法" class="headerlink" title="解决方法"></a>解决方法</h2><p>打开编辑.bash_profile环境变量配置文件。</p><p>添加以下环境变量:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash"><span class="hljs-built_in">export</span> PATH=<span class="hljs-variable">$PATH</span>:/Users/frankyoung/.npm-global/bin<br></code></pre></td></tr></table></figure><p>将npm安装的hexo添加到系统环境变量中,并保存生效。</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs bash">frankyoung@Franks-MacBook-Pro ~ % open -e .bash_profile<br>frankyoung@Franks-MacBook-Pro ~ % <span class="hljs-built_in">source</span> ~/.bash_profile<br></code></pre></td></tr></table></figure><p>再次查看hexo版本,可以看到hexo已经可以正常使用了,问题解决。</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><code class="hljs bash">frankyoung@Franks-MacBook-Pro ~ % hexo -v<br>hexo-cli: 4.2.0<br>os: Darwin 20.3.0 darwin x64<br>node: 14.17.0<br>v8: 8.4.371.23-node.63<br>uv: 1.41.0<br>zlib: 1.2.11<br>brotli: 1.0.9<br>ares: 1.17.1<br>modules: 83<br>nghttp2: 1.42.0<br>napi: 8<br>llhttp: 2.1.3<br>openssl: 1.1.1k<br>cldr: 38.1<br>icu: 68.2<br>tz: 2020d<br>unicode: 13.0<br></code></pre></td></tr></table></figure><p>以上。</p>]]></content>
<categories>
<category>issues</category>
</categories>
<tags>
<tag>Hexo</tag>
<tag>Dev</tag>
<tag>Blog</tag>
<tag>Solved</tag>
<tag>Issues</tag>
<tag>HTML</tag>
<tag>Mac</tag>
</tags>
</entry>
<entry>
<title>Hello World</title>
<link href="/2021/05/21/hello-world/"/>
<url>/2021/05/21/hello-world/</url>
<content type="html"><![CDATA[<p>Welcome to <a href="https://hexo.io/">Hexo</a>! This is your very first post. Check <a href="https://hexo.io/docs/">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">troubleshooting</a> or you can ask me on <a href="https://github.com/hexojs/hexo/issues">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><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">$ hexo new <span class="hljs-string">"My New Post"</span><br></code></pre></td></tr></table></figure><p>More info: <a href="https://hexo.io/docs/writing.html">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><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">$ hexo server<br></code></pre></td></tr></table></figure><p>More info: <a href="https://hexo.io/docs/server.html">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><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">$ hexo generate<br></code></pre></td></tr></table></figure><p>More info: <a href="https://hexo.io/docs/generating.html">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><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">$ hexo deploy<br></code></pre></td></tr></table></figure><p>More info: <a href="https://hexo.io/docs/one-command-deployment.html">Deployment</a></p>]]></content>
<categories>
<category>others</category>
</categories>
<tags>
<tag>Hexo</tag>
<tag>HelloWorld</tag>
<tag>Intro</tag>
<tag>Commands</tag>
</tags>
</entry>
</search>