1、创建博客
使用 $ hexo new [layout] <title>
命令创建一篇新的博客。
PS hexo> npx hexo new post "test"
Debugger attached.
Debugger attached.
INFO Validating config
INFO Created: D:\hexo\source\_posts\test.md
Waiting for the debugger to disconnect...
Waiting for the debugger to disconnect...
如上就会在 _posts
路径下创建一个新的 md
格式文件;_posts
路径下的文件都可以在博客首页看见:
layout 布局方式一共有三种类型:post
、page
、draft
:
post:发布路径,博客可直接查看;
page:会在 source 路径下创建一个新的路径,相当于草稿,不会生成静态文件;
draft:草稿路径,publish 之后会被发布到_posts
路径下。
2、使用七牛云作图片cdn加速
在七牛云创建好存储空间之后,在“文件管理”中上传图片,然后复制外链:
复制出的外链就可以在 hexo 中直接使用。
3、创建 Tag 标签
3.1 创建 tag 页面
hexo> npx hexo new page "tags"
创建后会在 source\tags
路径下生成一个 index.md
文件,编辑此文件,将内容修改如下:
---
title: 标签
date: 2023-07-24 21:45:21
layout: "tags"
---
3.2 在文章中引入 tag
在文章中使用如下方式引入 tag:
---
title: Hello World
tags:
- 风雨兼程
---
3.3 修改配置文件
在主题配置文件中(_config.butterfly.yml
)放开注释:
# 这种会在顶部有 tags 标签
menu:
Tags: /tags/ || fas fa-tags
# 修改如下配置只会在文章中有 tag 标签
post_meta:
page: # Home Page
tags: true # true or false 主頁是否顯示標籤
post:
tags: true # true or false 文章頁是否顯示標籤