在开始使用本主题之前,建议先仔细阅读 Hexo 官方文档,以确保你对 Hexo 的基本使用和配置方式有一定了解。
建议 Node 版本:v16+
建议 Hexo 版本:v6+
菜单配置
_config.sea.ymlmenu: - name: Posts # 名称 url: /posts/ # 跳转链接 - name: Categories url: /categories/ - name: Tags url: /tags/ - name: Archives url: /archives/
首页配置
首页展示分为个人信息和文章展示两个模块
文章模块可配置展示 “推荐文章” 或者 “最近文章”,推荐文章需要在文章的Front-matter
中配置recommend: true
_config.sea.ymlhome: hero: name: # 名称 intro: # 个人简介 avatar: # 头像 posts: recent | recommend # recent: 最新文章 | recommend: 推荐文章
社交媒体
_config.sea.ymlsocialLink: - name: Github # 名称 link: https://github.com/hai-zou/hexo-theme-sea # 跳转链接
内置页面
Posts 页面
主题自定义的一个展示所有文章的页面,支持分页。
_config.sea.ymlarticles: path: 'posts' # 路由,默认为 posts per_page: 10 # 分页数 order_by: -date # 文章排序
分类页面
访问
/categories/
查看所有分类
单个分类下的文章展示页由 Hexo 默认提供,在
_config.yml
中配置
_config.ymlcategory_dir: categories category_generator: per_page: 10 order_by: -date
标签页面
访问
/tags/
查看所有标签
单个标签下的文章展示页由 Hexo 默认提供,在
_config.yml
中配置
_config.ymltag_dir: tags tag_generator: per_page: 10 order_by: -date
归档页面
归档页面由 Hexo 默认提供,在
_config.yml
文件中配置
_config.ymlarchive_dir: archives archive_generator: enabled: true # 是否启用 per_page: 20 order_by: -date
搜索配置
_config.sea.ymlsearch: enable: # 是否启用 type: # algolia | pagefind # Docsearch https://docsearch.algolia.com/apply/ algolia: appId: apiKey: indexName:
评论配置
_config.sea.ymlcomment: enable: # 是否启用 type: # waline | giscus # Waline https://waline.js.org/ waline: serverURL: options: # 配置项参考:https://waline.js.org/reference/client/props.html # Giscus https://giscus.app/zh-CN giscus: repo: repoid: category: categoryid: mapping: term: reactionsenabled: emitmetadata: inputposition: loading:
自定义代码块
友链模块
1、配置数据:
_config.sea.ymlfriends: - name: # 名称 avatar: # 头像 link: # 站点地址 desc: # 描述
2、使用:
friends.md{% friends %}
作品模块
1、配置数据:
_config.sea.ymlworks: - name: # 名称 desc: # 描述 tags: # 标签 - tag1 - tag2 - tag3 link: # 链接 cover: # 预览图
2、使用:
works.md{% works %}
提示模块
xxx.md{% note info %} This is an info box. {% endnote %} {% note warning %} This is an warning box. {% endnote %} {% note danger %} This is an danger box. {% endnote %}
展示效果:
This is an info box.
This is an warning box.
This is an danger box.
代码高亮
Hexo 默认提供两种:
highlight
和prismjs
本主题使用prismjs
, 需要在_config.yml
中修改默认配置
v7.0.0 以下版本
_config.ymlhighlight: enable: false prismjs: enable: true preprocess: true line_number: true line_threshold: 0 tab_replace: ''
v7.0.0 以上版本
_config.ymlsyntax_highlighter: prismjs prismjs: preprocess: true line_number: true line_threshold: 0 tab_replace: ''
文章 Front-matter 配置
xxx.mdtitle: # 文章标题 date: # 文章发布日期 2024-03-27 09:22:23 categories: # 文章分类 - cate1 - cate2 tags: # 文章标签 - tag1 - tag2 excerpt: # 摘要 或者 <!-- more --> 之前的文字将会被视为摘要 comments: # 是否展示评论,默认 true tableOfContents: # 目录 sticky: # 置顶,按数值大小排序 permalink: # 覆盖文章的永久链接 published: # 文章是否发布
其它配置
_config.sea.yml# 站点图标 favicon: /favicon.ico # Favicon 图标 # Footer footer: builtUpTime: 2020-05-20 13:14:00 # 建站时间 # 主题色 primaryColor: '#10b981'