Hexo搭建记录

Hexo+码云 Pages+Git
Github有墙,coding有广告,码云不能绑定域名

Hexo搭建

  1. Hexo官网
  2. 部署到码云,我看的那篇找不到了,自己又不想写…

Hexo配置

参见reuixiy3.2. 站点配置文件

注意
码云的Pages在子目录下,一定要在站点配置文件修改URL设置
语言设置为zh-CN,Next主题的中文语言文件是zh-CN,原来是zh-Hans

部署

npm install hexo-deployer-git --save

deploy:
  type: git
  repo: https://gitee.com/zureov/blog.git
  branch: master

搜索

npm install hexo-generator-searchdb --save

search:
  path: search.xml
  field: post
  format: html
  limit: 10000

注意
使用NexT主题要配置启用

# Local search
local_search:
  enable: true

根据目录自动添加分类

npm install hexo-auto-category --save

# Generate categories from directory-tree
# Dependencies: https://github.com/xu-song/hexo-auto-category
# depth: the depth of directory-tree you want to generate, should > 0
auto_category:
 enable: true
 depth: 3

RSS订阅

npm install --save hexo-generator-feed

plugin:
- hexo-generator-feed
#Feed Atom
feed:
type: atom
path: atom.xml
limit: 0

固定链接

npm install hexo-abbrlink --save

# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: http://zureov.gitee.io/blog/
root: /blog/
permalink: posts/:abbrlink/ #:year/:month/:day/:title/
permalink_defaults:

NexT主题

参见reuixiy3.2. 站点配置文件

字数统计

npm install hexo-symbols-count-time --save
#原来NexT用的是hexo-wordcount 

相关文章

hexo-related-popular-posts

Valine评论

# Valine.
# You can get your appid and appkey from https://leancloud.cn
# more info please open https://valine.js.org
valine:
  enable: true
  appid: # your leancloud application appid
  appkey: # your leancloud application appkey
  notify: true # mail notifier , https://github.com/xCss/Valine/wiki
  verify: false # Verification code
  placeholder: Just go! go! # comment box placeholder
  avatar: identicon # mm # gravatar style
  guest_info: nick,mail,link # custom comment header
  pageSize: 10 # pagination size

修改文章底部的带#号的标签

修改模板/themes/next/layout/_macro/post.swig,搜索rel="tag">#,将#换成<i class="fa fa-tag"></i>

NexT自带样式

note标签

# Note tag (bs-callout).
note:
  style: flat #simple
  icons: true #false
  border_radius: 3disabled note tag.
  light_bg_offset: 0

使用

<div class="note danger"><p>danger</p></div>

{% note danger no-icon %}
    note without icon
    {% endnote %}

所有的FontAwesome图标

<i class="fa fa-pencil"></i>

代码块

hello,world! www.python123.io python123
1
print('hello,world!')
\`\`\`[language] [title] [url] [link-text]

代码

\`\`\`

label 标签

{% label default@default %}

@ 前面的是label的名字,后面的是要显示的文字

tabs标签

自定义样式

1
2
3
<blockquote class="question">内容</blockquote>

<span id="inline-toc">1.</span>

技巧

  • 阅读全文<!-- more -->
  • 可视化写文章插件hexo-admin,感觉并不好

多终端同步

我放弃了[摊手]
退而求次,同步.md文件

文章作者: Shoor
文章链接: https://shoorday.github.io/posts/3baee0e1/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Shoor's Blog