From 8a0f89fe74985a66133321c224e421abe0e157a4 Mon Sep 17 00:00:00 2001 From: Tiffany Qi Date: Fri, 4 Oct 2024 15:33:22 -0700 Subject: [PATCH] get title in page --- theme.config.tsx | 75 +++++++++++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 32 deletions(-) diff --git a/theme.config.tsx b/theme.config.tsx index 1666065d66..0831d357cb 100644 --- a/theme.config.tsx +++ b/theme.config.tsx @@ -1,5 +1,6 @@ import { FC, ReactNode } from "react"; -import { DocsThemeConfig } from "nextra-theme-docs"; +import { useRouter } from 'next/router' +import { DocsThemeConfig, useConfig } from "nextra-theme-docs"; import Search from "./components/Search/Search"; import MixpanelLogoWordmark from "./components/svg/MixpanelLogoWordmark"; import MainContent from "./components/MainContent/MainContent"; @@ -17,34 +18,47 @@ const config: DocsThemeConfig = { defaultTheme: `system`, }, docsRepositoryBase: "https://github.com/mixpanel/docs/tree/main", - head: ( - <> - - - - - - - - ), + head() { + const { asPath } = useRouter(); + const { title } = useConfig(); + const url = `https://docs.mixpanel.com${asPath}`; + + return ( + <> + {title} - Mixpanel Docs + + + + + + + + + + + ); + }, feedback: { content: "Question? Contact our Support Team", useLink: () => "https://mixpanel.com/get-support", @@ -55,9 +69,6 @@ const config: DocsThemeConfig = { logo: , logoLink: "https://mixpanel.com/home/", main: MainContent, - // useNextSeoProps: () => ({ - // titleTemplate: "%s - Mixpanel Docs", - // }), search: { component: Search, },