1 Star 0 Fork 0

Barry / barry-blog

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
index.html 35.08 KB
一键复制 编辑 原始数据 按行查看 历史
rankun 提交于 2019-05-22 13:47 . Site updated: 2019-05-22 13:47:32
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846
<!DOCTYPE html>
<html class="theme-next muse use-motion" lang>
<head><meta name="generator" content="Hexo 3.8.0">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">
<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
<link href="/barry-blog/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">
<link href="/barry-blog/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">
<link href="/barry-blog/css/main.css?v=5.1.4" rel="stylesheet" type="text/css">
<link rel="apple-touch-icon" sizes="180x180" href="/barry-blog/images/apple-touch-icon-next.png?v=5.1.4">
<link rel="icon" type="image/png" sizes="32x32" href="/barry-blog/images/favicon-32x32-next.png?v=5.1.4">
<link rel="icon" type="image/png" sizes="16x16" href="/barry-blog/images/favicon-16x16-next.png?v=5.1.4">
<link rel="mask-icon" href="/barry-blog/images/logo.svg?v=5.1.4" color="#222">
<meta name="keywords" content="Hexo, NexT">
<meta property="og:type" content="website">
<meta property="og:title" content="Barry的技术博客">
<meta property="og:url" content="http://barryda.gitee.io/barry-blog/index.html">
<meta property="og:site_name" content="Barry的技术博客">
<meta property="og:locale" content="default">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Barry的技术博客">
<script type="text/javascript" id="hexo.configurations">
var NexT = window.NexT || {};
var CONFIG = {
root: '/barry-blog/',
scheme: 'Muse',
version: '5.1.4',
sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
fancybox: true,
tabs: true,
motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
duoshuo: {
userId: '0',
author: 'Author'
},
algolia: {
applicationID: '',
apiKey: '',
indexName: '',
hits: {"per_page":10},
labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
}
};
</script>
<link rel="canonical" href="http://barryda.gitee.io/barry-blog/">
<title>Barry的技术博客</title>
</head>
<body itemscope itemtype="http://schema.org/WebPage" lang="default">
<div class="container sidebar-position-left
page-home">
<div class="headband"></div>
<header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
<div class="header-inner"><div class="site-brand-wrapper">
<div class="site-meta ">
<div class="custom-logo-site-title">
<a href="/barry-blog/" class="brand" rel="start">
<span class="logo-line-before"><i></i></span>
<span class="site-title">Barry的技术博客</span>
<span class="logo-line-after"><i></i></span>
</a>
</div>
<p class="site-subtitle"></p>
</div>
<div class="site-nav-toggle">
<button>
<span class="btn-bar"></span>
<span class="btn-bar"></span>
<span class="btn-bar"></span>
</button>
</div>
</div>
<nav class="site-nav">
<ul id="menu" class="menu">
<li class="menu-item menu-item-home">
<a href="/barry-blog/" rel="section">
<i class="menu-item-icon fa fa-fw fa-home"></i> <br>
Home
</a>
</li>
<li class="menu-item menu-item-archives">
<a href="/barry-blog/archives/" rel="section">
<i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
Archives
</a>
</li>
</ul>
</nav>
</div>
</header>
<main id="main" class="main">
<div class="main-inner">
<div class="content-wrap">
<div id="content" class="content">
<section id="posts" class="posts-expand">
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<div class="post-block">
<link itemprop="mainEntityOfPage" href="http://barryda.gitee.io/barry-blog/barry-blog/2019/05/22/Hexo搭建个人博客/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="Barry">
<meta itemprop="description" content>
<meta itemprop="image" content="/barry-blog/images/avatar.gif">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Barry的技术博客">
</span>
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/barry-blog/2019/05/22/Hexo搭建个人博客/" itemprop="url">Untitled</a></h1>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Post created" itemprop="dateCreated datePublished" datetime="2019-05-22T13:46:10+08:00">
2019-05-22
</time>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<h1 id="Hexo-博客搭建指南"><a href="#Hexo-博客搭建指南" class="headerlink" title="Hexo 博客搭建指南"></a>Hexo 博客搭建指南</h1><p>Hexo的简洁、神秘让我跃跃欲试,在使用过程中遇到了很多问题,整理此文,一是方便其他技术人搭建自己的博客,二是给自己的学习之旅做个总结。本文<strong>未完结</strong>,欢迎<code>star</code><code>fork</code>,如果有错误,请不吝指出。<br>我搭建的博客地址:<a href="https://limedroid.github.io" target="_blank" rel="noopener"><strong>limedroid.github.io</strong></a></p>
<p align="center"><br> <img src="art/snapshot_1.png" alt="Hexo_Learning"><br></p><br><p align="center"><br> <img src="art/snapshot_2.png" alt="Hexo_Learning"><br></p><br><p align="center"><br> <img src="art/snapshot_3.png" alt="Hexo_Learning"><br></p>
<h2 id="1-Hexo介绍"><a href="#1-Hexo介绍" class="headerlink" title="1 Hexo介绍"></a>1 Hexo介绍</h2><p><a href="https://hexo.io/zh-cn/" target="_blank" rel="noopener">Hexo</a>是基于<code>NodeJs</code>的静态博客框架,简单、轻量,其生成的静态网页可以托管在<code>Github</code><code>Heroku</code>上。</p>
<ul>
<li>超快速度</li>
<li>支持MarkDown</li>
<li>一键部署</li>
<li>丰富的插件</li>
</ul>
<blockquote>
<p>下面以我的博客为例,limedroid.github.io</p>
</blockquote>
<h2 id="2-环境准备"><a href="#2-环境准备" class="headerlink" title="2 环境准备"></a>2 环境准备</h2><h3 id="2-1-安装node-js"><a href="#2-1-安装node-js" class="headerlink" title="2.1 安装node.js"></a>2.1 安装node.js</h3><p><a href="https://nodejs.org/en/download/" target="_blank" rel="noopener">nodejs官网</a>下载对应系统的安装包,按提示安装。</p>
<p>检验安装成功:<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ node -v</span><br></pre></td></tr></table></figure></p>
<h3 id="2-2-安装hexo"><a href="#2-2-安装hexo" class="headerlink" title="2.2 安装hexo"></a>2.2 安装hexo</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ npm install hexo-cli -g</span><br></pre></td></tr></table></figure>
<p>注意:Mac系统,则需要<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ sudo npm install hexo-cli -g</span><br></pre></td></tr></table></figure></p>
<h2 id="3-利用Hexo搭建一个博客"><a href="#3-利用Hexo搭建一个博客" class="headerlink" title="3 利用Hexo搭建一个博客"></a>3 利用Hexo搭建一个博客</h2><h3 id="3-1-创建博客目录limedroid-github-io"><a href="#3-1-创建博客目录limedroid-github-io" class="headerlink" title="3.1 创建博客目录limedroid.github.io"></a>3.1 创建博客目录<code>limedroid.github.io</code></h3><figure class="highlight plain"><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">$ hexo init limedroid.github.io</span><br><span class="line">$ cd limedroid.github.io</span><br><span class="line">$ npm install</span><br></pre></td></tr></table></figure>
<h3 id="3-2-生成静态页面"><a href="#3-2-生成静态页面" class="headerlink" title="3.2 生成静态页面"></a>3.2 生成静态页面</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">$ hexo clean</span><br><span class="line">$ hexo g</span><br></pre></td></tr></table></figure>
<blockquote>
<p>g 即generate</p>
</blockquote>
<h3 id="3-3-运行"><a href="#3-3-运行" class="headerlink" title="3.3 运行"></a>3.3 运行</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo s</span><br></pre></td></tr></table></figure>
<blockquote>
<p>s 即server</p>
</blockquote>
<p>然后打开浏览器,输入地址 <strong>localhost:4000</strong> 即可看到效果</p>
<h2 id="4-发一篇文章试试"><a href="#4-发一篇文章试试" class="headerlink" title="4 发一篇文章试试"></a>4 发一篇文章试试</h2><h3 id="4-1-命令方式"><a href="#4-1-命令方式" class="headerlink" title="4.1 命令方式"></a>4.1 命令方式</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo new test</span><br></pre></td></tr></table></figure>
<p>此时会在<code>source/_posts</code>目录下生成<code>test.md</code>文件,输入些许内容,然后保存.</p>
<p>生成下,看看效果</p>
<figure class="highlight plain"><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">$ hexo clean</span><br><span class="line">$ hexo g</span><br><span class="line">$ hexo s</span><br></pre></td></tr></table></figure>
<p>访问 <strong>localhost:4000</strong> 即可</p>
<h3 id="4-2-直接方式"><a href="#4-2-直接方式" class="headerlink" title="4.2 直接方式"></a>4.2 直接方式</h3><p><strong>source/_posts/</strong>下新建一个<code>.md</code>文件也可</p>
<h2 id="5-配置"><a href="#5-配置" class="headerlink" title="5 配置"></a>5 配置</h2><p>网站的设置大部分都在<strong>_config.yml</strong>文件中,详细配置可以查看<a href="https://hexo.io/zh-cn/docs/configuration.html" target="_blank" rel="noopener">官方文档</a></p>
<p>下面只列出简单常用配置</p>
<ul>
<li><strong>title</strong> -&gt; 网站标题</li>
<li><strong>subtitle</strong> -&gt; 网站副标题</li>
<li><strong>description</strong> -&gt; 网站描述</li>
<li><strong>author</strong> -&gt; 您的名字</li>
<li><strong>language</strong> -&gt; 网站使用的语言</li>
</ul>
<p>坑:<strong>进行配置时,需要在冒号:后加一个英文空格</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">title: Droidlover</span><br></pre></td></tr></table></figure>
<h2 id="6-换一个好看的主题"><a href="#6-换一个好看的主题" class="headerlink" title="6 换一个好看的主题"></a>6 换一个好看的主题</h2><p>Hexo 中有很多主题,可以在<a href="https://hexo.io/themes/" target="_blank" rel="noopener">官网</a>查看。<br>这里我推荐<a href="https://github.com/iissnan/hexo-theme-next" target="_blank" rel="noopener">hexo-theme-next</a>,下面列举更换主题的一般套路:</p>
<h3 id="6-1-下载主题资源"><a href="#6-1-下载主题资源" class="headerlink" title="6.1 下载主题资源"></a>6.1 下载主题资源</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ git clone https://github.com/iissnan/hexo-theme-next themes/next</span><br></pre></td></tr></table></figure>
<h3 id="6-2-应用下载的主题"><a href="#6-2-应用下载的主题" class="headerlink" title="6.2 应用下载的主题"></a>6.2 应用下载的主题</h3><p>在网站配置文件<strong>_config.yml</strong>中,配置<strong>theme</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">theme: next</span><br></pre></td></tr></table></figure>
<blockquote>
<p>next是主题名称,具体的可查看主题的文档</p>
</blockquote>
<h3 id="6-3-主题其他配置"><a href="#6-3-主题其他配置" class="headerlink" title="6.3 主题其他配置"></a>6.3 主题其他配置</h3><p>可在<code>/theme/{theme}/_config.yml</code> 主题的配置文件下进行主题的配置。</p>
<p>接下来,可以执行万能的调试命令看看效果</p>
<figure class="highlight plain"><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">$ hexo clean</span><br><span class="line">$ hexo g</span><br><span class="line">$ hexo s</span><br></pre></td></tr></table></figure>
<h2 id="7-部署到Github"><a href="#7-部署到Github" class="headerlink" title="7 部署到Github"></a>7 部署到Github</h2><h3 id="7-1-有个github账号xxx"><a href="#7-1-有个github账号xxx" class="headerlink" title="7.1 有个github账号xxx"></a>7.1 有个github账号xxx</h3><h3 id="7-2-创建一个xxx-github-io的public仓库"><a href="#7-2-创建一个xxx-github-io的public仓库" class="headerlink" title="7.2 创建一个xxx.github.io的public仓库"></a>7.2 创建一个xxx.github.io的public仓库</h3><p>如果您的账户名是limedroid,则需要创建一个limedroid.github.io的public仓库.</p>
<h3 id="7-3-安装-hexo-deployer-git"><a href="#7-3-安装-hexo-deployer-git" class="headerlink" title="7.3 安装 hexo-deployer-git"></a>7.3 安装 <a href="https://github.com/hexojs/hexo-deployer-git" target="_blank" rel="noopener">hexo-deployer-git</a></h3><figure class="highlight plain"><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>
<h3 id="7-4-网站配置git"><a href="#7-4-网站配置git" class="headerlink" title="7.4 网站配置git"></a>7.4 网站配置git</h3><p>在网站的<code>_config.yml</code>中配置deploy</p>
<figure class="highlight plain"><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"> repo: &lt;repository url&gt;</span><br><span class="line"> branch: [branch]</span><br></pre></td></tr></table></figure>
<blockquote>
<p><code>branch</code>为分支,默认为<code>master</code>,可以不配置<br><code>repo</code>为仓库地址,在github上新建仓库后,可复制此地址</p>
</blockquote>
<h3 id="7-5-部署"><a href="#7-5-部署" class="headerlink" title="7.5 部署"></a>7.5 部署</h3><figure class="highlight plain"><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>
<blockquote>
<p>d 即deploy</p>
</blockquote>
<h2 id="8-贴标签,方便搜索"><a href="#8-贴标签,方便搜索" class="headerlink" title="8 贴标签,方便搜索"></a>8 贴标签,方便搜索</h2><h3 id="8-1-两个确认"><a href="#8-1-两个确认" class="headerlink" title="8.1 两个确认"></a>8.1 两个确认</h3><ul>
<li><p>确认站点配置文件有 </p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">tag_dir: tags</span><br></pre></td></tr></table></figure>
</li>
<li><p>确认主题配置文件有</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">tags: tags</span><br></pre></td></tr></table></figure>
</li>
</ul>
<h3 id="8-2-新建tags页面"><a href="#8-2-新建tags页面" class="headerlink" title="8.2 新建tags页面"></a>8.2 新建tags页面</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo new page tags</span><br></pre></td></tr></table></figure>
<p>此时会在<code>source/</code>下生成<code>tags/index.md</code>文件</p>
<h3 id="8-3-修改source-tags-index-md"><a href="#8-3-修改source-tags-index-md" class="headerlink" title="8.3 修改source/tags/index.md"></a>8.3 修改source/tags/index.md</h3><figure class="highlight plain"><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">title: tags</span><br><span class="line">date: 2015-10-20 06:49:50</span><br><span class="line">type: &quot;tags&quot;</span><br><span class="line">comments: false</span><br></pre></td></tr></table></figure>
<blockquote>
<p>date 可保持系统生成的时间,<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">type: &quot;tags&quot;</span><br><span class="line">comments: false</span><br></pre></td></tr></table></figure></p>
</blockquote>
<p>很重要</p>
<h3 id="8-4-在文章中添加tags"><a href="#8-4-在文章中添加tags" class="headerlink" title="8.4 在文章中添加tags"></a>8.4 在文章中添加tags</h3><p>在文章<code>xx.md</code>中添加:</p>
<figure class="highlight plain"><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">tags: </span><br><span class="line"> - Tag1</span><br><span class="line"> - Tag2</span><br><span class="line"> - Tag3</span><br></pre></td></tr></table></figure>
<p>多个Tag可按上面的格式添加。</p>
<p>其文件头部类似:</p>
<figure class="highlight plain"><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">title: TagEditText</span><br><span class="line">date: 2016-11-19 10:44:25</span><br><span class="line">tags: </span><br><span class="line"> - Tag1</span><br><span class="line"> - Tag2</span><br><span class="line"> - Tag3</span><br></pre></td></tr></table></figure>
<h2 id="9-分类,给文章归档"><a href="#9-分类,给文章归档" class="headerlink" title="9 分类,给文章归档"></a>9 分类,给文章归档</h2><h3 id="9-1-两个确认"><a href="#9-1-两个确认" class="headerlink" title="9.1 两个确认"></a>9.1 两个确认</h3><ul>
<li><p>确认站点配置文件打开了</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">category_dir: categories</span><br></pre></td></tr></table></figure>
</li>
<li><p>确认主题配置文件打开了</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">categories: /categories</span><br></pre></td></tr></table></figure>
</li>
</ul>
<h3 id="9-2-新建categories文件"><a href="#9-2-新建categories文件" class="headerlink" title="9.2 新建categories文件"></a>9.2 新建categories文件</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo new page categories</span><br></pre></td></tr></table></figure>
<p>此时会在<code>source</code>目录下生成<code>categories/index.md</code>文件</p>
<h3 id="9-3-修改categories-index-md"><a href="#9-3-修改categories-index-md" class="headerlink" title="9.3 修改categories/index.md"></a>9.3 修改categories/index.md</h3><figure class="highlight plain"><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">title: categories</span><br><span class="line">date: 2015-10-20 06:49:50</span><br><span class="line">type: &quot;categories&quot;</span><br><span class="line">comments: false</span><br></pre></td></tr></table></figure>
<blockquote>
<p>date 可保持系统生成的时间,<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">type: &quot;categories&quot;</span><br><span class="line">comments: false</span><br></pre></td></tr></table></figure></p>
</blockquote>
<p>很重要</p>
<h3 id="9-4-在文章中添加categories"><a href="#9-4-在文章中添加categories" class="headerlink" title="9.4 在文章中添加categories"></a>9.4 在文章中添加categories</h3><p>在文章xx.md中添加:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">categories: </span><br><span class="line"> - cate</span><br></pre></td></tr></table></figure>
<p>其文件头部类似:</p>
<figure class="highlight plain"><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">title: TagEditText</span><br><span class="line">date: 2016-11-19 10:44:25</span><br><span class="line">categories: </span><br><span class="line"> - cate</span><br></pre></td></tr></table></figure>
<h2 id="10-添加评论功能"><a href="#10-添加评论功能" class="headerlink" title="10 添加评论功能"></a>10 添加评论功能</h2><p>评论功能在国内一般使用<a href="http://duoshuo.com/" target="_blank" rel="noopener">多说</a></p>
<h3 id="10-1-注册多说账号"><a href="#10-1-注册多说账号" class="headerlink" title="10.1 注册多说账号"></a>10.1 注册<a href="http://duoshuo.com/" target="_blank" rel="noopener">多说</a>账号</h3><h3 id="10-2-创建站点"><a href="#10-2-创建站点" class="headerlink" title="10.2 创建站点"></a>10.2 创建站点</h3><p>需要注意的是,填写的<strong>多说域名</strong>不能更改,会在后面使用,在这里我配置成droidlover</p>
<h3 id="10-3-配置"><a href="#10-3-配置" class="headerlink" title="10.3 配置"></a>10.3 配置</h3><p>在hexo主题配置文件中搜索:<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">duoshuo_shortname</span><br></pre></td></tr></table></figure></p>
<p>,然后打开开关,配置成前面设置的多说域名,如下:<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">duoshuo_shortname: droidlover</span><br></pre></td></tr></table></figure></p>
<p>有时,可能需要一段js</p>
<figure class="highlight plain"><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></pre></td><td class="code"><pre><span class="line">&lt;!-- 多说评论框 start --&gt;</span><br><span class="line"> &lt;div class=&quot;ds-thread&quot; data-thread-key=&quot;请将此处替换成文章在你的站点中的ID&quot; data-title=&quot;请替换成文章的标题&quot; data-url=&quot;请替换成文章的网址&quot;&gt;&lt;/div&gt;</span><br><span class="line">&lt;!-- 多说评论框 end --&gt;</span><br><span class="line">&lt;!-- 多说公共JS代码 start (一个网页只需插入一次) --&gt;</span><br><span class="line">&lt;script type=&quot;text/javascript&quot;&gt;</span><br><span class="line">var duoshuoQuery = &#123;short_name:&quot;droidlover&quot;&#125;;</span><br><span class="line"> (function() &#123;</span><br><span class="line"> var ds = document.createElement(&apos;script&apos;);</span><br><span class="line"> ds.type = &apos;text/javascript&apos;;ds.async = true;</span><br><span class="line"> ds.src = (document.location.protocol == &apos;https:&apos; ? &apos;https:&apos; : &apos;http:&apos;) + &apos;//static.duoshuo.com/embed.js&apos;;</span><br><span class="line"> ds.charset = &apos;UTF-8&apos;;</span><br><span class="line"> (document.getElementsByTagName(&apos;head&apos;)[0] </span><br><span class="line"> || document.getElementsByTagName(&apos;body&apos;)[0]).appendChild(ds);</span><br><span class="line"> &#125;)();</span><br><span class="line"> &lt;/script&gt;</span><br><span class="line">&lt;!-- 多说公共JS代码 end --&gt;</span><br></pre></td></tr></table></figure>
<p>现在,你可以运行看下效果了:)</p>
<h2 id="11-加介绍页面,让全世界认识你"><a href="#11-加介绍页面,让全世界认识你" class="headerlink" title="11 加介绍页面,让全世界认识你"></a>11 加介绍页面,让全世界认识你</h2>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</div>
</article>
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<div class="post-block">
<link itemprop="mainEntityOfPage" href="http://barryda.gitee.io/barry-blog/barry-blog/2019/05/22/hello-world/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="Barry">
<meta itemprop="description" content>
<meta itemprop="image" content="/barry-blog/images/avatar.gif">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Barry的技术博客">
</span>
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/barry-blog/2019/05/22/hello-world/" itemprop="url">Hello World</a></h1>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Post created" itemprop="dateCreated datePublished" datetime="2019-05-22T13:10:17+08:00">
2019-05-22
</time>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<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>
<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>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</div>
</article>
</section>
</div>
</div>
<div class="sidebar-toggle">
<div class="sidebar-toggle-line-wrap">
<span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
<span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
<span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
</div>
</div>
<aside id="sidebar" class="sidebar">
<div class="sidebar-inner">
<section class="site-overview-wrap sidebar-panel sidebar-panel-active">
<div class="site-overview">
<div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
<p class="site-author-name" itemprop="name">Barry</p>
<p class="site-description motion-element" itemprop="description"></p>
</div>
<nav class="site-state motion-element">
<div class="site-state-item site-state-posts">
<a href="/barry-blog/archives/">
<span class="site-state-item-count">2</span>
<span class="site-state-item-name">posts</span>
</a>
</div>
</nav>
</div>
</section>
</div>
</aside>
</div>
</main>
<footer id="footer" class="footer">
<div class="footer-inner">
<div class="copyright">&copy; <span itemprop="copyrightYear">2019</span>
<span class="with-love">
<i class="fa fa-user"></i>
</span>
<span class="author" itemprop="copyrightHolder">Barry</span>
</div>
<div class="powered-by">Powered by <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a></div>
<span class="post-meta-divider">|</span>
<div class="theme-info">Theme &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Muse</a> v5.1.4</div>
</div>
</footer>
<div class="back-to-top">
<i class="fa fa-arrow-up"></i>
</div>
</div>
<script type="text/javascript">
if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
window.Promise = null;
}
</script>
<script type="text/javascript" src="/barry-blog/lib/jquery/index.js?v=2.1.3"></script>
<script type="text/javascript" src="/barry-blog/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
<script type="text/javascript" src="/barry-blog/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
<script type="text/javascript" src="/barry-blog/lib/velocity/velocity.min.js?v=1.2.1"></script>
<script type="text/javascript" src="/barry-blog/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
<script type="text/javascript" src="/barry-blog/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
<script type="text/javascript" src="/barry-blog/js/src/utils.js?v=5.1.4"></script>
<script type="text/javascript" src="/barry-blog/js/src/motion.js?v=5.1.4"></script>
<script type="text/javascript" src="/barry-blog/js/src/bootstrap.js?v=5.1.4"></script>
</body>
</html>
1
https://gitee.com/Barryda/barry-blog.git
git@gitee.com:Barryda/barry-blog.git
Barryda
barry-blog
barry-blog
master

搜索帮助