github refinedev/refine @refinedev/nextjs-router@5.3.0

Minor Changes

  • #4313 28fe67047a0 Thanks @abdellah711! - feat: dynamic window title for NextJS pages directory

    This feature enables users to generate document titles for each page in NextJS pages directory. To activate it, users need to include the DocumentTitleHandler component within the <Refine> component. By default, the DocumentTitleHandler will generate titles using the generateDefaultDocumentTitle exported from @refinedev/core.

    The DocumentTitleHandler component accepts an optional prop called handler, which is a callback function. This function is triggered whenever the pathname changes and receives an object with the following parameters:

    {
        resource, // 'posts'
            action, // 'create'
            params, // {id: 1}
            pathname, // '/posts/create'
            autoGeneratedTitle; // 'Create new Post | refine'
    }

    The handler callback should return the new title based on the provided parameters.

    To update the title in a child component, the user can use the useDocumentTitle hook. It accepts either a string representing the new title or an object with the property i18nKey if the app supports multiple languages.

    useDocumentTitle({ i18nKey: "documentTitle.default" });

    Note that this hook doesn't support SSR, and it will generate the titles in the client-side only.

Don't miss a new refine release

NewReleases is sending notifications on new releases.