Hexo - zblog

Hexo

hexo博客 安装教程

npm install hexo --save
npm install hexo-server --save

配置 hexo s 后页面空白
npm install hexo-renderer-ejs --save
npm install hexo-renderer-stylus --save
npm install hexo-renderer-marked --save

站内搜索
npm install hexo-generator-search --save

配置git
npm install --save hexo-deployer-git

aath 主题依赖
npm install --save hexo-renderer-sass

next 5主题
git clone https://github.com/iissnan/hexo-theme-next themes/next5
next 6主题
git clone https://github.com/theme-next/hexo-theme-next themes/next6

评论系统 Gitment,则应该使用 npm 进行安装。
npm install --save gitment
评论系统 gitalk,
npm i --save gitalk


添加共享按钮 
npm install --save hexo-helper-qrcode

hexo链接 持久化
npm install hexo-abbrlink --save

安装 hexo-admin
npm install --save hexo-admin

上传本地图片
npm install hexo-asset-image --save

流程图
npm install --save hexo-filter-flowchart

部署命令

提交git

hexo clean && hexo g && hexo d

清理&编译&启动服务

hexo clean && hexo g && hexo s

然后打开页面显示的是:

<%- partial('_partial/head') %> <%- partial('_partial/header') %>
<%- body %> <% if (theme.sidebar && theme.sidebar !== 'bottom'){ %>
<%- partial('_partial/sidebar') %> <% } %> <%- partial('_partial/footer') %>
<%- partial('_partial/mobile-nav') %> <%- partial('_partial/after-footer') %>
原因: Hexo无法解析模板文件
解决方案: 使用以下的命令
npm install hexo-renderer-ejs --save
npm install hexo-renderer-stylus --save
npm install hexo-renderer-marked --save

白板和Cannot GET / 几个字

原因:
由于2.6以后就更新了,我们需要手动配置些东西,我们需要输入下面三行命令:
npm install hexo-renderer-ejs --save
npm install hexo-renderer-stylus --save
npm install hexo-renderer-marked --save

打赏& 版权& 分享

reward_comment: Thanks!
alipay: /images/pay/a.jpg
wechatpay: /images/pay/w.jpg

shareto: true

博文前缀 Front-matter

title    网站标题
subtitle    网站副标题
description    网站描述
author    您的名字
language    网站使用的语言
timezone    网站时区。Hexo 默认使用您电脑的时区。时区列表。比如说:America/New_York, Japan, 和 UTC 。
参数 描述 默认值
layout 布局
title 标题
date 建立日期 文件建立日期
updated 更新日期 文件更新日期
comments 开启文章的评论功能 true
tags 标签(不适用于分页)
categories 分类(不适用于分页)
permalink 覆盖文章网址

模板

hexo new "postName" #新建文章
hexo new page "pageName" #新建页面
hexo generate #生成静态页面至public目录
hexo server #开启预览访问端口(默认端口4000,'ctrl + c'关闭server)
hexo deploy #将.deploy目录部署到GitHub

hexo new "postName" #新建文章
hexo new page "pageName" #新建页面

hexo new page "about"
hexo new page "tags"

百度统计 satott/S6

百度统计

https://tongji.baidu.com/web/homepage/index

<script>
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?d2a4aaa23cf21744067bec574ea39e2a";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
</script>

评论系统 - 来必力

<!-- 来必力City版安装代码 -->
<div id="lv-container" data-id="city" data-uid="MTAyMC80MTc2OC8xODMxNA==">
    <script type="text/javascript">
   (function(d, s) {
       var j, e = d.getElementsByTagName(s)[0];

       if (typeof LivereTower === 'function') { return; }

       j = d.createElement(s);
       j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
       j.async = true;

       e.parentNode.insertBefore(j, e);
   })(document, 'script');
    </script>
<noscript> 为正常使用来必力评论功能请激活JavaScript</noscript>
</div>
<!-- City版安装代码已完成 -->

文件路径:themes/next6/layout/_partials/footer.swig

{% if theme.footer.powered.enable %}
	  
{# #}{{ __('footer.powered', next_url('https://hexo.io', 'Hexo', {class: 'theme-link'})) }}{# #}{% if theme.footer.powered.version %} v{{ hexo_env('version') }}{% endif %}</div> {% endif %} {% if theme.footer.powered.enable and theme.footer.theme.enable %} {% endif %} {% if theme.footer.theme.enable %}
{# #}{{ __('footer.theme') }} {{ next_url('https://theme-next.org', 'NexT.' + theme.scheme, {class: 'theme-link'}) }}{# #}{% if theme.footer.theme.version %} v{{ version }}{% endif %}</div> {% endif %}

hexo new 的时候文件前缀加时间

# File name of new posts
# hexo new 的时候文件前缀加时间
# new_post_name: :year-:month-:day-:title.md 

RSS不显示

安装RSS插件
npm install hexo-generator-feed --save

开启RSS功能
编辑hexo/_config.yml,添加如下代码:

rss: /atom.xml #rss地址  默认即可

asset 变量

{% asset_path slug %}
{% asset_img slug [title] %}
{% asset_link slug [title] %}