index.html 34.6 KB
Newer Older
T
TRHX 已提交
1
<!DOCTYPE html>
T
TRHX 已提交
2
<html>
T
TRHX 已提交
3
<head>
T
TRHX 已提交
4 5
  <meta charset="utf-8">
  <meta name="baidu-site-verification" content="L6Lm9d5Crl"/>
T
TRHX 已提交
6 7
  
  
T
TRHX 已提交
8 9 10 11 12
  
  
  <title>TRHX-Live And Learn!</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="天下事有难易乎?为之,则难者亦易矣;不为,则易者亦难矣!">
T
TRHX 已提交
13 14 15 16 17 18 19 20 21 22
<meta property="og:type" content="website">
<meta property="og:title" content="TRHX-Live And Learn!">
<meta property="og:url" content="http://yoursite.com/index.html">
<meta property="og:site_name" content="TRHX-Live And Learn!">
<meta property="og:description" content="天下事有难易乎?为之,则难者亦易矣;不为,则易者亦难矣!">
<meta property="og:locale" content="zh-CN">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="TRHX-Live And Learn!">
<meta name="twitter:description" content="天下事有难易乎?为之,则难者亦易矣;不为,则易者亦难矣!">
  
T
TRHX 已提交
23
    <link rel="alternative" href="/atom.xml" title="TRHX-Live And Learn!" type="application/atom+xml">
T
TRHX 已提交
24
  
T
TRHX 已提交
25
  
T
TRHX 已提交
26
    <link rel="icon" href="/img/favicon.png">
T
TRHX 已提交
27 28
  
  
T
TRHX 已提交
29
  <link rel="stylesheet" href="//cdn.bootcss.com/animate.css/3.5.0/animate.min.css">
T
TRHX 已提交
30
  
T
TRHX 已提交
31 32 33
  <link rel="stylesheet" href="/css/style.css">
  <link rel="stylesheet" href="/font-awesome/css/font-awesome.min.css">
  <link rel="apple-touch-icon" href="/apple-touch-icon.png">
T
TRHX 已提交
34 35
  
    
T
TRHX 已提交
36
    
T
TRHX 已提交
37 38
  
  
T
TRHX 已提交
39
      <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
T
TRHX 已提交
40
  
T
TRHX 已提交
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
  <!-- 加载特效 -->
    <script src="/js/pace.js"></script>
    <link href="/css/pace/pace-theme-flash.css" rel="stylesheet" />
  <script>
      var yiliaConfig = {
          fancybox: true,
          animate: true,
          isHome: true,
          isPost: false,
          isArchive: false,
          isTag: false,
          isCategory: false,
          open_in_new: false
      }
  </script>
</head>
<body>
  <div id="container">
    <div class="left-col">
    <div class="overlay"></div>
<div class="intrude-less">
    <header id="header" class="inner">
T
TRHX 已提交
63
        
T
TRHX 已提交
64
<script src="https://7.url.cn/edu/jslib/comb/require-2.1.6,jquery-1.9.1.min.js"></script>
T
TRHX 已提交
65

T
TRHX 已提交
66
        <a href="/" class="profilepic">
T
TRHX 已提交
67
            
T
TRHX 已提交
68
            <img lazy-src="/img/avatar.png" class="js-avatar">
T
TRHX 已提交
69
            
T
TRHX 已提交
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
        </a>
        <hgroup>
          <h1 class="header-author"><a href="/">TRHX</a></h1>
        </hgroup>
        
        <p class="header-subtitle">天下事有难易乎?为之,则难者亦易矣;不为,则易者亦难矣!</p>
        
        
            <form>
                <input type="text" class="st-default-search-input search" id="local-search-input" placeholder="搜索一下" autocomplete="off">
            </form>
            <div id="local-search-result"></div>
        
        
            <script type="text/javascript">
                (function() {
                    'use strict';
                    function getMatchData(keyword, data) {
                        var matchData = [];
                        for(var i =0;i<data.length;i++){
                            if(data[i].title.toLowerCase().indexOf(keyword)>=0) 
                                matchData.push(data[i])
                        }
                        return matchData;
                    }
                    var $input = $('#local-search-input');
                    var $resultContent = $('#local-search-result');
                    $input.keyup(function(){
                        $.ajax({
                            url: '/search.json',
                            dataType: "json",
                            success: function( json ) {
                                var str='<ul class=\"search-result-list\">';                
                                var keyword = $input.val().trim().toLowerCase();
                                $resultContent.innerHTML = "";
                                if ($input.val().trim().length <= 0) {
                                    $resultContent.empty();
                                    $('#switch-area').show();
                                    return;
                                }
                                var results = getMatchData(keyword, json);
                                if(results.length === 0){
                                    $resultContent.empty();
                                    $('#switch-area').show();
                                    return;
                                } 
                                for(var i =0; i<results.length; i++){
                                    str += "<li><a href='"+ results[i].url +"' class='search-result-title'>"+ results[i].title +"</a></li>";
                                }
                                str += "</ul>";
                                $resultContent.empty();
                                $resultContent.append(str);
                                $('#switch-area').hide();
                            }
                        });
                    });
                })();
            </script>
        
        
            <div id="switch-btn" class="switch-btn">
                <div class="icon">
                    <div class="icon-ctn">
                        <div class="icon-wrap icon-house" data-idx="0">
                            <div class="birdhouse"></div>
                            <div class="birdhouse_holes"></div>
                        </div>
                        <div class="icon-wrap icon-ribbon hide" data-idx="1">
                            <div class="ribbon"></div>
                        </div>
                        
                        <div class="icon-wrap icon-link hide" data-idx="2">
                            <div class="loopback_l"></div>
                            <div class="loopback_r"></div>
                        </div>
                        
                        
                        <div class="icon-wrap icon-me hide" data-idx="3">
                            <div class="user"></div>
                            <div class="shoulder"></div>
                        </div>
                        
                    </div>
                </div>
                <div class="tips-box hide">
                    <div class="tips-arrow"></div>
                    <ul class="tips-inner">
                        <li>菜单</li>
                        <li>标签</li>
                        
                        <li>友情链接</li>
                        
                        
                        <li>关于我</li>
                        
                    </ul>
                </div>
            </div>
        
        <div id="switch-area" class="switch-area">
            <div class="switch-wrap">
                <section class="switch-part switch-part1">
                    <nav class="header-menu">
                        <ul>
                        
                            <li><a  href="/archives/">所有文章</a></li>
                        
                            <li><a  href="/categories/开发工具/">开发工具</a></li>
                        
                            <li><a  href="/categories/digital">实用教程</a></li>
                        
                            <li><a  href="/categories/algorithm">Python学习</a></li>
                        
                            <li><a  href="/about/">关于我</a></li>
                        
                        </ul>
                    </nav>
                    <nav class="header-nav">
                        <ul class="social">
                            
                                <a class="fl github"  target="_blank" href="https://github.com/TRHX" title="github">github</a>
                            
                                <a class="fl CSDN"  target="_blank" href="https://blog.csdn.net/qq_36759224" title="CSDN">CSDN</a>
                            
                                <a class="fl rss"  target="_blank" href="/atom.xml" title="rss">rss</a>
                            
                        </ul>
                    </nav>
                </section>
                
                <section class="switch-part switch-part2">
                    <div class="widget tagcloud" id="js-tagcloud">
                        
                    </div>
                </section>
                
                
                <section class="switch-part switch-part3">
                    <div id="js-friends">
                    
                      <a target="_blank"  class="main-nav-link switch-friends-link" href="https://blog.csdn.net/qq_36759224">CSDN</a>
                    
                      <a target="_blank"  class="main-nav-link switch-friends-link" href="https://home.cnblogs.com/u/TRHX/">博客园</a>
                    
                      <a target="_blank"  class="main-nav-link switch-friends-link" href="https://github.com/TRHX">GitHub</a>
                    
                    </div>
                </section>
                
                
                
                <section class="switch-part switch-part4">
                
                    <div id="js-aboutme">Live And Learn!</div>
                </section>
                
            </div>
        </div>
    </header>
</div>
T
TRHX 已提交
230

T
TRHX 已提交
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247
    </div>
    <div class="mid-col">
      <nav id="mobile-nav">
      <div class="overlay">
          <div class="slider-trigger"></div>
          <h1 class="header-author js-mobile-header hide"><a href="/" title="回到主页">TRHX</a></h1>
      </div>
    <div class="intrude-less">
        <header id="header" class="inner">
            <a href="/" class="profilepic">
                
                    <img lazy-src="/img/avatar.png" class="js-avatar">
                
            </a>
            <hgroup>
              <h1 class="header-author"><a href="/" title="回到主页">TRHX</a></h1>
            </hgroup>
T
TRHX 已提交
248
            
T
TRHX 已提交
249
            <p class="header-subtitle">天下事有难易乎?为之,则难者亦易矣;不为,则易者亦难矣!</p>
T
TRHX 已提交
250
            
T
TRHX 已提交
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
            <nav class="header-menu">
                <ul>
                
                    <li><a href="/archives/">所有文章</a></li>
                
                    <li><a href="/categories/开发工具/">开发工具</a></li>
                
                    <li><a href="/categories/digital">实用教程</a></li>
                
                    <li><a href="/categories/algorithm">Python学习</a></li>
                
                    <li><a href="/about/">关于我</a></li>
                
                <div class="clearfix"></div>
                </ul>
            </nav>
            <nav class="header-nav">
                <div class="social">
                    
                        <a class="github" target="_blank" href="https://github.com/TRHX" title="github">github</a>
                    
                        <a class="CSDN" target="_blank" href="https://blog.csdn.net/qq_36759224" title="CSDN">CSDN</a>
                    
                        <a class="rss" target="_blank" href="/atom.xml" title="rss">rss</a>
                    
                </div>
            </nav>
        </header>
    </div>
</nav>
      <div class="body-wrap">
  
    <article id="post-如何使用Github Pages和Hexo搭建自己独立博客" class="article article-type-post" itemscope itemprop="blogPost">
  
    <div class="article-meta">
      <a  href="/2018/08/15/如何使用Github Pages和Hexo搭建自己独立博客/" class="article-date">
      <time datetime="2018-08-15T13:34:58.325Z" itemprop="datePublished">2018-08-15</time>
</a>
T
TRHX 已提交
289

T
TRHX 已提交
290 291 292
    </div>
  
  <div class="article-inner">
T
TRHX 已提交
293
    
T
TRHX 已提交
294
      <input type="hidden" class="isFancy" />
T
TRHX 已提交
295 296
    
    
T
TRHX 已提交
297
    <div class="article-entry" itemprop="articleBody">
T
TRHX 已提交
298 299
      
          
T
TRHX 已提交
300
        <center><font color="#000000" size="6" face="楷体">如何使用Github Pages和Hexo搭建自己独立博客</font></center>
T
TRHX 已提交
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

<hr>
<h1 id="前言"><a href="#前言" class="headerlink" title="- 前言"></a><strong>- 前言</strong></h1><p>首先感谢您能访问我的博客:<a href="http://trhx.github.io" target="_blank" rel="noopener">TRHX’Blog</a> <br></p>
<p>这是一篇有关如何使用 <font color="#DC143C">Github Pages</font><font color="#DC143C">Hexo</font> 搭建属于自己独立博客的详尽教程,本人是软件工程专业本科生,目前只学习了C和C++编程语言,对网站开发的有关知识几乎为零,这也是我搭建好自己的博客之后写的第一篇博客,刚开始搭建博客的时候自己也是网上各种百度,由于自己属于<font color="#DC143C"><strong>小白</strong></font>那种,历经了千辛万苦才弄好,所以借这个机会写一篇小白真正能看懂的博客搭建教程,教你一步一步走向成功的彼岸! <br></p>
<p>推荐文章:<a href="http://www.cnblogs.com/jhzhu/p/3893297.html" target="_blank" rel="noopener">《我为什么写博客》</a>  <a href="http://mindhacks.cn/2009/02/15/why-you-should-start-blogging-now/" target="_blank" rel="noopener">《为什么你应该(从现在开始就)写博客》</a> <br></p>
<h1 id="入门"><a href="#入门" class="headerlink" title="- 入门"></a><strong>- 入门</strong></h1><blockquote>
<p><strong>Github Pages</strong></p>
</blockquote>
<p>Github Pages可以被认为是用户编写的、托管在github上的静态网页。使用Github Pages可以为你提供一个免费的服务器,免去了自己搭建服务器和写数据库的麻烦。此外还可以绑定自己的域名。</p>
<blockquote>
<p><strong>Hexo</strong></p>
</blockquote>
<p>Hexo 是一个快速、简洁且高效的博客框架。Hexo 使用 Markdown(或其他渲染引擎)解析文章,在几秒内,即可利用靓丽的主题生成静态网页。</p>
<h2 id="话不多说,步入正题"><a href="#话不多说,步入正题" class="headerlink" title="话不多说,步入正题"></a>话不多说,步入正题</h2><h1 id="安装Node-js"><a href="#安装Node-js" class="headerlink" title="- 安装Node.js"></a>- 安装Node.js</h1><p><a href="https://nodejs.org/en/download/" target="_blank" rel="noopener">点击此处</a>访问官网,按需下载相应版本,默认安装可以了</p>
<p><img src="https://i.imgur.com/l9qbq4X.png" alt=""></p>
<p>注:本人在安装过程中出现了Warning 1909,无法创建快捷方式,这种情况很少出现,如果在安装过程中也有这种情况请参考百度文库(win10系统实测可行):<a href="https://wenku.baidu.com/view/4ad59110964bcf84b9d57ba5.html" target="_blank" rel="noopener">《Win7 安装程序快捷方式报错 警告1909,无法创建快捷方式》</a></p>
<p><img src="https://i.imgur.com/qzNCltv.png" alt=""></p>
<h1 id="安装Git"><a href="#安装Git" class="headerlink" title="- 安装Git"></a><strong>- 安装Git</strong></h1><p><a href="https://git-scm.com/download/win" target="_blank" rel="noopener">点击此处</a>访问官网,按需下载相应版本,默认安装即可 <br><br>参考资料:<a href="https://www.cnblogs.com/jytx/p/5602927.html" target="_blank" rel="noopener">《如何在windows下安装GIT》</a> <br><br>Git相关教程:<a href="http://git.oschina.net/progit/" target="_blank" rel="noopener">《Pro Git(中文版)》</a></p>
<h1 id="检验软件是否安装成功"><a href="#检验软件是否安装成功" class="headerlink" title="- 检验软件是否安装成功"></a><strong>- 检验软件是否安装成功</strong></h1><p>同时按下Win键和R键打开运行窗口,输入“cmd” ,然后输入以下命令,有相应版本信息显示则安装成功,若不正确可以卸载软件重新安装,此外若安装成功,在桌面右键鼠标,可以看到菜单里多了<font color="#DC143C">Git GUI Here</font><font color="#DC143C">Git Bash Here</font>两个选项,第一个是<font color="#DC143C">图形界面的Git操作</font>,另一个是<font color="#DC143C">命令行</font></p>
<blockquote>
<p>git –version <br><br>node -v       <br><br>npm -v        <br></p>
</blockquote>
<p><img src="https://i.imgur.com/MrqA2oy.png" alt=""><br><img src="https://i.imgur.com/EdKdq8c.png" alt=""></p>
<h1 id="Hexo安装"><a href="#Hexo安装" class="headerlink" title="- Hexo安装"></a><strong>- Hexo安装</strong></h1><p>选择一个磁盘,新建一个文件夹,自己重命名文件夹(如:我的文件夹为:E\TRHX_Blog),博客相关文件将储存在此文件夹下,在该文件夹下右键鼠标,点击 <font color="#DC143C">Git Bash Here</font>,输入以下npm命令即可安装,如图所示即为安装成功</p>
<blockquote>
<p>$ npm install hexo-cli -g          //安装hexo<br><br>$ npm install hexo-deployer-git –save   //安装hexo部署到git page的deployer</p>
</blockquote>
<p><img src="https://i.imgur.com/D4jX96g.png" alt=""></p>
<h1 id="Hexo初始化配置"><a href="#Hexo初始化配置" class="headerlink" title="- Hexo初始化配置"></a><strong>- Hexo初始化配置</strong></h1><p>在刚才新建的文件夹里面再次新建一个Hexo文件夹(如:我的文件夹为:E\TRHX_Blog\Hexo),进入该Hexo文件夹右键鼠标,点击 <font color="#DC143C">Git Bash Here</font>,输入以下命令,如图所示则安装成功</p>
<blockquote>
<p>$ hexo init</p>
</blockquote>
<p><img src="https://i.imgur.com/RL60g7o.png" alt=""><br></p>
<p>Hexo 安装完成后,将会在指定文件夹中新建所需要的文件,Hexo文件夹下的目录如下:</p>
<p><img src="https://i.imgur.com/x7h42wm.png" alt=""></p>
<h1 id="本地查看效果"><a href="#本地查看效果" class="headerlink" title="- 本地查看效果"></a><strong>- 本地查看效果</strong></h1><p>执行以下命令,执行完即可登录 localhost:4000 查看效果</p>
<blockquote>
<p>$ hexo generate <br><br>$ hexo server   <br></p>
</blockquote>
<p>显示以下信息说明操作成功:</p>
<blockquote>
<p>INFO Hexo is running at <a href="http://0.0.0.0:4000/" target="_blank" rel="noopener">http://0.0.0.0:4000/</a>. Press Ctrl+C to stop.</p>
</blockquote>
<p>登录 <a href="http://localhost:4000/查看效果:" target="_blank" rel="noopener">http://localhost:4000/查看效果:</a></p>
<p><img src="https://i.imgur.com/RnrEl8h.png" alt=""></p>
<h1 id="将博客部署到Github-Pages上"><a href="#将博客部署到Github-Pages上" class="headerlink" title="- 将博客部署到Github Pages上"></a><strong>- 将博客部署到Github Pages上</strong></h1><p>到目前为止,我们的本地博客就成功搭建了,但是现在我们只能通过本地连接查看博客,我们要做的是让其他人也能够访问我们的博客,这就需要我们将博客部署到Github Pages上<br></p>
<p>一、注册Github账户:<a href="https://github.com" target="_blank" rel="noopener">点击此处</a>访问Github官网,点击Sign Up注册账户<br></p>
<p>二、创建项目代码库:点击 <font color="#DC143C">New repository</font> 开始创建,步骤及注意事项见图:</p>
<p><img src="https://i.imgur.com/0FqXlSu.png" alt=""></p>
<p>三、配置SSH密钥:只有配置好ssh密钥后,我们才可以通过git操作实现本地代码库与Github代码库同步,在你第一次新建的文件夹里面 <font color="#DC143C">Git Bash Here</font> 输入以下命令:</p>
<blockquote>
<p>$ ssh-keygen -t rsa -C “your <a href="mailto:email@example.com" target="_blank" rel="noopener">email@example.com</a><br>        //引号里面填写你的邮箱地址,比如我的是<a href="mailto:tanrenhou@126.com" target="_blank" rel="noopener">tanrenhou@126.com</a></p>
</blockquote>
<p>之后会出现:</p>
<blockquote>
<p>Generating public/private rsa key pair.<br><br>Enter file in which to save the key (/c/Users/you/.ssh/id_rsa):    //到这里可以直接回车将密钥按默认文件进行存储</p>
</blockquote>
<p>然后会出现:</p>
<blockquote>
<p>Enter passphrase (empty for no passphrase):           //这里是要你输入密码,其实不需要输什么密码,直接回车就行<br><br>Enter same passphrase again: </p>
</blockquote>
<p>接下来屏幕会显示:</p>
<blockquote>
<p>Your identification has been saved in /c/Users/you/.ssh/id_rsa.<br><br>Your public key has been saved in /c/Users/you/.ssh/id_rsa.pub.<br><br>The key fingerprint is:<br><br>这里是各种字母数字组成的字符串,结尾是你的邮箱<br><br>The key’s randomart image is:<br><br>这里也是各种字母数字符号组成的字符串</p>
</blockquote>
<p>运行以下命令,将公钥的内容复制到系统粘贴板上</p>
<blockquote>
<p>$ clip &lt; ~/.ssh/id_rsa.pub</p>
</blockquote>
<p>四、在GitHub账户中添加你的公钥<br></p>
<p>1.登陆GitHub,进入你的账户设置:</p>
<p><img src="https://i.imgur.com/jzyEME2.png" alt=""></p>
<p>2.点击SSH and GPG Keys:</p>
<p><img src="https://i.imgur.com/4PAjGms.png" alt=""></p>
<p>3.选择New SSH key:</p>
<p><img src="https://i.imgur.com/CYnhV4W.png" alt=""></p>
<p>3.粘贴密钥:</p>
<p><img src="https://i.imgur.com/vnTjW4z.png" alt=""></p>
<p>五、测试</p>
<p>输入以下命令:注意:<a href="mailto:git@github.com" target="_blank" rel="noopener">git@github.com</a>不要做任何更改!</p>
<blockquote>
<p>$ ssh -T <a href="mailto:git@github.com" target="_blank" rel="noopener">git@github.com</a></p>
</blockquote>
<p>之后会显示:</p>
<p><img src="https://i.imgur.com/NLHp4nz.png" alt=""></p>
<p>输入yes后会显示:</p>
<p><img src="https://i.imgur.com/UJt5utl.png" alt=""></p>
<p>此时表示设置正确</p>
<p>六、配置Git个人信息</p>
<p>Git会根据用户的名字和邮箱来记录提交,GitHub也是用这些信息来做权限的处理,输入以下命令进行个人信息的设置,把名称和邮箱替换成你自己的,名字可以不是GitHub的昵称,但为了方便记忆,建议与GitHub一致</p>
<blockquote>
<p>$ git config –global user.name “此处填你的用户名”<br><br>$ git config –global user.email  “此处填你的邮箱”</p>
</blockquote>
<p>到此为止SSH Key配置成功,本机已成功连接到github</p>
<h1 id="将本地的Hexo文件更新到Github的库中"><a href="#将本地的Hexo文件更新到Github的库中" class="headerlink" title="- 将本地的Hexo文件更新到Github的库中"></a><strong>- 将本地的Hexo文件更新到Github的库中</strong></h1><p>一、登录Github打开自己的项目 your name.github.io</p>
<p><img src="https://i.imgur.com/KWeHGF1.png" alt=""></p>
<p>二、鼠标移到 Clone or download 按钮,选择Use SSH</p>
<p><img src="https://i.imgur.com/nNRZVDQ.png" alt=""></p>
<p>三、一键复制地址</p>
<p><img src="https://i.imgur.com/ulwSVjM.png" alt=""></p>
<p>四、打开你创建的Hexo文件夹(如我的路径是:E:\TRHX_Blog\Hexo),右键用记事本(或者Notepad++)打开该文件夹下的_config.yml文件</p>
<p><img src="https://i.imgur.com/DtH87DK.png" alt=""></p>
<p>五、按下图修改 _config.yml 文件并保存</p>
<p><img src="https://i.imgur.com/7vbeY3N.png" alt=""></p>
<p>六、在Hexo文件夹下分别执行以下命令</p>
<blockquote>
<p>$ hexo g <br><br>$ hexo d</p>
</blockquote>
<p>或者直接执行</p>
<blockquote>
<p>$ hexo g -d</p>
</blockquote>
<p>执行完之后会让你输入你的github的账号和密码</p>
<p>如果此时报以下错误,说明你的deployer没有安装成功</p>
<blockquote>
<p>ERROR Deployer not found: git</p>
</blockquote>
<p>需要执行以下命令再安装一次:</p>
<blockquote>
<p>npm install hexo-deployer-git –save</p>
</blockquote>
<p>再执行hexo g -d,你的博客就会部署到Github上了</p>
<p>七、访问博客</p>
<p>你的博客地址:<font color="#DC143C">https://你的用户名.github.io</font>,比如我的是:<font color="#DC143C"><a href="https://trhx.github.io" target="_blank" rel="noopener">https://trhx.github.io</a></font>,现在每个人都可以通过此链接访问你的博客了</p>
<h1 id="如何在博客上发表文章"><a href="#如何在博客上发表文章" class="headerlink" title="- 如何在博客上发表文章"></a><strong>- 如何在博客上发表文章</strong></h1><p>博客已经成功搭建了,但是我们该怎么写博客呢?</p>
<p>一、新建一个空文章,输入以下命令,会在项目 <font color="#DC143C">\Hexo\source_posts</font> 中生成 <font color="#DC143C">文章标题.md</font> 文件,文章标题根据需要命名</p>
<blockquote>
<p>$ hexo n “文章标题”</p>
</blockquote>
<p>也可以直接在 <font color="#DC143C">\Hexo\source_posts</font> 目录下右键鼠标新建文本文档,改后缀为 <font color="#DC143C">.md</font> 即可,这种方法比较方便</p>
<p>二、用编辑器编写文章</p>
<p><font color="#DC143C">md</font>全称 Markdown, Markdown 是 2004 年由 John Gruberis 设计和开发的纯文本格式的语法,非常的简单实用,常用的标记符号屈指可数,几分钟即可学会, <font color="#DC143C">.md</font>文件可以使用支持 Markdown 语法的编辑器编辑,然后保存文件到 <font color="#DC143C">\Hexo\source_posts</font> 文件夹下即可</p>
<p>推荐windows上使用 MarkdownPad2 编辑器,macOS 上使用 Mou 编辑器,Web 端上使用简书 </p>
<p>当我们用编辑器写好文章后,可以使用以下命令将其推送到服务器上</p>
<blockquote>
<p>$ hexo g <br><br>$ hexo d</p>
</blockquote>
<p>或者将两个命令合二为一</p>
<blockquote>
<p>$ hexo d -g </p>
</blockquote>
<p>现在访问你的博客就可以看见写好的文章啦!</p>
<p>相关资料:<a href="https://blog.csdn.net/jinhui157/article/details/73872795" target="_blank" rel="noopener">《10款流行的Markdown编辑器,总有一款适合你》</a><br><br>     <a href="https://www.jianshu.com/p/q81RER/" target="_blank" rel="noopener">《献给写作者的 Markdown 新手指南》</a><br><br>     <a href="https://sspai.com/post/25137" target="_blank" rel="noopener">《认识与入门 Markdown》</a><br><br>     <a href="http://ibruce.info/2013/11/26/markdown/" target="_blank" rel="noopener">《markdown简明语法》</a><br><br>     <a href="https://www.jianshu.com/p/191d1e21f7ed" target="_blank" rel="noopener">《markdown基本语法》</a><br><br>     <a href="http://www.liuhaihua.cn/archives/143443.html" target="_blank" rel="noopener">《Markdown 公式指导手册》</a><br>
     
     </p>
<h1 id="如何为博客更换自己喜欢的主题"><a href="#如何为博客更换自己喜欢的主题" class="headerlink" title="- 如何为博客更换自己喜欢的主题"></a><strong>- 如何为博客更换自己喜欢的主题</strong></h1><p>但是默认的主题并不喜欢怎么办?</p>

      
    </div>
    
T
TRHX 已提交
451 452 453
    <div class="article-info article-info-index">
      
      
T
TRHX 已提交
454

T
TRHX 已提交
455 456 457 458
      
      
      <div class="clearfix"></div>
    </div>
T
TRHX 已提交
459
    
T
TRHX 已提交
460 461 462 463
  </div>
  
</article>

T
TRHX 已提交
464 465 466 467 468 469 470 471 472 473 474










  
T
TRHX 已提交
475
    <article id="post-博客测试" class="article article-type-post" itemscope itemprop="blogPost">
T
TRHX 已提交
476
  
T
TRHX 已提交
477 478 479 480
    <div class="article-meta">
      <a  href="/2018/08/12/博客测试/" class="article-date">
      <time datetime="2018-08-12T09:32:06.978Z" itemprop="datePublished">2018-08-12</time>
</a>
T
TRHX 已提交
481

T
TRHX 已提交
482
    </div>
T
TRHX 已提交
483
  
T
TRHX 已提交
484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506
  <div class="article-inner">
    
      <input type="hidden" class="isFancy" />
    
    
    <div class="article-entry" itemprop="articleBody">
      
          
        <h1 id="标题标题"><a href="#标题标题" class="headerlink" title="标题标题"></a>标题标题</h1><p><img src="https://i.imgur.com/tkCOntp.jpg" alt=""><br>#</p>
<h1 id="博客测试"><a href="#博客测试" class="headerlink" title="博客测试"></a>博客测试</h1>
      
    </div>
    
    <div class="article-info article-info-index">
      
      

      
      
      <div class="clearfix"></div>
    </div>
    
  </div>
T
TRHX 已提交
507
  
T
TRHX 已提交
508
</article>
T
TRHX 已提交
509 510 511 512 513 514 515 516 517 518 519











T
TRHX 已提交
520 521 522 523 524 525 526
  
    <article id="post-hello-world" class="article article-type-post" itemscope itemprop="blogPost">
  
    <div class="article-meta">
      <a  href="/2018/08/10/hello-world/" class="article-date">
      <time datetime="2018-08-10T09:33:18.448Z" itemprop="datePublished">2018-08-10</time>
</a>
T
TRHX 已提交
527

T
TRHX 已提交
528
    </div>
T
TRHX 已提交
529 530
  
  <div class="article-inner">
T
TRHX 已提交
531
    
T
TRHX 已提交
532
      <input type="hidden" class="isFancy" />
T
TRHX 已提交
533 534
    
    
T
TRHX 已提交
535 536
      <header class="article-header">
        
T
TRHX 已提交
537
  
T
TRHX 已提交
538 539 540
    <h1 itemprop="name">
      <a  class="article-title" href="/2018/08/10/hello-world/">Hello World</a>
    </h1>
T
TRHX 已提交
541
  
T
TRHX 已提交
542 543


T
TRHX 已提交
544
      </header>
T
TRHX 已提交
545
      
T
TRHX 已提交
546 547
    
    <div class="article-entry" itemprop="articleBody">
T
TRHX 已提交
548 549
      
          
T
TRHX 已提交
550
        <p>Welcome to <a href="https://hexo.io/" target="_blank" rel="noopener">Hexo</a>! This is your very first post. Check <a href="https://hexo.io/docs/" target="_blank" rel="noopener">documentation</a> for more info. If you get any problems when using Hexo, you can find the answer in <a href="https://hexo.io/docs/troubleshooting.html" target="_blank" rel="noopener">troubleshooting</a> or you can ask me on <a href="https://github.com/hexojs/hexo/issues" target="_blank" rel="noopener">GitHub</a>.</p>
T
TRHX 已提交
551 552 553 554 555 556 557 558 559 560 561 562
<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" target="_blank" rel="noopener">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" target="_blank" rel="noopener">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" target="_blank" rel="noopener">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/deployment.html" target="_blank" rel="noopener">Deployment</a></p>

      
    </div>
    
T
TRHX 已提交
563
    <div class="article-info article-info-index">
T
TRHX 已提交
564
      
T
TRHX 已提交
565 566 567 568
      

      
      
T
TRHX 已提交
569
      <div class="clearfix"></div>
T
TRHX 已提交
570 571
    </div>
    
T
TRHX 已提交
572
  </div>
T
TRHX 已提交
573
  
T
TRHX 已提交
574
</article>
T
TRHX 已提交
575 576 577 578 579 580 581 582 583 584 585











T
TRHX 已提交
586 587
  
  
T
TRHX 已提交
588

T
TRHX 已提交
589 590 591 592 593 594 595 596 597 598 599
</div>
      <footer id="footer">
    <div class="outer">
        <div id="footer-info">
            <div class="footer-left">
                &copy; 2018 TRHX
            </div>
            <div class="footer-right">
                <a href="http://hexo.io/" target="_blank">Hexo &nbsp;&nbsp;</a><a href="https://github.com/maochunguang" target="_blank">Blog</a> by tommy
            </div>
        </div>
T
TRHX 已提交
600
        
T
TRHX 已提交
601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619
            <div class="visit">
                
                    <span id="busuanzi_container_site_pv" style='display:none'>
                        <span id="site-visit" >极客到访数: 
                            <span id="busuanzi_value_site_uv"></span>
                        </span>
                    </span>
                
                
                    <span>, </span>
                
                
                    <span id="busuanzi_container_page_pv" style='display:none'>
                        <span id="page-visit">本页阅读量: 
                            <span id="busuanzi_value_page_pv"></span>
                        </span>
                    </span>
                
            </div>
T
TRHX 已提交
620
        
T
TRHX 已提交
621 622
    </div>
</footer>
T
TRHX 已提交
623

T
TRHX 已提交
624
    </div>
T
TRHX 已提交
625
    
T
TRHX 已提交
626
<script src="https://7.url.cn/edu/jslib/comb/require-2.1.6,jquery-1.9.1.min.js"></script>
T
TRHX 已提交
627

T
TRHX 已提交
628
<script src="/js/main.js"></script>
T
TRHX 已提交
629

T
TRHX 已提交
630 631 632 633 634 635 636 637
    <script>
        $(document).ready(function() {
            var backgroundnum = 1;
            var backgroundimg = "url(/background/bg-x.jpg)".replace(/x/gi, Math.ceil(Math.random() * backgroundnum));
            $("#mobile-nav").css({"background-image": backgroundimg,"background-size": "cover","background-position": "center"});
            $(".left-col").css({"background-image": backgroundimg,"background-size": "cover","background-position": "center"});
        })
    </script>
T
TRHX 已提交
638 639


T
TRHX 已提交
640
<!-- Google Analytics -->
T
TRHX 已提交
641
<script type="text/javascript">
T
TRHX 已提交
642 643 644 645
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
T
TRHX 已提交
646

T
TRHX 已提交
647 648
ga('create', 'xxxxx', 'auto');
ga('send', 'pageview');
T
TRHX 已提交
649

T
TRHX 已提交
650 651
</script>
<!-- End Google Analytics -->
T
TRHX 已提交
652 653 654



T
TRHX 已提交
655 656 657 658 659 660 661 662 663
	<script>
	var _hmt = _hmt || [];
	(function() {
	  var hm = document.createElement("script");
	  hm.src = "//hm.baidu.com/hm.js?xxxxxx";
	  var s = document.getElementsByTagName("script")[0]; 
	  s.parentNode.insertBefore(hm, s);
	})();
	</script>
T
TRHX 已提交
664 665 666



T
TRHX 已提交
667 668 669 670 671 672 673 674 675 676 677 678
<div class="scroll" id="scroll">
    <a href="#"><i class="fa fa-arrow-up"></i></a>
    <a href="#comments"><i class="fa fa-comments-o"></i></a>
    <a href="#footer"><i class="fa fa-arrow-down"></i></a>
</div>
<script>
    $(document).ready(function() {
        if ($("#comments").length < 1) {
            $("#scroll > a:nth-child(2)").hide();
        };
    })
</script>
T
TRHX 已提交
679

T
TRHX 已提交
680 681
<script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js">
</script>
T
TRHX 已提交
682

T
TRHX 已提交
683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706
  <script language="javascript">
    $(function() {
        $("a[title]").each(function() {
            var a = $(this);
            var title = a.attr('title');
            if (title == undefined || title == "") return;
            a.data('title', title).removeAttr('title').hover(
            function() {
                var offset = a.offset();
                $("<div id=\"anchortitlecontainer\"></div>").appendTo($("body")).html(title).css({
                    top: offset.top - a.outerHeight() - 15,
                    left: offset.left + a.outerWidth()/2 + 1
                }).fadeIn(function() {
                    var pop = $(this);
                    setTimeout(function() {
                        pop.remove();
                    }, pop.text().length * 800);
                });
            }, function() {
                $("#anchortitlecontainer").remove();
            });
        });
    });
</script>
T
TRHX 已提交
707 708


T
TRHX 已提交
709
  </div>
T
TRHX 已提交
710
</body>
T
TRHX 已提交
711
</html>