# 支持页面静态缓存，Halo 2.7.0 发布

原文：<https://www.halo.run/archives/halo-270-released>

Halo 是一款强大易用的开源建站工具，它让你无需太多的技术知识就可以快速搭建一个博客、网站或者内容管理系统。具备可插拔架构、主题套用、富文本编辑器等多重特性，支持用户根据自己的喜好选择不同类型的插件及主题模板来定制化自己的站点功能及外观。让内容创作和发布更加便捷生动。

截至目前（2023 年 Q2 季度），Halo 已经在 Docker Hub 获得了超过 170 万次下载，GitHub Star 数突破 27 k，并拥有一百多名社区贡献者。

2023 年 6 月 30 日，强大易用的开源建站工具 Halo 正式发布 2.7.0 版本。

在这个版本中，Halo 主要支持了页面静态缓存、编辑器优化与扩展支持等功能，以及其他 30 多项功能优化和问题修复。

## 亮点更新

### 页面静态缓存

在 Halo 2.7.0 中，我们实现了页面的静态缓存，可以在访问页面之后自动缓存渲染结果，再次访问时不会再经过数据查询和页面渲染，这可以很大程度地加速页面访问速度和降低服务器压力，并且支持自动清空缓存（默认一个小时）和手动清空缓存。

当然，如果当前是已经登录的状态，则不会经过缓存，所以不会影响数据操作的实时性。

访问速度对比：

| 
开启缓存前

 | 

开启缓存后

 |
| --- | --- |
| 

![page\_cache\_disabled.png](https://www.halo.run/upload/page_cache_disabled.png)

 | 

![page\_cache\_enabled.jpeg](https://www.halo.run/upload/page_cache_enabled.jpeg)

 |

> 注：对比来自本地环境，不代表实际差异

需要注意的是，此特性目前需要手动开启，具体配置方式可以查阅文档：[https://docs.halo.run/getting-started/install/docker-compose](https://docs.halo.run/getting-started/install/docker-compose)

### 编辑器扩展

在 Halo 2.7.0 中，我们为默认的富文本编辑器提供了插件扩展支持，包括内容类型、工具栏、指令等，这就意味着我们可以在编辑器中通过插件添加更多的内容类型支持，比如集成 KaTex 实现数学公式编辑、使用 Mermaid 实现图表编辑等。

集成 KaTex 实现数学公式的示例：

![editor-katex.png](https://www.halo.run/upload/editor-katex.png)

> 当前只是示例，KaTex 的插件正在开发中，可以关注：[https://github.com/halo-sigs/plugin-katex/pull/1](https://github.com/halo-sigs/plugin-katex/pull/1)

## 完整更新日志

### 新特性

-   支持页面静态缓存（默认关闭）。 by [@JohnNiang](https://github.com/JohnNiang) in [#4091](https://github.com/halo-dev/halo/pull/4091)
    
-   访客发表评论支持限流。 by [@JustinLiang522](https://github.com/JustinLiang522) in [#4084](https://github.com/halo-dev/halo/pull/4084)
    
-   增加登录失败次数限制功能。 by [@JohnNiang](https://github.com/JohnNiang) in [#4062](https://github.com/halo-dev/halo/pull/4062)
    
-   对评论回复添加频率限制。 by [@JohnNiang](https://github.com/JohnNiang) in [#4135](https://github.com/halo-dev/halo/pull/4135)
    
-   限制注册接口的请求速率。 by [@JohnNiang](https://github.com/JohnNiang) in [#4128](https://github.com/halo-dev/halo/pull/4128)
    
-   默认编辑器支持不通过附件库直接插入图片、视频、音频。 by [@ruibaby](https://github.com/ruibaby) in [#4126](https://github.com/halo-dev/halo/pull/4126)
    

### 功能优化

-   优化 Console 端部分页面复制功能的兼容性问题。 by [@ruibaby](https://github.com/ruibaby) in [#4114](https://github.com/halo-dev/halo/pull/4114)
    
-   Console 端仪表盘的内置小组件添加权限设置。 by [@ruibaby](https://github.com/ruibaby) in [#4112](https://github.com/halo-dev/halo/pull/4112)
    
-   Console 端默认类型的按钮添加鼠标悬浮的样式。 by [@ruibaby](https://github.com/ruibaby) in [#4108](https://github.com/halo-dev/halo/pull/4108)
    
-   优化 Console 端弹框组件（VModal）在 iOS 设备的高度问题。 by [@ruibaby](https://github.com/ruibaby) in [#4106](https://github.com/halo-dev/halo/pull/4106)
    
-   维护 Console 端的开发基础设施。 by [@ruibaby](https://github.com/ruibaby) in [#4105](https://github.com/halo-dev/halo/pull/4105)
    
-   移除 Console 端页面的 lang 属性，避免出现浏览器的翻译提示。 by [@longjuan](https://github.com/longjuan) in [#4085](https://github.com/halo-dev/halo/pull/4085)
    
-   优化 Console 端登录页面的三方登录方式按钮，禁用重复点击。 by [@ruibaby](https://github.com/ruibaby) in [#4066](https://github.com/halo-dev/halo/pull/4066)
    
-   Console 端三方登录支持重定向参数。 by [@ruibaby](https://github.com/ruibaby) in [#4063](https://github.com/halo-dev/halo/pull/4063)
    
-   Console 端的文章分类支持在新建时指定上级分类。 by [@ruibaby](https://github.com/ruibaby) in [#4056](https://github.com/halo-dev/halo/pull/4056)
    

### 问题修复

-   修复 Console 端的下拉框组件选项在移动端无法正常点击的问题。 by [@ruibaby](https://github.com/ruibaby) in [#4116](https://github.com/halo-dev/halo/pull/4116)
    
-   修复开发环境下访问 Console 出现异常的问题。 by [@JohnNiang](https://github.com/JohnNiang) in [#4096](https://github.com/halo-dev/halo/pull/4096)
    
-   修复主题和插件静态资源的路径遍历漏洞。 by [@guqing](https://github.com/guqing) in [#4072](https://github.com/halo-dev/halo/pull/4072)
    
-   修复登录时出现用户名不存在的问题。 by [@JohnNiang](https://github.com/JohnNiang) in [#4070](https://github.com/halo-dev/halo/pull/4070)
    
-   修复 AttachmentReconciler 重复执行的问题。 by [@Contour-D](https://github.com/Contour-D) in [#4052](https://github.com/halo-dev/halo/pull/4052)
    
-   修复 Meta Description 中含有特殊字符导致页面显示异常的问题。 by [@Contour-D](https://github.com/Contour-D) in [#4031](https://github.com/halo-dev/halo/pull/4031)
    
-   修复插件重启后 MainClass 对象缓存未清除的问题。 by [@guqing](https://github.com/guqing) in [#4023](https://github.com/halo-dev/halo/pull/4023)
    
-   修复文章页 Meta Description 标签重复问题。 by [@guqing](https://github.com/guqing) in [#4069](https://github.com/halo-dev/halo/pull/4069)
    

### 依赖更新

-   升级 Console 端 FormKit 的依赖版本至 0.17.3。 by [@ruibaby](https://github.com/ruibaby) in [#4103](https://github.com/halo-dev/halo/pull/4103)
    
-   升级 Google Guava 版本至 32.0.1-jre。 by [@guqing](https://github.com/guqing) in [#4081](https://github.com/halo-dev/halo/pull/4081)
    
-   升级 Spring Boot 至 3.1.1。 by [@JohnNiang](https://github.com/JohnNiang) in [#4136](https://github.com/halo-dev/halo/pull/4136)
    

### 开发者相关

-   Console 端的默认编辑器支持被扩展。 by [@ruibaby](https://github.com/ruibaby) in [#4090](https://github.com/halo-dev/halo/pull/4090)
    
-   插件的 Controllers 支持自定义 API Group。 by [@guqing](https://github.com/guqing) in [#4065](https://github.com/halo-dev/halo/pull/4065)
    
-   统一主题和插件描述文件的部分字段。 by [@guqing](https://github.com/guqing) in [#4061](https://github.com/halo-dev/halo/pull/4061)
    
-   支持在插件中使用 [@ConfigurationProperties](https://github.com/ConfigurationProperties) 注解。 by [@JohnNiang](https://github.com/JohnNiang) in [#4043](https://github.com/halo-dev/halo/pull/4043)
    
-   Console 端的评论来源显示支持通过插件扩展。 by [@ruibaby](https://github.com/ruibaby) in [#4039](https://github.com/halo-dev/halo/pull/4039)
    
-   为主题端的文章和自定义页面内容添加扩展点。 by [@guqing](https://github.com/guqing) in [#4080](https://github.com/halo-dev/halo/pull/4080)
    
-   优化主题端评论的 Finder API，list 方法支持查询所有来源的评论。 by [@guqing](https://github.com/guqing) in [#4104](https://github.com/halo-dev/halo/pull/4104)
