1.安装Hexo Hexo 依赖了 Node.js 和 Git,所以在安装 Hexo 之前必须确保安装了这两个工具.
1.2 安装Node.js 下载:https://nodejs.org/en/download/ 
安装完
 
1.3 安装git 下载:https://git-scm.com/downloads 
安装完
 
1.4 安装Hexo 选择6.3.0版本hexo - npm (npmjs.com) 
install hexo
 
install 脚手架
 
在F盘根目录打开bash
 
开启服务
1 hexo c &&  hexo g &&  hexo s 
 
1.5 配置next主题 1. 主题(Gemini) 主题配置文件 
1 2 3 4 5 # Schemes # scheme: Muse # scheme: Mist # scheme: Pisces scheme: Gemini 
 
站点配置文件 
1 2 3 4 5 6 7 8 # Site title: 秦越人的博客 subtitle: 'Practice Tests Truth'  description: 'Welcome to my world'  keywords: author: Qinyueren language: zh-CN timezone: 'Asia'  
 
主题配置文件 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 menu :  home: / || fa fa-home   about: /about/ || fa fa-user   tags: /tags/ || fa fa-tags   categories: /categories/ || fa fa-th   archives: /archives/ || fa fa-archive   #schedule: /schedule/ || fa fa-calendar   #sitemap: /sitemap.xml || fa fa-sitemap   #commonweal: /404 / || fa fa-heartbeat # Enable / Disable menu icons / item badges. menu_settings:   icons: true   badges: false 
 
样例 
3. 配置看板娘 安装插件
1 npm install  -save hexo-helper-live2d 
 
站点配置文件 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 live2d:   enable: true   scriptFrom: local   pluginRootPath: live2dw/   pluginJsPath: lib/   pluginModelPath: assets/   tagMode: false   log: false   model:     use: live2d-widget-model-shizuku   display:     position: right     # width: 150  # 大小根据模型结构自己调整合适的     # height: 300    mobile:     show: true # 是否在手机端显示 
 
安装shizuku模型
1 npm install  live2d-widget-model-shizuku  --save 
 
样例 
4. 更换博客背景 把准备好的背景图放入 themes\hexo-theme-next\source\images 中
新建 hexo/source/_data/styles.styl
1 2 3 4 5 6 7 8 9 10 11 12 13 14 //背景图片设置 body {     background-image: url(/images/background.jpg);     background-repeat: no-repeat;     background-attachment: fixed;     background-size: 100% 100%;     //调整透明度     opacity: 0.85;     //可选     +mobile(){       background-image: url(https://ziyuan.lruihao.cn/images/bg_cell.png);       background-size: cover;     } } 
 
5. 边框圆角 在之前新建的 _data 目录下新建 variables.styl,类似新建 styles.styl。打开 variables.styl,添加如下:
1 2 3 $border -radius-inner     = 20px 20px 20px 20px;$border -radius           = 20px;
 
打开 custom_file_path 中 variable 的注释
1 2 3 custom_file_path: variable : source/_data/variables .styl
 
6. 美化归档栏和分类栏 在blog/themes/next/layout/_macro/下新建文件post-collapse.swig并复制一下内容
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 {% macro  render(posts) %} {%- set  current_year = '1970' %} {%- for   post in  posts.toArray() %}    {%- set  year = date(post.date, 'YYYY') %}    {%- if   year !== current_year %}      {%- set  current_year = year %}     <div  class ="collection-year" >        < {%- if   theme.seo %} h2 {% else   %} h1 {%- endif   %}  class="collection-header"> {{ current_year }} </ {%- if   theme.seo %} h2 {% else   %} h1 {%- endif   %} >     </div >     {%- endif   %}   <article  class ="my-post post-type-   {{ post.type | default('normal') }} "  itemscope  itemtype ="http://schema.org/Article" >    <header  class ="my-post-header" >        <div  class ="my-post-meta" >          <time  class ="my-post-time"  itemprop ="dateCreated"                 datetime ="  {{ moment(post.date).format() }} "               content ="  {{ date(post.date, config.date_format) }} " >           {{ date(post.date, 'MM-DD') }}         </time >        </div >        < {%- if   theme.seo %} h3 {% else   %} h2 {%- endif   %}  class="my-post-title">          {%- if   post.link %}           <a  class ="my-post-title-link post-title-link-external"  target ="_blank"  href ="   {{ url_for(post.link) }} "  itemprop ="url" >             {{ post.title or post.link }}             <i  class ="fa fa-external-link" > </i >            </a >           {% else   %}           <a  class ="my-post-title-link"  href ="   {{ url_for(post.path) }} "  itemprop ="url" >             {% if   post.type === 'picture' %}                {{ post.content }}              {% else   %}               <span  itemprop ="name" >  {{ post.title or __('post.untitled') }} </span >              {% endif   %}           </a >           {%- endif   %}       </ {%- if   theme.seo %} h3 {% else   %} h2 {%- endif   %} >     </header >    </article >  {%- endfor   %} {% endmacro  %} 
 
复制下面内容,粘贴到你所用主题的index.styl后面
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 .page-archive  .archive-page-counter  {  font-size : 18px ;   background-color : #49b1f5 ;   padding-left : 10px ;   padding-right : 10px ;   border-radius : 8px ;   color : #fff ;   +mobile() {     font-size : 16px ;   } } .my-post-time {  font-size : 11px ;   position : absolute;   color : #fff ;   background-color : #49b1f5 ;   border-radius : 5px ;   padding-left : 5px ;   padding-right : 5px ;   margin-left : 15px ; } .mypost {  position : relative;   margin-bottom : 1rem ;   -webkit-transition : all .2s  ease-in-out;   -moz-transition : all .2s  ease-in-out;   -o-transition : all .2s  ease-in-out;   -ms-transition : all .2s  ease-in-out;   transition : all .2s  ease-in-out; } a .my-post-title-link :before {  top : 10px ;   width : 18px ;   height : 18px ;   content : "📚" ;   margin-right : 5px ;   font : normal normal normal 14px /1  FontAwesome;   font-size : 15px ;   line-height : 18px ; } .my-post :hover {  transform : scale (1.1 );   box-shadow : 10px  10px  15px  2px  rgba (0 ,0 ,0 ,.12 ), 0  0  6px  0  rgba (104 , 104 , 105 , 0.1 );   border-radius : 30px ;   width : 400px ;   padding : 1px  10px ;   margin-left : 25px ;   font-size : 16px ;   transition-duration : 0.15s ;   +mobile(){     width : 260px ;     margin-left : 18px ;   }   //display :flex; } a .my-post-title-link {  text-decoration : none;   font-size : 15px ;   font-weight : 400 ;   +mobile() {     font-size : 14px ;   } } .my-post-title {  display : block;   margin-left : 4.5rem ;   color : #4c4948 ;   text-decoration : none;   font-size : .8rem ;   cursor : pointer;   +mobile() {     //margin-left : 4rem ;   } } .my-post-header {  position : top;   margin-bottom : 1rem ;   -webkit-transition : all .2s  ease-in-out;   -moz-transition : all .2s  ease-in-out;   -o-transition : all .2s  ease-in-out;   -ms-transition : all .2s  ease-in-out;   transition : all .2s  ease-in-out; } //.my-post-title-link { //  font-size : 16px ; //  font-weight : 500 ; //} .my-post-meta {  position : absolute;   color : #99a9bf ;   width : 80px ;   color : #114142 ; } div .post-block .tag  .collection-title  h2  {  border-width : 1px ;   border-style : solid;   border-color : #3f3f3f ;   border-radius : 20px ;   font-size : 22px ;   background-color : #b4e8fa ;   padding : 2px  15px ;   letter-spacing : 1.5px ;   box-sizing : border-box;   color : #3f3f3f ;   display : inline-block;   margin : 10px  0  10px ;   text-align : center;   +mobile(){     font-size : 18px ;   } } 
 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 .category-list-link :hover {  transform : scale (1.1 );   box-shadow : 10px  10px  15px  2px  rgba (0 ,0 ,0 ,.12 ), 0  0  6px  0  rgba (104 , 104 , 105 , 0.1 );   border-radius : 15px ;   padding : 6px  16px ;   margin-left : 0px ;   font-size : 16px ;   transition-duration : 0.15s ;   //display :flex; } a .category-list-link :before {  top : 10px ;   width : 18px ;   height : 18px ;   content : "📚" ;   margin-right : 5px ;   font : normal normal normal 14px /1  FontAwesome;   font-size : 15px ;   line-height : 18px ; } 
 
7. 代码块Mac风 站点配置 
1 2 3 4 5 6 7 8 9 10 11 12 13 highlight:   enable:  true     line_number:  true     auto_detect:  true     tab_replace:  ""    wrap:  true    hljs:  false  prismjs:   enable:  false    preprocess:  true    line_number:  true    tab_replace:  ""  
 
主题配置 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 codeblock:         theme:           light:  github-dark      dark:  github-dark    prism:      light:  prism      dark:  prism-dark       copy_button:       enable:  true           style:  mac  
 
8. 设置阅读全文 执行
1 npm install hexo-excerpt  
 
站点 
1 2 3 4 5 excerpt: 			  depth:  5 			   excerpt_excludes:  []   more_excludes:  []   hideWholePostExcerpts:  true  
 
主题 
1 2 excerpt_description:  true 		
 
9. 增加文章字数统计和阅读时长 执行
1 npm install hexo-word -counter 
 
站点 
1 2 3 4 5 6 7 8 9 10 symbols_count_time:   symbols:  true    time:  true    total_symbols:  true    total_time:  true    exclude_codeblock:  false    wpm:  275    suffix:  "mins."  
 
10. 文章结束标志 在路径 \themes\next\layout\_macro 中新建 passage-end-tag.swig 文件,并添加以下内容
1 2 3 4 5 <div >      {% if   not is_index %}         <div  style ="text-align:center;color: #ccc;font-size:14px;" > -------------已经到底啦!<i  class ="fa fa-paw" > </i > -------------</div >       {% endif   %} </div > 
 
打开 \themes\next\layout\_macro\post.njk 文件,在post-body 之后(END POST BODY),post-footer 之前添加以下代码:
1 2 3 4 5 6 <div >    {% if   not is_index %}      {% include   'passage-end-tag.swig' %}    {% endif   %} </div > 
 
11. 分类设置 在文章上头
单层 
 
父子 
 
并列 
1 2 3 categories :-  [后端]-  [笔记]
 
同一父类不同子类 
1 2 3 categories :-  [学习,html]-  [学习,http]
 
12. 分类问题 原因:
原因是因为我把_config.yml中的时区timezone改成了2020-5-1(笑死)
解决办法:
把timezone改成 Asia/Shanghai 就好了。
13. 删除分类 1 2 3 4 5 6 7 rm  -rf db .jsonhexo clean hexo g  hexo s 
 
14. 侧边栏滚动条 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 /*更好的侧边滚动条* / ::-webkit-scrollbar {   width: 10px;   height: 10px; } ::-webkit-scrollbar-button {   width: 0;   height: 0; } ::-webkit-scrollbar-button:start:increment,::-webkit-scrollbar-button:end:decrement  {  display: none; } ::-webkit-scrollbar-corner {   display: block; } ::-webkit-scrollbar-thumb {   border-radius: 8px;   background-color: rgba(0,0,0,.2); } ::-webkit-scrollbar-thumb:hover  {  border-radius: 8px;   background-color: rgba(0,0,0,.5); } ::-webkit-scrollbar-track,::-webkit-scrollbar-thumb  {  border-right: 1px solid transparent;   border-left: 1px solid transparent; } ::-webkit-scrollbar-track:hover  {  background-color: rgba(0,0,0,.15); } ::-webkit-scrollbar-button:start  {  width: 10px;   height: 10px;   /*background: url(../images/scrollbar_arrow.png) no-repeat 0 0;*/  /*可以添加滚动条样式*/ } 
 
15. 回到顶部按钮 
在themes/*/_config.yml中搜索back2top,将enable属性的false改为true即可: 
 
1 2 3 4 5 6 back2top:   enable:  true       sidebar:  true       scrollpercent:  true  
 
16. 阅读进度条 
在themes/*/_config.yml中搜索reading_progress,修改相关信息: 
 
1 2 3 4 5 6 7 reading_progress:   enable:  true       position:  top            color:  "#37c6c0"         height:  3px            
 
2. git 配置 站点文件 
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 title:  秦越人的博客 subtitle:  'Practice Tests Truth' description:  'Welcome to my world' keywords: author:  Qinyueren language:  zh-CN timezone:  'Asia/Shanghai' url:  http://qinyueren.gitee.io root:  /learn_blog/ permalink:  :year/:month/:day/:title/ permalink_defaults: pretty_urls:   trailing_index:  true     trailing_html:  true      deploy:   type:  'git'    repo:   https://gitee.com/qinyueren/learn_blog.git    branch:  master     theme:  hexo-theme-next 
 
3. 设置图床 3.1 安装Picgo 下载picgo安装包
https://[github](https://so.csdn.net/so/search?q=github&spm=1001.2101.3001.7020).com/Molunerfinn/PicGo/releases 
在picgo界面
安装gitee-uploader插件
3.2 新建图床库 gitee新建仓库
输入仓库名称 
仓库设置公开 
勾选使用Readme文件初始化仓库(会自动插件master分支 
 
3.3 配置picgo 
repo: 用户名/仓库名 
branch: master 
token: 私人令牌 
 
3.4 typroa配置Picgo 文件–>偏好设置–>图像-》上传图片,对网络位置应用上述规则
设置picgo路径,并验证