Loading

Hexo相关配置

date: 2018-11-16 18:27:14
updated: 2018-11-16 20:06:16

1.配置Hexo基本信息

title: 猫熊小才天の书院  #博客标题
subtitle:   #博客副标题
description: 凡事都想试一试的某某  #博客描述
author: Mxxct  #博客作者
language: zh-Hans #语言

# Pagination
## Set per_page to 0 to disable pagination
per_page: 5
pagination_dir: page

# 可以添加以下内容
archive_generator:
  per_page: 10 ##归档页面默认10篇文章标题
  yearly: true  ##生成年视图
  monthly: true ##生成月视图
  
tag_generator:
  per_page: 10 ##标签分类页面默认10篇文章
  
category_generator:
   per_page: 10 ###分类页面默认10篇文章

2.更换主题Next

2.1 安装主题

输入以下指令

git clone https://github.com/iissnan/hexo-theme-next themes/next

下载完成后,修改根目录下_config.yml文件的theme字段为next即可启用NexT主题

# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
## theme: landscape
theme: next

2.2 配置主题

在footer部分,可以将powered和theme全部只为false,就可以屏蔽掉尾注
menu部分只打开home、tags、categories、archives即可
scheme按照喜好选择
将enable置为true,避免首页一次显示文章全部

auto_excerpt:
  enable: true
  length: 150

3.添加分类和标签功能

进入到博客根目录,输入以下命令

hexo new page categories

成功后会提示:

INFO  Created: ~/Documents/blog/source/categories/index.md

根据上面的路径,找到index.md这个文件,打开后默认内容是这样的:

---
title: 文章分类
date: 2018-11-16 17:00:00
---

添加type: "categories"到内容中,添加后文件如下:

---
title: 文章分类
date: 2018-11-16 17:00:00
type: "categories"
---

同理,如上操作创建标签功能

$ hexo new page tags
---
title: 文章分类
date: 2018-11-16 17:00:00
type: "tags"
---

给文章添加分类和标签的样式如下:

---
title: windows搭建hexo系统
date: 2018-11-16 17:10:51
categories:
  - hexo
tags:
   - hexo
---

可以打开scaffolds/post.md文件,在tages:上面加入categories:

---
title: {{ title }}
date: {{ date }}
categories:
tags:
---

保存后,之后执行hexo new 文章名命令生成的文件会自动加上categories

posted @ 2020-10-20 16:30  猫熊小才天  阅读(58)  评论(0编辑  收藏  举报