Skip to content

Commit

Permalink
Site updated: 2024-07-24 20:56:47
Browse files Browse the repository at this point in the history
  • Loading branch information
gi-b716 committed Jul 24, 2024
1 parent 5f5ff34 commit e07b1ce
Show file tree
Hide file tree
Showing 9 changed files with 537 additions and 92 deletions.
34 changes: 17 additions & 17 deletions 2024/07/22/浅谈如何搭建Hexo博客/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<meta property="og:description" content="前言    由于老博客年久失修且文件杂乱不易于维护,笔者意将老博客存档并部署了新博客,开一个文章与大家分享部署过程。 部署Hexo博客1. 环境准备    安装 node.js ,并装载 hexo-cli 包。 1npm install -g hexo-cli     建立 Github 仓库 username.github.io 。 2. 初始化项目    在任意目录下执行: 1hexo">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2024-07-22T14:04:53.000Z">
<meta property="article:modified_time" content="2024-07-22T15:30:41.787Z">
<meta property="article:modified_time" content="2024-07-24T12:56:28.215Z">
<meta property="article:author" content="Gavin">
<meta name="twitter:card" content="summary_large_image">

Expand Down Expand Up @@ -221,7 +221,7 @@
<span class="post-meta mr-2">
<i class="iconfont icon-chart"></i>

392
393

</span>

Expand Down Expand Up @@ -282,41 +282,41 @@ <h1 id="seo-header">浅谈如何搭建Hexo博客</h1>

<div class="markdown-body">

<h1 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h1><p>    由于老博客年久失修且文件杂乱不易于维护,笔者意将老博客存档并部署了新博客,开一个文章与大家分享部署过程。</p>
<h1 id="部署Hexo博客"><a href="#部署Hexo博客" class="headerlink" title="部署Hexo博客"></a>部署Hexo博客</h1><h2 id="1-环境准备"><a href="#1-环境准备" class="headerlink" title="1. 环境准备"></a>1. 环境准备</h2><p>    安装 node.js ,并装载 <code>hexo-cli</code> 包。</p>
<h2 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h2><p>    由于老博客年久失修且文件杂乱不易于维护,笔者意将老博客存档并部署了新博客,开一个文章与大家分享部署过程。</p>
<h2 id="部署Hexo博客"><a href="#部署Hexo博客" class="headerlink" title="部署Hexo博客"></a>部署Hexo博客</h2><h3 id="1-环境准备"><a href="#1-环境准备" class="headerlink" title="1. 环境准备"></a>1. 环境准备</h3><p>    安装 node.js ,并装载 <code>hexo-cli</code> 包。</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">npm install -g hexo-cli<br></code></pre></td></tr></table></figure>

<p>    建立 Github 仓库 <code>username.github.io</code></p>
<h2 id="2-初始化项目"><a href="#2-初始化项目" class="headerlink" title="2. 初始化项目"></a>2. 初始化项目</h2><p>    在任意目录下执行:</p>
<h3 id="2-初始化项目"><a href="#2-初始化项目" class="headerlink" title="2. 初始化项目"></a>2. 初始化项目</h3><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">hexo init hexo-blog<br></code></pre></td></tr></table></figure>

<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></pre></td><td class="code"><pre><code class="hljs bash"><span class="hljs-built_in">cd</span> hexo-blog<br>hexo g<br>hexo server<br></code></pre></td></tr></table></figure>

<h2 id="3-更改主题(可选)"><a href="#3-更改主题(可选)" class="headerlink" title="3. 更改主题(可选)"></a>3. 更改主题(可选)</h2><h3 id="NexT-主题"><a href="#NexT-主题" class="headerlink" title="NexT 主题"></a>NexT 主题</h3><p>    <strong>笔者未使用 NexT 主题,故下方内容为网上信息整合而成。</strong></p>
<h3 id="3-更改主题(可选)"><a href="#3-更改主题(可选)" class="headerlink" title="3. 更改主题(可选)"></a>3. 更改主题(可选)</h3><h4 id="NexT-主题"><a href="#NexT-主题" class="headerlink" title="NexT 主题"></a>NexT 主题</h4><p>    <strong>笔者未使用 NexT 主题,故下方内容为网上信息整合而成。</strong></p>
<p>    使用 git 安装 NexT 主题:</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"><span class="hljs-built_in">cd</span> hexo-blog<br>git <span class="hljs-built_in">clone</span> https://github.com/iissnan/hexo-theme-next themes/next<br></code></pre></td></tr></table></figure>

<p>    打开 <code>_config.yml</code> ,将主题修改为 NexT:</p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs yml"><span class="hljs-attr">theme:</span> <span class="hljs-string">next</span><br></code></pre></td></tr></table></figure>

<p>    NexT 主题拥有丰富的插件,<a target="_blank" rel="noopener" href="https://www.luogu.com.cn/article/j7j5m2a3#:~:text=next%20%E4%B8%AD%E8%AE%B2%E8%A7%A3%E3%80%82-,next,-next%20%E6%98%AF%E4%B8%80%E4%B8%AA">洛谷日报 hexo+next搭建博客 </a> 有更多介绍。</p>
<h3 id="Fluid-主题"><a href="#Fluid-主题" class="headerlink" title="Fluid 主题"></a>Fluid 主题</h3><p>    下载 <a target="_blank" rel="noopener" href="https://github.com/fluid-dev/hexo-theme-fluid/releases">最新 Release 版本</a> 并解压至 <code>themes</code> 目录,并将解压出的文件夹重命名为 <code>fluid</code></p>
<h4 id="创建「关于页」"><a href="#创建「关于页」" class="headerlink" title="创建「关于页」"></a>创建「关于页」</h4><p>    首次使用主题的「关于页」需要手动创建:</p>
<h4 id="Fluid-主题"><a href="#Fluid-主题" class="headerlink" title="Fluid 主题"></a>Fluid 主题</h4><p>    下载 <a target="_blank" rel="noopener" href="https://github.com/fluid-dev/hexo-theme-fluid/releases">最新 Release 版本</a> 并解压至 <code>themes</code> 目录,并将解压出的文件夹重命名为 <code>fluid</code></p>
<h5 id="创建「关于页」"><a href="#创建「关于页」" class="headerlink" title="创建「关于页」"></a>创建「关于页」</h5><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">hexo new page about<br></code></pre></td></tr></table></figure>

<p>    创建成功后,编辑博客目录下 <code>/source/about/index.md</code>,添加 <code>layout</code> 属性。</p>
<p>    修改后的文件示例如下:</p>
<figure class="highlight markdown"><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></pre></td><td class="code"><pre><code class="hljs markdown">---<br>title: about<br>date: 2020-02-23 19:20:33<br><span class="hljs-section">layout: about</span><br><span class="hljs-section">---</span><br><br>这里写关于页的正文,支持 Markdown, HTML<br></code></pre></td></tr></table></figure>

<h2 id="4-创建文章"><a href="#4-创建文章" class="headerlink" title="4. 创建文章"></a>4. 创建文章</h2><p>    在博客目录下执行以下命令即可:</p>
<h3 id="4-创建文章"><a href="#4-创建文章" class="headerlink" title="4. 创建文章"></a>4. 创建文章</h3><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">hexo new post 测试文章<br></code></pre></td></tr></table></figure>

<p>    若要为每个文章建立专门的资源文件夹,请在配置中打开:</p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs yml"><span class="hljs-attr">post_asset_folder:</span> <span class="hljs-literal">true</span><br></code></pre></td></tr></table></figure>

<h2 id="5-个性化配置"><a href="#5-个性化配置" class="headerlink" title="5. 个性化配置"></a>5. 个性化配置</h2><p>    TODO…</p>
<h2 id="6-部署至Github"><a href="#6-部署至Github" class="headerlink" title="6. 部署至Github"></a>6. 部署至Github</h2><p>    在博客目录下执行:</p>
<h3 id="5-个性化配置"><a href="#5-个性化配置" class="headerlink" title="5. 个性化配置"></a>5. 个性化配置</h3><p>    TODO…</p>
<h2 id="部署"><a href="#部署" class="headerlink" title="部署"></a>部署</h2><h3 id="部署至Github"><a href="#部署至Github" class="headerlink" title="部署至Github"></a>部署至Github</h3><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">hexo g<br></code></pre></td></tr></table></figure>

<p>    然后将 <code>Public</code> 上传至 Github 即可。</p>
Expand Down Expand Up @@ -417,16 +417,16 @@ <h2 id="6-部署至Github"><a href="#6-部署至Github" class="headerlink" title
<article class="post-prev col-6">


<a href="/2024/07/24/%E6%A8%A1%E6%8B%9F%E8%B5%9B%E8%AE%B0%E5%BD%95/" title="模拟赛记录">
<i class="iconfont icon-arrowleft"></i>
<span class="hidden-mobile">模拟赛记录</span>
<span class="visible-mobile">上一篇</span>
</a>

</article>
<article class="post-next col-6">


<a href="/2024/07/21/hello-world/" title="Hello World">
<span class="hidden-mobile">Hello World</span>
<span class="visible-mobile">下一篇</span>
<i class="iconfont icon-arrowright"></i>
</a>

</article>
</div>

Expand Down
Loading

0 comments on commit e07b1ce

Please sign in to comment.