部署 nodejs环境
略 #确保npm命令可用
安装hexo程序
npm install hexo-cli -g
新建一个文件夹放你的网站
mkdir /www/hexo
hexo 加入全局命令
ln -s /usr/local/nodejs/lib/node_modules/hexo-cli/bin/hexo /usr/local/bin/hexo
从github上拉取代码
hexo init
常用的hexo命令
如何运行这个程序?
务必确保当前处在hexo文件夹下
hexo server
如何查看是否开启?
默认地址为locaohost:4000
清除缓存文件 (db.json) 和已生成的静态文件 (public)
hexo clean
显示hexo版本
hexo -version
自定义配置文件的路径
自定义配置文件的路径,执行后将不再使用 _config.yml。
hexo --config custom.yml
列出网站资料
type有: page, post, route, tag, category
ege:
hexo list page
详细分类
hexo
npm install hexo -g #安装
npm update hexo -g #升级
hexo init #初始化
简写
hexo n "我的博客" == hexo new "我的博客" #新建文章
hexo p == hexo publish
hexo 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 --deploy
hexo deploy --generate
hexo deploy -g
hexo server -g
草稿
hexo publish [layout] <title>
格式示范
hexo new "postName" #新建文章
hexo new page "pageName" #新建页面
hexo generate #生成静态页面至public目录
hexo server #开启预览访问端口(默认端口4000,'ctrl + c'关闭server)
hexo deploy #将.deploy目录部署到GitHub
hexo new [layout] <title>
hexo new photo "My Gallery"
hexo new "Hello World" --lang tw
文章摘要示范
title: 使用Hexo搭建个人博客
layout: post
date: 2018-03-03 19:07:43
comments: true
categories: Blog
tags: [Hexo]
keywords: Hexo, Blog
description: \666。
`````正文部分``````
创建的文章在哪里?
以 ".md" 结尾
在哪个目录下面?
/hexo/source/_posts
推送到服务器上
hexo n #写文章
hexo g #生成
hexo d #部署 #可与hexo g合并为 hexo d -g
更多详细资料
参考 https://segmentfault.com/a/1190000002632530
官网查看 https://hexo.io/zh-cn/docs/