🚧 Rspress 2.0 文档还在开发中
close

LastUpdated eject-only

Warning

该组件是 eject-only 组件,专门为 wrap/eject 设计,不建议在 MDX 文件中直接使用

LastUpdated 展示页面的最后更新时间。通常配合主题的 lastUpdated 配置使用。

用法

该组件不接受任何 props,会自动从页面元数据中读取最后更新时间。

相关配置

rspress.config.ts 中开启 lastUpdated

rspress.config.ts
import { defineConfig } from '@rspress/core';

export default defineConfig({
  themeConfig: {
    lastUpdated: true,
  },
});

当启用 lastUpdated 时,组件会自动读取页面元数据并格式化显示。

如需自定义展示文案或时间格式,可通过 rspress eject LastUpdated 导出并修改 theme/components/LastUpdated/index.tsx