Hexo博客使用教程

Hexo文章写作

新建文章

hexo new "这是一个文章标题"
#生成的文件在 source/_posts/
# 也可指定类型:post(默认)/ draft / page
hexo new post "my-first-post"
hexo new draft "post-draft" # 草稿(不会被发布)
hexo publish draft "post-draft" # 草稿转正式文章
hexo new page "about" # 生成独立页面:/about/

文章参数

写法 解释
title 【必需】文章标题
id 【必需】文章唯一编号
date 【必需】文章创建日期
updated 【可选】文章更新日期
tags 【可选】文章标签
categories 【可选】文章分类
top_img 【可选】文章顶部图片
cover 【可选】文章缩略图(如果没有设置 top_img,文章页顶部将显示缩略图,可设为 false/图片地址/留空)
comments 【可选】显示文章评论模块(默认 true)
copyright 【可选】显示文章版权模块(默认为设置中 post_copyright 的 enable 配置)
copyright_author 【可选】文章版权模块的文章作者
copyright_author_href 【可选】文章版权模块的文章作者链接
copyright_url 【可选】文章版权模块的文章链接链接
swiper_index 【可选】首页轮播图配置 index 索引,数字越小越靠前
top 【可选】置顶文章 top: true

同步发布文章

hexo clean  # 清除旧数据缓存
hexo g # 生成新页面
hexo s # 本地预览
hexo d # 同步上云