您的位置:首页 > 其它

hexo & Next 使用教程

2018-01-08 17:49 423 查看

1、初始化博客

hexo init myBlog

cd myBlog

npm install # 安装依赖


目录结构

.
├── _config.yml
├── package.json
├── scaffolds
├── source
|   ├── _drafts
|   └── _posts
└── themes


2、新建博客

hexo new blog_title # hexo new 博客标题


生成文章格式

---
title: blog_title # 博客标题
date: 2018-01-01 # 博客生成的时间
---

# 写博客内容
something of blog


3、查看博客

http://localhost:4000


链接:hexo中文网站

4、使用Next.Mist博客主题

# 进入博客目录 myBlog
git clone https://github.com/theme-next/hexo-theme-next themes/next
cd themes/next
git pull # 更新主题


5、配置next主题

在站点的 source/_data 目录下新建 next.yml 文件(_data目录可能需要新建)

迁移站点配置文件和主题配置文件中的配置到 next.yml 中

使用 –config source/_data/next.yml 参数启动服务器, 生成或者部署。

例如: hexo clean –config source/_data/next.yml && hexo g –config source/_data/next.yml

在站点配置文件_config.yml中可以将语言切换成中文

language: zh-Hans

创建一个名为 tags 页面

hexo new page “tags”

编辑标签页, 设置页面类型为tags

title: All tags

date: 2014-12-22 12:39:04

type: “tags”

添加 tags 到主题配置文件 _config.yml 里。分类(categories)同理

menu:

home: /

archives: /archives

tags: /tags

详情可以参考Next官方教程

6、本地4000端口调试

hexo server  --config source/_data/next.yml


7、发布并部署博客

hexo generate --deploy  --config source/_data/next.yml
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  hexo next