-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch.xml
More file actions
39 lines (18 loc) · 10.3 KB
/
search.xml
File metadata and controls
39 lines (18 loc) · 10.3 KB
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
<?xml version="1.0" encoding="utf-8"?>
<search>
<entry>
<title>如何搭建个人博客</title>
<link href="/2024/04/14/%E5%A6%82%E4%BD%95%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/"/>
<url>/2024/04/14/%E5%A6%82%E4%BD%95%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/</url>
<content type="html"><![CDATA[<h1 id="hexo和github搭建博客"><a href="#hexo和github搭建博客" class="headerlink" title="hexo和github搭建博客"></a>hexo和github搭建博客</h1><p>本教程是教大家如何用hexo +github 搭建自己的个人博客,文章含有转载出处,教程会不断更新完善。</p><h2 id="安装node-js"><a href="#安装node-js" class="headerlink" title="#安装node.js"></a>#安装node.js</h2><p>下载 node.js</p><p>教程:<a href="https://blog.csdn.net/weixin_52799373/article/details/123840137">https://blog.csdn.net/weixin_52799373/article/details/123840137</a> (过程详细)</p><p>注意一:</p><p>如果在查询版本时node-v和npm-v 是无效cmd的话,可以先配置环境变量再配置路劲。</p><p>注意二:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">npm config set prefix "E:\develop\nodejs\node_global" </span><br><span class="line">npm config set cache "E:\develop\nodejs\node_cache"</span><br><span class="line">npm config set registry https://registry.npm.taobao.org</span><br></pre></td></tr></table></figure><p>这三个代码输入没有反应的话可以在npm前加c即可,后面类似的安装指令也是如此。</p><p>查询上面三个代码有没有成功,输入下面代码:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm config ls</span><br></pre></td></tr></table></figure><p>注意三:</p><p>全局安装express 和webpack 模块之后,生成的文件夹不一定在node_modules下,在node_global文件下找到也可。</p><h2 id="安装git并生成和配置SSH-Keys"><a href="#安装git并生成和配置SSH-Keys" class="headerlink" title="安装git并生成和配置SSH Keys"></a>安装git并生成和配置SSH Keys</h2><p>详细教程:<a href="https://blog.csdn.net/m0_46278037/article/details/118815158">https://blog.csdn.net/m0_46278037/article/details/118815158</a></p><p>注意:到了git init 指令之前就不要进行了</p><p>github 的仓库名字形式要为 你的github名字.github.io 例如我的: CallMeXD.github.io</p><p>如果仓库名形式不是这样后面你部署成功后无法访问线上。</p><h2 id="安装hexo"><a href="#安装hexo" class="headerlink" title="安装hexo"></a>安装hexo</h2><p>1.首先需要建立博客文件夹,建议建在非系统盘,例如 <code>~:/Blogroot/</code>,那么这个目录就是我们博客的根目录了。<br>因为每个人的命名习惯不同,本帖之后会以 [Blogroot] 指代博客根目录。</p><p>2.使用 npm 安装 Hexo, 在 [Blogroot] 路径下右键 ->Git Bash Here, 输入</p><figure class="highlight plaintext"><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><span class="line">BASH</span><br><span class="line">npm config set registry https://registry.npm.taobao.org</span><br><span class="line">#将npm源替换为阿里的镜像。之后的安装就会迅速很多了。</span><br><span class="line">npm install hexo-cli -g</span><br><span class="line"># hexo-cli 是 hexo的指令集。</span><br><span class="line">hexo -v</span><br></pre></td></tr></table></figure><p>npm intstall hexo-cli -g指令不起作用可在npm前面加c ,教程中的npm安装指令都可尝试加c</p><p>3.初始化 Hexo 博客:</p><figure class="highlight plaintext"><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></pre></td><td class="code"><pre><span class="line">BASH</span><br><span class="line">## 本地创建一个目录用于存放博客</span><br><span class="line">hexo init</span><br><span class="line">hexo g</span><br><span class="line">hexo s</span><br></pre></td></tr></table></figure><p>如果hexo指令没有起作用可以使用 rpx hexo init 后面的hexo指令也是如此</p><p>然后在浏览器中打开 localhost:4000 , 就能看到</p><p>长按 Ctrl + c 关闭服务器</p><h2 id="部署到github"><a href="#部署到github" class="headerlink" title="部署到github"></a>部署到github</h2><p>在 [Blogroot] 路径下找到_config.yml 打开拉到最后面找到deploy</p><figure class="highlight plaintext"><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><span class="line">deploy:</span><br><span class="line"> type: git</span><br><span class="line"> repository: 你的github地址 例如https://github.com/CallMeXD/CallMeXD.github.io</span><br><span class="line"> branch: main</span><br></pre></td></tr></table></figure><p>可以看到上面为什么要你仓库名要是 你的github名字.github.io 这种形式。</p><h2 id="安装hexo-deployer-git-自动部署发布工具"><a href="#安装hexo-deployer-git-自动部署发布工具" class="headerlink" title="安装hexo-deployer-git 自动部署发布工具"></a>安装hexo-deployer-git 自动部署发布工具</h2><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install hexo-deployer-git *--save*</span><br></pre></td></tr></table></figure><h2 id="生成页面"><a href="#生成页面" class="headerlink" title="生成页面"></a>生成页面</h2><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo g</span><br></pre></td></tr></table></figure><h2 id="本地文件上传到Github上面"><a href="#本地文件上传到Github上面" class="headerlink" title="本地文件上传到Github上面"></a>本地文件上传到Github上面</h2><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo d</span><br></pre></td></tr></table></figure><p>如果出现FATAL Error:Spwan failed 可多次尝试 hexo d</p><p>中间会出现一个登录界面,可以用令牌登录。(令牌及时保存,就看不到了)</p><p>结束以后就上传 Github 就成功了</p><h2 id="浏览器输入-你的github名字-github-io-浏览线上页面"><a href="#浏览器输入-你的github名字-github-io-浏览线上页面" class="headerlink" title="浏览器输入 你的github名字.github.io 浏览线上页面"></a>浏览器输入 你的github名字.github.io 浏览线上页面</h2><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">https://callmexd.github.io/</span><br></pre></td></tr></table></figure><p>至此属于你的博客已经搭好,进一步美化教程在下方。</p><p>搭建和美化网站会遇到不少困难很花时间,请耐心下去。有问题可以在主页联系,或下方评论。</p><h1 id="网页美化"><a href="#网页美化" class="headerlink" title="网页美化"></a>网页美化</h1><p>推荐一位大佬的:<a href="http://haiyong.site/post/22e1d5da.html">http://haiyong.site/post/22e1d5da.html</a></p>]]></content>
<tags>
<tag> -教程 </tag>
</tags>
</entry>
<entry>
<title>Hello World</title>
<link href="/2024/04/13/hello-world/"/>
<url>/2024/04/13/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><span class="line">$ hexo new <span class="string">"My New Post"</span></span><br></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><span class="line">$ hexo server</span><br></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><span class="line">$ hexo generate</span><br></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><span class="line">$ hexo deploy</span><br></pre></td></tr></table></figure><p>More info: <a href="https://hexo.io/docs/one-command-deployment.html">Deployment</a></p>]]></content>
</entry>
</search>