hexo常用命令

hexo一些常用命令,简写等。

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 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

变量描述
layout布局
title标题
date文件建立日期
title: 使用Hexo搭建个人博客
layout: post
date: 2014-03-03 19:07:43
comments: true  #是否允许评论
categories: Blog  #所在目录
tags: [Hexo]  #标签
keywords: Hexo, Blog
description: 生命在于折腾,又把博客折腾到Hexo了。给Hexo点赞。
复制代码

模版(Scaffold)

hexo new photo "My Gallery"

设置文章摘要

以上是文章摘要 <!--more--> 以下是余下全文

写作

hexo new page <title> hexo new post <title>

变量描述
:title标题
:year建立的年份(4 位数)
:month建立的月份(2 位数)
:i_month建立的月份(去掉开头的零)
:day建立的日期(2 位数)
:i_day建立的日期(去掉开头的零)

推送到服务器上 hexo n #写文章 hexo g #生成 hexo d #部署 #可与hexo g合并为 hexo d -g

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值