hexo
1 | npm install hexo -g #安装 |
简写
hexo n "我的博客" == hexo new "我的博客" #新建文章hexo p == hexo publishhexo g == hexo generate#生成hexo s == hexo server #启动服务预览hexo d == hexo deploy#部署
服务器
hexo server #Hexo 会监视文件变动并自动更新,您无须重启服务器。hexo server -s #静态模式hexo server -p 5000 #更改端口hexo server -i 192.168.1.1 #自定义 IP
hexo clean #清除缓存 网页正常情况下可以忽略此条命令hexo g #生成静态网页hexo d #开始部署
监视文件变动
hexo generate #使用 Hexo 生成静态文件快速而且简单hexo generate --watch #监视文件变动
完成后部署
两个命令的作用是相同的
hexo generate --deployhexo deploy --generate
1 | hexo deploy -g` |
草稿
1 | hexo publish [layout] <title> |
模版
hexo new "postName" #新建文章hexo new page "pageName" #新建页面hexo generate #生成静态页面至public目录hexo server #开启预览访问端口(默认端口4000,’ctrl + c’关闭server)hexo deploy #将.deploy目录部署到GitHub
1 | hexo new [layout] <title>` |
| 变量 | 描述 |
|---|---|
| layout | 布局 |
| title | 标题 |
| date | 文件建立日期 |
1 | title: 使用Hexo搭建个人博客 |
模版(Scaffold)
1 | hexo new photo "My Gallery" |
| 变量 | 描述 |
|---|---|
| layout | 布局 |
| title | 标题 |
| date | 文件建立日期 |
设置文章摘要
1 | 以上是文章摘要 <!--more--> 以下是余下全文 |
写作
1 | hexo new page <title>` |
| 变量 | 描述 |
|---|---|
| :title | 标题 |
| :year | 建立的年份(4 位数) |
| :month | 建立的月份(2 位数) |
| :i_month | 建立的月份(去掉开头的零) |
| :day | 建立的日期(2 位数) |
| :i_day | 建立的日期(去掉开头的零) |
推送到服务器上
1 | hexo n` #写文章 |