本文最后更新于:2024年1月14日 晚上

matery 是是一个采用 Material Design 和响应式设计的 Hexo 博客主题,本文记录主题安装使用方法。

预备环境

  • gitbash
  • node.js
  • Hexo 5.0.0 以上

安装最新版本 matery

下载最新版本 matery 仓库到 themes 目录,并将解压出的文件夹重命名为 matery

  • 在hexo 根目录执行
1
git clone https://github.com/blinkfox/hexo-theme-matery.git themes/matery

指定主题

如下修改 Hexo 博客目录中的 _config.yml

1
2
theme: matery  # 指定主题
language: zh-CN # 指定语言

添加分类、归档、关于页

categories 页是用来展示所有分类的页面,如果在你的博客 source 目录下还没有 categories/index.md 文件,那么你就需要新建一个,命令如下:

1
hexo new page "categories"

编辑你刚刚新建的页面文件 /source/categories/index.md,至少需要以下内容:

1
2
3
4
5
6
---
title: categories
date: 2018-09-30 17:25:30
type: "categories"
layout: "categories"
---

新建标签 tags 页

tags 页是用来展示所有标签的页面,如果在你的博客 source 目录下还没有 tags/index.md 文件,那么你就需要新建一个,命令如下:

1
hexo new page "tags"

编辑你刚刚新建的页面文件 /source/tags/index.md,至少需要以下内容:

1
2
3
4
5
6
---
title: tags
date: 2018-09-30 18:23:38
type: "tags"
layout: "tags"
---

新建关于我 about 页

about 页是用来展示关于我和我的博客信息的页面,如果在你的博客 source 目录下还没有 about/index.md 文件,那么你就需要新建一个,命令如下:

1
hexo new page "about"

编辑你刚刚新建的页面文件 /source/about/index.md,至少需要以下内容:

1
2
3
4
5
6
---
title: about
date: 2018-09-30 17:25:30
type: "about"
layout: "about"
---

新建留言板 contact 页(可选的)

contact 页是用来展示留言板信息的页面,如果在你的博客 source 目录下还没有 contact/index.md 文件,那么你就需要新建一个,命令如下:

1
hexo new page "contact"

编辑你刚刚新建的页面文件 /source/contact/index.md,至少需要以下内容:

1
2
3
4
5
6
---
title: contact
date: 2018-09-30 17:25:30
type: "contact"
layout: "contact"
---

:本留言板功能依赖于第三方评论系统,请激活你的评论系统才有效果。并且在主题的 _config.yml 文件中,第 1921 行的“菜单”配置,取消关于留言板的注释即可。

新建友情链接 friends 页(可选的)

friends 页是用来展示友情链接信息的页面,如果在你的博客 source 目录下还没有 friends/index.md 文件,那么你就需要新建一个,命令如下:

1
hexo new page "friends"

编辑你刚刚新建的页面文件 /source/friends/index.md,至少需要以下内容:

1
2
3
4
5
6
---
title: friends
date: 2018-12-12 21:25:30
type: "friends"
layout: "friends"
---

同时,在你的博客 source 目录下新建 _data 目录,在 _data 目录中新建 friends.json 文件,文件内容如下所示:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[{
"avatar": "http://image.luokangyuan.com/1_qq_27922023.jpg",
"name": "码酱",
"introduction": "我不是大佬,只是在追寻大佬的脚步",
"url": "http://luokangyuan.com/",
"title": "前去学习"
}, {
"avatar": "http://image.luokangyuan.com/4027734.jpeg",
"name": "闪烁之狐",
"introduction": "编程界大佬,技术牛,人还特别好,不懂的都可以请教大佬",
"url": "https://blinkfox.github.io/",
"title": "前去学习"
}, {
"avatar": "http://image.luokangyuan.com/avatar.jpg",
"name": "ja_rome",
"introduction": "平凡的脚步也可以走出伟大的行程",
"url": "https://me.csdn.net/jlh912008548",
"title": "前去学习"
}]

新建 404 页

如果在你的博客 source 目录下还没有 404.md 文件,那么你就需要新建一个

1
hexo new page 404

编辑你刚刚新建的页面文件 /source/404/index.md,至少需要以下内容:

1
2
3
4
5
6
7
---
title: 404
date: 2018-09-30 17:25:30
type: "404"
layout: "404"
description: "Oops~,我崩溃了!找不到你想要的页面 :("
---

测试

  • 此时运行hexo系列命令
1
2
3
hexo clean
hexo g
hexo s

我是next主题转过来的,自带一些信息,不过正常情况下也可以正常进入主题了。

参考资料



文章链接:
https://www.zywvvd.com/notes/hexo/theme/matery/add-matery-theme/add-matery-theme/


“觉得不错的话,给点打赏吧 ୧(๑•̀⌄•́๑)૭”

微信二维码

微信支付

支付宝二维码

支付宝支付

Matery -1- 主题安装
https://www.zywvvd.com/notes/hexo/theme/matery/add-matery-theme/add-matery-theme/
作者
Yiwei Zhang
发布于
2021年8月5日
许可协议