{"id":43398560,"url":"https://github.com/hooozen/hexo-theme-tranquility","last_synced_at":"2026-02-02T14:55:34.601Z","repository":{"id":65077666,"uuid":"580287380","full_name":"hooozen/hexo-theme-tranquility","owner":"hooozen","description":"致远是一款 Hexo 主题，专门为个人主页及多学科领域博主设计","archived":false,"fork":false,"pushed_at":"2025-06-21T07:03:39.000Z","size":30615,"stargazers_count":187,"open_issues_count":11,"forks_count":16,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-21T07:21:50.984Z","etag":null,"topics":["hexo","hexo-theme"],"latest_commit_sha":null,"homepage":"https://theme.hozen.site/tranquility/","language":"Nunjucks","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hooozen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-12-20T07:25:55.000Z","updated_at":"2025-06-21T07:03:42.000Z","dependencies_parsed_at":"2024-01-09T04:46:10.788Z","dependency_job_id":"74fd5302-787d-4991-8d71-893902926d40","html_url":"https://github.com/hooozen/hexo-theme-tranquility","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/hooozen/hexo-theme-tranquility","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hooozen%2Fhexo-theme-tranquility","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hooozen%2Fhexo-theme-tranquility/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hooozen%2Fhexo-theme-tranquility/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hooozen%2Fhexo-theme-tranquility/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hooozen","download_url":"https://codeload.github.com/hooozen/hexo-theme-tranquility/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hooozen%2Fhexo-theme-tranquility/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29013562,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-02T12:48:30.580Z","status":"ssl_error","status_checked_at":"2026-02-02T12:46:38.384Z","response_time":58,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hexo","hexo-theme"],"created_at":"2026-02-02T14:55:33.968Z","updated_at":"2026-02-02T14:55:34.590Z","avatar_url":"https://github.com/hooozen.png","language":"Nunjucks","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003ch1\u003e \u003cdiv align=\"center\"\u003e\u003cimg align=\"center\" height=\"40\" src=\"source/images/tranquility.svg\"/\u003e 致远\u003c/div\u003e\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e致远是一款 Hexo 主题，专门为个人主页及多学科领域博主设计\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://github.com/hooozen/hexo-theme-tranquility/releases\"\u003e\u003cimg alt=\"GitHub release (latest by date)\" src=\"https://img.shields.io/github/v/release/hooozen/hexo-theme-tranquility?label=release\u0026color=orange\"\u003e\u003c/a\u003e\n\u003ca href=\"https://hexo.io/\"\u003e\u003cimg src=\"https://img.shields.io/badge/Hexo-%3E%3D6.3.0-blue?logo=hexo\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/hooozen/hexo-theme-tranquility/blob/main/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/hooozen/hexo-theme-tranquility\"\u003e\u003c/a\u003e\n\n\u003cimg src=\"./doc/images/index-ios-3.jpg\"/\u003e\n\u003c/p\u003e\n\n演示站：\n\n- [致远](https://theme.hozen.site/tranquility/)\n- [浩然的主页](https://www.hozen.site)\n\n## 特点\n\n- 主页风格，聚焦个性展示\n- [“子页”设计](#子页)，适应多领域写作\n- 三端自适应，舒适阅读\n- 自定义字体及提取压缩，兼具美观和性能\n- [简历制作](#简历)、[时间线](#时间线)、[相关文章](#相关文章)、[数学公式](#数学公式)、[Gitalk 评论](#其他)、[赞赏](#文章赞赏)、[SEO](#其他)\n- 等\n\n -----\n\n## 目录\n\n- [特点](#特点)\n- [目录](#目录)\n- [安装](#安装)\n- [升级](#升级)\n- [设计逻辑](#设计逻辑)\n  - [改变](#改变)\n- [配置](#配置)\n  - [子页](#子页)\n  - [时间线](#时间线)\n  - [简历](#简历)\n  - [代码高亮](#代码高亮)\n  - [数学公式](#数学公式)\n  - [首页自定义](#首页自定义)\n  - [导航](#导航)\n  - [页脚自定义](#页脚自定义)\n  - [标签云](#标签云)\n  - [文章封面](#文章封面)\n  - [文章目录](#文章目录)\n  - [文章置顶](#文章置顶)\n  - [文章赞赏](#文章赞赏)\n  - [相关文章](#相关文章)\n  - [自定义字体](#自定义字体)\n  - [Mermaid 增强](#mermaid-增强)\n  - [文章搜索](#文章搜索)\n  - [文章摘要](#文章摘要)\n  - [其他](#其他)\n\n## 安装\n\n0. 前置条件：[node(\u003e=16)](https://nodejs.org/en)、[Git](https://git-scm.com/)、[Hexo](https://hexo.io/) 以及使用 Hexo 博客文件。如果你还不了解以上内容，请从[这里](https://hexo.io/zh-cn/docs/)获取相关帮助。\n\n1. 下载本仓库的文件到你的 Hexo 目录的 `themes\\tranquility` 文件夹下:\n\n    ```sh\n    cd hexo\n    git clone https://github.com/hooozen/hexo-theme-tranquility.git themes/tranquility\n    ```\n\n2. 并配置根目录下 `_config.yml` 中的 `theme` 字段为 `tranquility`（参考 [主题 | Hexo](https://hexo.io/zh-cn/docs/themes))。\n\n3. 移除冲突的依赖，并安装必要依赖:\n\n    ```bash\n    npm uninstall hexo-generator-category hexo-generator-archive\n    npm install hexo-pagination moment opentype.js\n    ```\n\n4. 主题配置\n    将主题目录下的配置文件 `themes/tranquility/_config-template.yml` 复制到博客文件根目录下，并重命名为 `_config.tranquility.yml`。在 `_config.tranquility.yml` 个性化主题配置，具体的配置项查看[配置](#配置)或阅读配置文件的注释。\n\n5. 补充(*针对非开发者*)  \n    阅读报错可以使我们更快的定位问题，例如：\n\n    - 缺少依赖\n\n      随着主题的更新可能会依赖更多的第三方模块，此时用户需要自己添加新的依赖。例如，运行报错内容如下：\n\n      ```log\n      ...\n      Error: Cannot find module 'a_third_module'\n      ...\n      ```\n\n      显然根据提示，缺少名为 `a_third_module` 的模块，只需要安装该依赖即可：\n\n      ```bash\n      npm install a_third_module\n      ```\n\n      参考 [npm-install | npm Docs](https://docs.npmjs.com/cli/v8/commands/npm-install)\n\n## 升级\n\n本主题在不停迭代，当使用过程中遇到问题时可以查看主题是否已经有了更新。主题升级的步骤如下：\n\n- 进入主题目录拉取更新\n\n    ```bash\n    cd themes/tranquility\n    git pull\n    ```\n\n- 阅读[更新说明](https://github.com/hooozen/hexo-theme-tranquility/releases)，并查看 `themes/tranquility/_config-template.yml` 的新增和修改项，对应修改你的 `_theme.tranuility.yml` 文件\n\n## 设计逻辑\n\n本主题改变了 Hexo 的默认设计逻辑，所以与大多数的 Hexo 主题的用法不同，请参考下文。\n\n大多数的 Hexo 主题的设计目的是在于**纯粹的博客记录**，并且博主的博客内容往往集中于单一学科领域（如互联网技术）。因此在这个需求驱动下，大多数 Hexo 主题被设计为主页展示文章列表，并使用繁多的分类（Category）为文章进行细分。这种设计很好的满足了需求。\n\n当用户需要一个能够展示个人特点的主页，并且需要对博客的内容进行**明确**的领域划分时，这些主题并不能很好的满足这些需求。因此“致远”主题被设计出来，同时也规定了用户群体。\n\n### 改变\n\n主页并不展示文章列表，而是展示具有个人特点的内容，如“关于”和“时间线”模块。\n\n引入“子页”的概念来取代“分类”（Category），所有的子页都在导航栏具有一级入口。基于此，子页的概念应该更广，往往为某一个学科大类或者领域，例如所有的互联网技术博文应该被划分为一个“子页”中，不管它属于“前端技术”还是“服务端技术”。\n\n对于同属一个“子页”的文章，借鉴了微信公众号的分类逻辑，使用标签（Tag）来对文章进行分类和聚合。因此主题中**没有了**默认的 Category 的概念和入口，取而代之的是“子页”（Subpage）与“标签”（Tag）的概念。  \n\n有关该主题的设计理念，如果这里的描述不够清楚，打开[演示站](https://www.hozen.site)浏览一下应该就明白了。如果无法理解这种改变，可能是因为您并没有这种需求，使用其他 Hexo 主题可能会是更好的选择。\n\n## 配置\n\n经过[安装](#安装)步骤，你在博客根目录下已经有了一个 `_config.tranquility.yml` 文件。如没有，请阅读并检查[安装步骤](#安装)。如不加说明，该部分的配置均在博客更目录下的 `_config.tranquility.yml` 文件进行。\n\n本章所有的配置内容你都可以在 [致远](https://theme.www.hozen.site/tranquility/) 网站找到对应的测试文章，并在 [hooozen/hexo-theme-test](https://github.com/hooozen/hexo-theme-test) 仓库中找到对应的配置文件。所以当哪个配置项说明读不懂时不妨去找一下对应的例子。\n\n### 子页\n\n子页的配置在 `subpage` 下进行：\n\n```yml\nsubpage: # 开启“子页”功能，详见 README\n  enable: true  # 是否开启子页功能\n  pages:  # 子页数组\n    - name: # 子页标识，如 developer\n      path: # 若不设置则默认使用 name\n      title: # 显式在导航栏的菜单名，如 开发者\n      icon: # 图标的路径\n      description: # 描述\n```\n\n若关闭子页功能（`enbale: false`），则导航栏只会有一个“博客”按钮，点击该按钮就会进入所有文章列表。\n\n若开启子页功能（`enbale: true`），则必须配置 `pages` 数组。该数组中使用 `name` 标识子页。`path` 指定子页的路径，默认使用 `name`。该数组的 `title` 会展示在导航栏的菜单中。配置完毕后，`pages` 数组中的所有项都会以 `title` 为名展示在网页的头部导航栏，点击每一项进入相应的子页。`icon` 和 `description` 用于配置子页中的图标和表述。\n\n例如，[致远](https://theme.hozen.site/tranquility/)所使用的[子页配置](https://github.com/hooozen/hexo-theme-test/blob/main/_config.tranquility.yml#L13)。\n\n新建文章后，只需要把文章头部的 `category` 字段设置为某子页的 `name` 即可将该文章划分到该子页下。\n\n### 时间线\n\n时间线的设计初衷是为了展示博主的**重要**事件或履历，如荣誉、宿醉、死亡等[\u003csup\u003e[1]\u003c/sup\u003e](#ref1)。\n\n你也可以用它来展示精选文章或其他内容，时间线支持自定义配置。\n\n![timeline](doc/images/timeline.gif)\n\n时间线的配置在 `timeline` 下进行\n\n```yml\ntimeline:\n  enable: true  # 是否开启时间线\n  reversed_order: true # 是否按时间倒序展示\n  items:  # 配置时间线分类\n    - name: article  # 分类名称\n      color: \"#ee936c\"  # 分类主题色\n      icon: /images/icon/icon-article.svg  # 分类图标\n      checked: false  # 是否默认展示\n    - name: apps\n      color: \"#60a465\"\n      icon: /images/icon/icon-app.svg\n      checked: true\n    - name: event\n      color: \"#568dc4\"\n      icon: /images/icon/icon-event.svg\n      checked: false\n```\n\n在文章中配置 `timeline` 字段并指定时间线分类名称后，该文章会展示在时间线列表中，例如：\n\n```yml\n---\nid: 57\ntitle: 多少冬天\ndate: 2022-11-30 23:23:48\ntags: \n  - 散文\ncategories: life  # 属于 life 子类下\ncover: /assets/images/57-1.jpg\ntimeline: article  # 展示在时间线列表中\n---\n```\n\n有关时间线的配置修改**可能需要重新启动服务**才会生效\n\n### 简历\n\n此功能提供一个线上简历页面，通过浏览器的打印功能可以导出 PDF，并且通过超链接保持简历的时效。通过主题配置文件的 `cv` 字段配置。\n\n首先需要安装以下依赖：\n\n```bash\nnpm install hexo-fontawesome-icons\n```\n\n博客的基础配置如下：\n\n- `enable: true` 是否开启简历功能\n- `showInNav: true` 是否在网站导航栏显示(需 `enable` 为 `true`)\n- `keywords: ...` 简历页的关键词(SEO)\n- `description: ...` 简历页的描述(SEO)\n- `title: ...'cv` 简历页的标题\n- `iconPrefix: fas` 简历中 fontawesome 图标使用的风格\n\n博客的内容配置(`cv.content`)分为以下几块：\n\n1. 标题(title)\n2. 基本信息(baseInfo)\n3. 教育背景(edu)\n4. 超链接(tel | email | github | (blog \u0026 blogHref))\n5. 自定义模块(chapters)\n\n其中前 4 个配置是必需的(超链接可任选若干)，配置比较简单请参考演示项目的配置。\n\n对于自定义模块用户根据自身情况自行添加，例如“工作经历”、“项目经历”、“自我评价”等。其配置方法如下：\n\n任何一个自定义模块视为 `chapters` 数组中的一个章节，有以下基本属性：\n\n- `title: string` 标题\n- `icon: string` 图标\n- `tips?: string` 提示，可选\n- `content?: string[]` 内容(与 `sections` 二选一)\n- `sections?: Section[]` 分节(与 `content` 二选一)\n\n其中图标使用 fontawesome 的图标插件，去它的[图标库](https://fontawesome.com/search?o=r\u0026m=free)搜索你想使用的图标名称即可。\n\n内容的配置分为 `content` 和 `sections` 两种，若使用 `content` 则在该字段下输入分段数组来构成所在模块的内容。适合简单的场景，例如自我评价.\n\n```yml\nchapters:\n  - ...\n    ...\n  - title: 个人小结\n    icon: ranking-star\n    content:\n      - 第一段文本\n      - 第二段文本\n      - ...\n```\n\n而对于工作经历等模块，需要在模块中分节来介绍若干个工作经历或项目经历，则使用 `sections` 配置:\n\n```yml\n  - ...\n    ...\n  - title: 个人小结\n    icon: ranking-star\n    sections:\n      - ...\n```\n\n每个 `section` 的配置字段如下：\n\n- `title: string` 标题\n- `link?: string` 链接，可选\n- `description: string` 描述\n- `content: string[]` 内容\n\n### 代码高亮\n\n代码高亮依赖于博客**根目录**下的 `_config.yml` 的 `highlight` 配置，请配置如下：\n\n```yml\nhighlight:\n  enable: true\n  line_number: true\n  auto_detect: false\n  tab_replace: \"\"\n  wrap: true\n  hljs: true\nprismjs:\n  enable: false\n  preprocess: true\n  line_number: true\n  tab_replace: \"\"\n\n```\n\n### 数学公式\n\n主题有两种方式开启对 Latex 数学公式的支持，但都需要先进行以下操作：\n\n- **移除** Hexo 默认的 markdown 渲染插件 `hexo-renderer-marked`，并安装 `hexo-renderer-pandoc`。如果安装了其他的 markdown 渲染插件也请移除！\n\n  ```bash\n  npm uninstall hexo-renderer-marked\n  npm install hexo-renderer-pandoc\n  ```\n\n- 安装 pandoc 软件，查看 [pandoc.org](https://www.pandoc.org/)。\n\n第一种方法，使用主题预置的 Latex 解析，直接在配置文件中开启 `mathjax` 即可使用\n\n```yml\nmathjax: true # 加载 LateX 数学公式库\n```\n\n第二种方法，使用第三方插件 [hexo-filter-mathjax](https://github.com/next-theme/hexo-filter-mathjax) 进行服务端渲染。并关闭配置文件中的 `mathjax: false`\n\n从访问性能来讲，推荐使用第二种方法。\n\n### 首页自定义\n\n- 查看 `index` 配置项\n\n### 导航\n\n- `nav.sticky` 配置导航栏是否粘滞在顶部\n\n### 页脚自定义\n\n- `foot.title` 配置页脚显式的标语\n\n- `foot.linksRows` 配置链接的行数, 参考 [issue#44](https://github.com/hooozen/hexo-theme-tranquility/issues/44).\n\n- `links` 配置友链\n\n- `social` 配置社交帐户或其他链接\n\n- `contacts` 配置联系方式\n\n### 标签云\n\n标签云出现在每个子页的首页，用来展示该子页下文章的标签分布。标签云有两种形式：3D 动画云和静态标签云。\n\n- `tagcloud.fancy` 选择是否开启 3D 动画云\n- `tagcloud` 的其他选项用以配置 3D 标签云，参考 [tagcloud](https://hexo.io/zh-cn/docs/helpers#tagcloud)\n\n### 文章封面\n\n- 文章列表封面图片的配置，通过设置文章头部的 `cover` 字段指定封面图片的 URL\n\n### 文章目录\n\n- 通过在文章头部配置 `toc: true` 来展示文章目录。具有较多层级结构的文章推荐开启，而散文等文本类可以关闭。\n\n### 文章置顶\n\n- 通过数字来指定文章头部的 `sticky` 属性对文章进行置顶，数字越大置顶优先级越高。数字都需要大于 `0`。\n\n### 文章赞赏\n\n- 配置项 `reward` 进行文章赞赏配置，包括头像、二维码和语句等。\n\n### 相关文章\n\n相关文章用来在每篇文章底部展示与本篇文章相关的推荐文章。\n\n- 首先安装依赖\n\n    ```bash\n    npm install hexo-related-popular-posts\n    ```\n\n- 通过 `related_post` 配置项进行配置，具体配置查看[插件文档](https://github.com/tea3/hexo-related-popular-posts)。\n\n### 自定义字体\n\n主题的部分区域为了设计感使用了第三方的汉字字体。但由于汉字字体包太大，因此本主题对用户使用的部分字体进行了提取打包成子字体。\n\n通过 `zh_font` 配置项进行开启或关闭\n\n### Mermaid 增强\n\nMermaid 是一个基于 Javascript 的图表绘制工具，通过解析类 Markdown 的文本语法来实现图表的创建和动态修改。\n\n- 首先安装依赖\n\n    ```bash\n    npm install hexo-filter-mermaid-diagrams\n    ```\n\n- 在配置文件中启用\n\n    ```yml\n    mermaid:\n      enable: true # 启用 Mermaid 增强\n      version: latest\n      options: \n        startOnload: true\n    ```\n\n- 然后就可以在 markdown 文章中绘图了（GitHub 会自动渲染，用法就是代码块设置为 mermaid）\n\n    ```mermaid\n    graph LR\n      A --\u003e B\n      A --\u003e D\n    ```\n\n- 如果想要在本地预览 mermaid 的渲染结果，需要支持 mermaid 的 markdown 编译器。如果使用 vscode，需要下载 [Markdown Preview Mermaid Support](https://marketplace.visualstudio.com/items?itemName=bierner.markdown-mermaid) 这个插件。\n\n- Mermaid 的具体的用法可参考 [Mermaid 指引](http://mermaid.js.org/intro/)。\n\n### 文章搜索\n\n新增搜索功能，通过如下配置主题配置文件启用：\n\n```yml\nsearch:\n  path: search.json\n  enable: true\n  field: post\n  content: true\n```\n\n### 文章摘要\n\n我们都知道通过在 markdown 文件中使用 `\u003c!--more--\u003e` 可以截断文章，使得在这之前的内容可以作为 excerpt 显示在文章列表页。另外，也可以在[Front-matter](https://hexo.io/zh-cn/docs/front-matter)中设置 abstract 字段来设置隐藏式摘要。\n\nabstract 的设置不同于通过在正文使用 \u003c!--more--\u003e 隔断的节录（excerpt）。abstract 的内容不会再出现在正文中，并且设置 abstrct 后会覆盖 excerpt 在文章列表的中的展示。\n\nabstract 功能功能类似微信公众号的摘要表现。\n\n```yml\n---\ntitle: 隐藏式摘要测试\ndate: 2024-01-27 11:58:32\ntags: text\ncategory: featTest\ncover: assets/hozen-durdledoor.jpg\nabstract: \"该文章测试隐藏式摘要功能，此文本只会在文章列表展示，文章正文中不再出现。\"\n---\n```\n\n### 其他\n\n请他配置请查看配置文件注释\n\n- gitalk 文章评论\n- 百度 SEO\n- 等\n\n-----\n\n\u003cdiv id='ref1'\u003e\u003c/div\u003e\n[1]. 引用了英雄联盟角色亚索的台词：“生命中有三件必经之事，荣誉、死亡，还有……宿醉……”\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhooozen%2Fhexo-theme-tranquility","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhooozen%2Fhexo-theme-tranquility","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhooozen%2Fhexo-theme-tranquility/lists"}