hexo-theme-reimu

0.1.2 • Public • Published

hexo-theme-reimu

NPM License NPM Version GitHub Repo stars wakatime

❤ Hakurei Reimu ❤

演示网站

简体中文 | English


本人是车车人,所以制作了这样一款博丽灵梦风格的 Hexo 主题,融合了 landscapeTangyuxianShoka 三个主题

Astro 主题请参见 astro-theme-reimu

欢迎提交 ISSUE 和 PR!

路线图

  • [x] valine 评论系统
  • [x] waline 评论系统
  • [x] twikoo 评论系统(未测试)
  • [x] gitalk 评论系统(未测试)
  • [x] giscus 评论系统
  • [x] 黑夜模式
  • [x] 过渡动画效果
  • [x] google 字体
  • [x] 加载动画
  • [x] TOC
  • [x] 回到顶部
  • [x] 文章统计(仅 Valine 和 Waline)
  • [x] 鼠标烟花
  • [x] pjax(实验性)
  • [x] pwa(实验性)
  • [x] live2d(实验性)

结构

.
├── _screenshot 截图
├── _example    示例source文件夹内结构
├── _config.yml 主题配置
├── languages
├── layout
├── scripts
└── source

安装

使用 npm

npm install hexo-theme-reimu --save

或直接克隆本仓库至 /themes 文件夹下并重命名为 reimu

git clone https://github.com/D-Sketon/hexo-theme-reimu.git

并修改 _config.yml 中的 theme

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

使用

基本结构

为了保证显示正确,请参考 _example_source 中分别建立 _dataaboutfriend 文件夹

_data

  • avatar 文件夹中存储作者头像,默认命名 avatar.jpg,可在 内层 _config.yml 中做如下配置
avatar: "avatar.jpg" # 默认就是在avatar文件夹内寻找,请不要包含路径,否则会404
  • covers 文件夹中存储文章封面
  • covers.yml 中存储文章封面 url

about

index.md 作为关于页面

friend

index.md 作为友链页面,在 _data.yml 中填入友链信息即可在页面上显示对应好友卡片

封面、头图和图标

封面

封面显示逻辑如下

  • 如果文章的 Front matter 中包含 cover 的 url,则该文章头图和首页缩略图均显示该 url
---
title: Hello World
cover: https://example.com
---
  • 如果文章的 Front matter 中包含 cover 为 false,则该文章不显示头图(首页上仍然是随机图片)
---
title: Hello World
cover: false
---
  • 如果文章的 Front matter 中包含 cover 为 rgb(xxx,xxx,xxx),则该文章头图为对应的渐变纯色(首页上仍然是随机图片)
---
title: Hello World
cover: rgb(255,117,117)
---
  • 否则查找 covers 文件夹和 covers.yml,并从中随机挑选图片
  • 若上述文件均不存在,则显示头图

头图

头图保存于 themes/reimu/source/images/banner.jpg,可在内层 _config.yml 中修改

banner: "/images/banner.jpg"

图标

图标保存于 themes/reimu/source/images/favicon.ico,可在内层 _config.yml 中修改

favicon: "/images/favicon.ico"

置顶

在文章的 Front-matter 中添加 sticky: true

---
title: Hello World
sticky: true
---

代码高亮

为保证代码块的正确显示,请保证外层 _config.yml 中为如下配置 (<7.0.0)

highlight:
  enable: true
  wrap: true
  hljs: false
prismjs:
  enable: false

(>=7.0.0)

syntax_highlighter: highlight.js
highlight:
  wrap: true
  hljs: false

站内评论

站内评论可以使用Front matter 中的 comments 独立控制每篇文章是否显示评论。
commentsfalse 时不显示评论,true 或不填时根据 _config_yml 的配置决定是否显示。

若基于 Valine
请参考其官方文档完成 LeanCloud 的配置,并在内层 _config_yml 中将 valine.enable 改为 true,并填入自己的 appIdappKey

valine:
  enable: true
  appId: "your appId"
  appKey: "your appKey"

若基于 Waline
请参考其官方文档完成 LeanCloud 的配置,并在内层 _config_yml 中将 waline.enable 改为 true,并填入自己的 serverURL

waline:
  enable: true
  serverURL: "your server url"
  lang: zh-CN
  locale: {} # https://waline.js.org/guide/features/i18n.html#%E8%87%AA%E5%AE%9A%E4%B9%89%E8%AF%AD%E8%A8%80
  emoji:
    - https://unpkg.com/@waline/emojis@1.2.0/weibo
    - https://unpkg.com/@waline/emojis@1.2.0/alus
    - https://unpkg.com/@waline/emojis@1.2.0/bilibili
    - https://unpkg.com/@waline/emojis@1.2.0/qq
    - https://unpkg.com/@waline/emojis@1.2.0/tieba
    - https://unpkg.com/@waline/emojis@1.2.0/tw-emoji
  meta:
    - nick
    - mail
    - link
  requiredMeta:
    - nick
    - mail
  wordLimit: 0
  pageSize: 10
  pageview: true

若基于 twikoo
请参考其官方文档完成 腾讯云 或 Vercel 部署,并在内层 _config_yml 中将 twikoo.enable 改为 true,并填入自己的 envId

twikoo:
  enable: true
  envId: # 腾讯云环境填 envId;Vercel 环境填地址(https://xxx.vercel.app)
  region:

若基于 giscus,请参考文档完成仓库的配置,并在内层 _config_yml 中将 giscus.enable 改为 true,并填入对应的数据

giscus:
  enable: true
  repo: "your repo"
  repoId: "your repoId"
  category: "your category"
  categoryId: "your categoryId"
  mapping: mapping
  strict: 0
  reactionsEnabled: 1
  emitMetadata: 0
  inputPosition: bottom
  commentTheme: preferred_color_scheme
  lang: zh-CN

若基于 gitalk
请参考其官方文档完成仓库的配置,并在内层 _config_yml 中将 gitalk.enable 改为 true,并填入对应的数据

gitalk:
  enable: true
  clientID: "your application client ID"
  clientSecret: "your application client secret"
  repo: "your repo"
  owner: "repo owner"
  admin: "repo owner and collaborators"

站内搜索

若选择 Algolia,请安装 hexo-algoliasearch

npm install hexo-algoliasearch --save

并参考其 README 完成对 Algolia 账号的配置,并在外层 _confg.yml 中添加如下配置

algolia:
  appId: "your applicationID"
  apiKey: "your apiKey"
  adminApiKey: "your adminApiKey"
  indexName: "your indexName"
  chunkSize: 5000
  fields:
    - content:strip:truncate,0,500
    - excerpt:strip
    - gallery
    - permalink
    - photos
    - slug
    - tags
    - title

在内层 _config_yml 中将 algolia_search.enable 改为 true

algolia_search:
  enable: true

注意:搜索跳转链接为永久链接,所以请保证外层 _config.yml 中的 url 填写正确

若选择 hexo-generator-search,请安装hexo-generator-search

并参考其 README在外层 _config.yml 中添加如下配置

search:
  path: search.json # 文件名必须为search.json
  field: post
  content: true

在内层 _config_yml 中将 generator_search.enable 改为 true

generator_search:
  enable: true

数学公式

数学公式基于 Katex,请安装 hexo-renderer-markdown-it-plus

npm uninstall hexo-renderer-marked --save
npm install hexo-renderer-markdown-it-plus --save

在内层 _config_yml 中将 math.enable 改为 true

math:
  enable: true

Mermaid

请安装 hexo-filter-mermaid-diagrams

npm install hexo-filter-mermaid-diagrams --save

在内层 _config_yml 中将 mermaid.enable 改为 true

mermaid:
  enable: true

RSS

请安装 hexo-generator-feed

npm install hexo-generator-feed --save

并参考其 README 在外层 _config.yml 完成对 feed 的配置
在内层 _config.yml 中填入生成的 xml

rss: atom.xml

实验性功能

firework

默认开启

firework:
  enable: true

具体配置请查看 mouse-firework

pjax

默认关闭

pjax:
  enable: false

pjax 在 v0.0.10 中被引入,用于那些需要添加音乐播放器等需要 SPA 的用户。但其仍然属于实验性质,引入后可能会出现诸如脚本无法执行脚本重复执行页面渲染混乱等 BUG。请慎重考虑!

PWA

默认开启

service_worker:
  enable: true

live2d

默认关闭

live2d:
  enable: false

reimu鼠标指针

默认开启

reimu_cursor: true

贡献者

许可

FOSSA Status

Readme

Keywords

Package Sidebar

Install

npm i hexo-theme-reimu

Weekly Downloads

60

Version

0.1.2

License

MIT

Unpacked Size

686 kB

Total Files

99

Last publish

Collaborators

  • d-sketon