close

useSite

useSite returns the serialized site configuration from rspress.config.ts.

  • Type: () => { site: SiteData }

Here is an example of getting the title configuration from rspress.config.ts:

Rspress
import { useSite } from '@rspress/core/runtime';

export default function SiteTitle() {
  const { site } = useSite();
  return <span>{site.title}</span>;
}

Can be used together with usePage to get both global site configuration and current page metadata.