0%

hexo搭建

Hexo与Next使用手册

命令使用

创建子目录

1
hexo new post -p website/hexo

创建page

1
hexo new page tags

创建page等于创建一个页面。如果要使用这个页面,还需要在themes配置menu路由到该页面
例如hexo-theme-next就需要在配置了page后,打开原本注释掉的页面

1
2
3
4
5
6
7
8
9
menu:
home: / || fa fa-home
about: /about/ || fa fa-user
tags: /tags/ || fa fa-tags
categories: /categories/ || fa fa-th
archives: /archives/ || fa fa-archive
#schedule: /schedule/ || fa fa-calendar
#sitemap: /sitemap.xml || fa fa-sitemap
#commonweal: /404/ || fa fa-heartbeat

tags和categories需要再page的index.md中配置页面类型
例如tags,要增加type定义

1
2
3
4
5
---
title: 标签
date: 2024-03-14 23:43:05
type: tags
---

部署

修改_config.xml,增加部署内容

1
2
3
4
5
6
7
8
9
# Deployment
## Docs: https://hexo.io/docs/one-command-deployment
deploy:
type: sftp
host: xxx
user: xxx
pass: xxx
remotePath: xx
port: xx

修改后使用hexo deploy部署

图片使用

最好的方案是使用 hexo-renderer-marked

1
npm install hexo-renderer-marked --save

hexo-renderer-marked 3.1.0 引入了一个新的选项,其允许你无需使用 asset_img 标签插件就可以在 markdown 中嵌入图片
如需启用,编辑_config.yml

1
2
3
4
post_asset_folder: true
marked:
prependRoot: true
postAsset: true

启用后,资源图片将会被自动解析为其对应文章的路径。
例如: image.jpg 位置为 /2020/01/02/foo/image.jpg ,这表示它是 /2020/01/02/foo/ 文章的一张资源图片, ![](image.jpg)将会被解析为 <img src="/2020/01/02/foo/image.jpg">

修改底部备案信息

Next 主题增加公安备案信息