then-purpleT
Refine2y ago
15 replies
then-purple

Change title

I would like to change the header file title from refine to somethign else i tried to change it to a <DocumentTitleHandler handler={customTitleHandler} /> but it didn't work(btw this is the customTittleHandler
import { IResourceItem, Action } from "@refinedev/core";

interface TitleHandlerOptions {
  resource?: IResourceItem;
  action?: Action;
  params?: Record<string, string | undefined>;
  pathname?: string;
  autoGeneratedTitle: string;
}

export const customTitleHandler = ({
  pathname,
  resource,
  action,
  params,
  autoGeneratedTitle,
}: TitleHandlerOptions) => {
  // Default title
  let title = autoGeneratedTitle || "Michiduta's Playground";

  // Custom title logic
  if (pathname) {
    if (pathname === "/login") {
      title = "Login - Michiduta's Playground";
    } else if (pathname === "/register") {
      title = "Register - Michiduta's Playground";
    } else if (pathname === "/forgot-password") {
      title = "Forgot Password - Michiduta's Playground";
    } else if (pathname === "/kanban-board-home") {
      title = "Kanban Board - Michiduta's Playground";
    }
  }

  return title;
};
Was this page helpful?