🚧 Rspress 2.0 document is under development
close

LastUpdated eject-only

Warning

This is an eject-only component, designed specifically for wrap/eject, and is not recommended for direct use in MDX files

LastUpdated displays the last update time of the current page.

Usage

index.mdx
import { LastUpdated } from '@rspress/core/theme';

<LastUpdated />;

This component does not accept any props. It automatically reads the last update time from the page metadata.

Configure lastUpdated in rspress.config.ts to enable this feature, and set formatting options like timezone and format:

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

export default defineConfig({
  themeConfig: {
    lastUpdated: {
      text: 'Last Updated',
      format: 'yyyy-MM-dd HH:mm',
      timezone: 'America/New_York',
    },
  },
});

When lastUpdated is enabled, the component will automatically read and format the page metadata for display.

Tip

If lastUpdated: true is not configured in the default theme, install and register @rspress/plugin-last-updated.