hexo基本命令
wbfwonderful Lv3

快速开始

创建新博客

1
$ hexo new "My New Post"

运行服务器

1
$ hexo server

动态部署,修改代码实时更新。

生成静态文件

1
$ hexo generate

远端部署

1
$ hexo deploy

清理缓存

1
$ hexo clean

Don’t forget to clean cache…

标签插件

链接到其他博客页面

使用 post_link 标签。注意要以 /_posts 文件夹为根路径。即使两个 post 在同一个子文件下,也需要写出子文件夹的名字,例如下面的 hello-world 页面位于 _post 文件夹下,就直接写文件名。

1
2
{% post_link 相对路径 '链接文字' %}
<!-- {% post_link hello-world '访问首页' %} -->
访问首页

引用块

写法 1

1
2
3
{% blockquote [author[, source]] [link] [source_link_title] %}
content
{% endblockquote %}

example

写法 2

1
2
3
> 
>
>

这是引用
这是引用

注意这种方法的每一行后面要打连两个空格,用于换行

写法 3

某些情况下,引用块中需要缩进,上面两种方法都无法处理缩进,可以直接使用以下标签:

1
2
3
<blockquote><pre>

</pre></blockquote>
无缩进
    四个字符(一个 tab)缩进
        八个字符(两个 tab)缩进

代码块

1
2
3
{% codeblock %}
alert('Hello World!');
{% endcodeblock %}

等同于使用反引号

1
2
3
``` 
your code
```

Hexo新建文章到子目录

hexo new 命令说明:

1
2
3
4
5
6
7
8
9
10
11
12
13
Usage: hexo new [layout] <title>

Description:
Create a new post.

Arguments:
layout Post layout. Use post, page, draft or whatever you want.
title Post title. Wrap it with quotations to escape.

Options:
-p, --path Post path. Customize the path of the post.
-r, --replace Replace the current post if existed.
-s, --slug Post slug. Customize the URL of the post.

例如,在 202411/ 文件夹下新建 test.md 文件

1
hexo n -p 202411/test.md