更换主题
克隆主题仓库
git clone https://github.com/iissnan/hexo-theme-next themes/next
配置文件
配置站点_config.yum文件,修改theme为我们想要的主题
# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: next
配置主题_config.yum文件。选择样式取掉前面的#号
# ---------------------------------------------------------------
# Scheme Settings
# ---------------------------------------------------------------
# Schemes
#scheme: Muse
#scheme: Mist
scheme: Pisces
#scheme: Gemini
可能遇到的问题
hexo使用theme出现
“ {% extends ‘_layout.swig‘ %} {% import ‘_macro/post.swig‘ as post_template %}“
原因是hexo在5.0之后把swig给删除了需要自己手动安装
npm i hexo-renderer-swig
配置站点基本信息
在站点配置文件_config.yml修改基本的站点信息,依次是网站标题、副标题、网站描述、作者、网站头像外部链接、网站语言、时区等。
# Site
title: Mark's Blog
subtitle: I love to travel, but hate to arrive.
description:
keywords:
author: Akram Amat
language: zh-Hans
timezone:
动态背景设置
Next主题自带有动态的背景效果,修改主题配置文件中的canvas_nest: false为canvas_nest: true即可。
# Canvas-nest
canvas_nest: true
# three_waves
three_waves: false
增删侧栏条目
- 创建菜单文件
hexo new page "你所要增加的菜单项名称(要和你在menu中的填写要匹配)"
- 编辑菜单文件
title: 标签
date: 2020-11-27 10:23:31
type: "tags"
- 修改主题配置文件
menu:
#home: / || home
#about: /about/ || user
tags: /tags
设置toc目录
- 安装toc插件
cnpm install hexo-toc --save
- 配置站点配置文件,在文件末尾添加。
toc:
maxDepth: 4 //深度
slugify: false //防止中文链接被转义无法跳转
- 在markdown中使用
<!-- toc -->