Home / Blog / 工具
Tech · 工具 · Hexo

hexo 教程

H by Haofly
· 2016-08-11 · updated 2020-03-05 · 40 views

安装hexo

curl --silent --location https://rpm.nodesource.com/setup_6.x | bash -
yum install nodejs -y
npm install -g hexo-cli
添加RSS

通过npm install -g hexo-generator-feed安装
然后修改hexo/_config.yml添加如下代码:

plugins:
- hexo-generator-feed
添加sitemap

通过npm install -g hexo-generator-sitemap安装 然后修改hexo/_config.yml添加如下代码:

plugins:
- hexo-generator-sitemap

全局设置

文章设置

文章的抬头可以指定如下信息:

title: "文章标题"
date: 2016-08-07 8:52:39		# 文章发布时间
updated: 2016-09-02 15:50:00	# 文章修改时间
categories: tools				# 文章分类

TroubleShooting

  • nginx 403:可能是因为没有在public生成index.html文件导致,检查是否执行过npm install安装完所有的模块,以及themes目录下是否存在该主题的文件

  • no content页面只有框架没有内容: 可能是历史的css文件遗留所致,此时可以清空public目录下的文件再重新生成

  • unknown block tag: load,出现类似的错误,极大可能是文章中出现了特定的没有转义的标签,例如这里就是很有可能就存在一个类似这种标签,这种标签只能使用代码块(三个单引号)而不能使用两个单引号来引用:

    {% load	# 这样子开头
  • Error: Cannot find module ‘babel-runtime/regenerator’: 原因是没有安装这个包,可以执行npm install babel-runtime --save

Haofly · 豪翔天下 · 2016-08-11

评论 · Comments

评论由 Giscus 提供,需用 GitHub 账号登录;留言会同步到这个仓库的 Discussions 里。