Hexo 主题 Matery 教程
1. 项目目录结构及介绍
.
├── node_modules # 子模块依赖包
├── scaffolds # 用于创建新页面的模板
├── scripts # 自定义脚本
├── sources # 用户自定义源文件
│ └── assets # 自定义静态资源
│ └── ...(其他自定义文件)
├── themes # 主题文件夹
│ └── matery # Matery 主题文件
│ ├── _config.yml # 主题配置文件
│ ├── ...(其他主题文件)
└── _config.yml # 主站配置文件
node_modules
: 包含主题依赖的Node.js模块。 scaffolds
: 存放用于快速创建新页面的模板。 scripts
: 用户可添加的自定义脚本,如编译或发布任务。 sources
: 用户内容存储目录,包括自定义静态资源和其他文件。 themes/matery
: Matery主题文件夹,包含主题的所有组件和配置。
2. 项目的启动文件介绍
主要涉及两个启动文件:
-
_config.yml
: 在Hexo根目录下,这是主站点的全局配置文件,用来设置URL、部署策略、插件和各种全局选项。 -
themes/matery/_config.yml
: 这是Matery主题的配置文件,包含了主题特有的设置,比如颜色、布局和显示选项。
启动Hexo应用时,首先运行hexo clean
清理缓存,然后通过hexo server
启动本地开发服务器,这时会读取上述配置文件进行渲染。
3. 项目的配置文件介绍
主站配置文件 _config.yml
# 站点信息
title: Your Blog Title
subtitle: Your Blog Subtitle
description: Your Blog Description
author: Your Name
language: zh-CN
timezone: Asia/Shanghai
# URL
url: http://your-blog-url.com
root: /
permalink: :year/:month/:day/:title/
permalink_defaults:
# Deployment
deploy:
type: git
repo: <your-repo-url>
branch: master
# Other settings...
主题配置文件 themes/matery/_config.yml
# 主题基本设置
theme: matery
paginate: 6
pagination_dir: /page
archive_yearly: true
# Header
menu:
home: /
about: /about
archives: /archives
tags: /tags
categories: /categories
# Banner
banner:
enable: true
autoHeight: false
title: Your banner title
desc: Your banner description
bgImg: /path/to/banner-image.jpg
# Post settings
post:
excerpt: true
excerpt_length: 200
showReadingTime: true
toc: true
tocNumbered: false
authorAvatar: false
# 更多配置项...
以上是Matery主题的基本配置,详细的配置选项请参考官方文档。根据你的需求调整这些设置,可以定制出符合个人风格的博客界面。记得每次修改配置后保存并重新构建(hexo g
)以应用更改。