For AI agents: the complete documentation index is available at https://docs.halo.run/llms.txt, the full documentation bundle is available at https://docs.halo.run/llms-full.txt, and this page is available as Markdown at https://docs.halo.run/developer-guide/plugin/extension-points/server/singlepage-content.md.

主题端自定义页面内容处理

主题端自定义页面内容处理扩展点,作用同 主题端文章内容处理 扩展点,只是作用于自定义页面。

public interface ReactiveSinglePageContentHandler extends ExtensionPoint {

    Mono<SinglePageContentContext> handle(SinglePageContentContext singlePageContent);

    @Data
    @Builder
    class SinglePageContentContext {
        private SinglePage singlePage;
        private String content;
        private String raw;
        private String rawType;
    }
}

所有已启用的处理器会依次执行,前一个处理器返回的上下文会传给下一个处理器,因此必须返回处理后的 SinglePageContentContext,不要返回 Mono.empty()

ReactiveSinglePageContentHandler 对应的 ExtensionPointDefinition 如下:

apiVersion: plugin.halo.run/v1alpha1
kind: ExtensionPointDefinition
metadata:
  name: reactive-singlepage-content-handler
spec:
  className: run.halo.app.theme.ReactiveSinglePageContentHandler
  displayName: ReactiveSinglePageContentHandler
  type: MULTI_INSTANCE
  description: "Provides a way to extend the single page content to be displayed on the theme-side."

即声明 ExtensionDefinition 自定义模型对象时对应的 extensionPointNamereactive-singlepage-content-handler

调用流程参考:SinglePageConversionServiceImpl