diff --git a/packages/theme/components/layout/index-cards/IndexCards.tsx b/packages/theme/components/layout/index-cards/IndexCards.tsx index 5f8ba6b..370f8e0 100644 --- a/packages/theme/components/layout/index-cards/IndexCards.tsx +++ b/packages/theme/components/layout/index-cards/IndexCards.tsx @@ -22,7 +22,6 @@ type DocsItem = (MdxFile | FolderWithoutChildren) & { } export function IndexCards({route, folderData}: IndexCardsProps) { - const {basePath} = useRouter() const filteredData = folderData.filter(item => item.kind === 'MdxPage' && item.route.includes(`${route}/`)) return ( @@ -31,7 +30,7 @@ export function IndexCards({route, folderData}: IndexCardsProps) { if (item.kind !== 'MdxPage') return null return ( - + {item.frontMatter && {item.frontMatter.title}} {item.frontMatter && item.frontMatter.description && ( {item.frontMatter.description} diff --git a/packages/theme/components/layout/root-layout/Theme.tsx b/packages/theme/components/layout/root-layout/Theme.tsx index f312eeb..d4639e4 100644 --- a/packages/theme/components/layout/root-layout/Theme.tsx +++ b/packages/theme/components/layout/root-layout/Theme.tsx @@ -1,4 +1,5 @@ import React, {useMemo} from 'react' +import NextLink from 'next/link' import Head from 'next/head' import type {Folder, MdxFile, NextraThemeLayoutProps} from 'nextra' import {useFSRoute} from 'nextra/hooks' @@ -36,7 +37,7 @@ const {publicRuntimeConfig} = getConfig() export function Theme({children, pageOpts}: NextraThemeLayoutProps) { const {title, frontMatter, headings, filePath, pageMap, route} = pageOpts - const {locale = 'en-US', defaultLocale, basePath} = useRouter() + const {locale = 'en-US', defaultLocale} = useRouter() const fsPath = useFSRoute() const {colorMode} = useColorMode() const {activePath, topLevelNavbarItems, docsDirectories, flatDocsDirectories} = useMemo( @@ -96,7 +97,8 @@ export function Theme({children, pageOpts}: NextraThemeLayoutProps) { {siteTitle && ( { return ( + {item.frontMatter?.title ?? item.name} ) @@ -115,7 +109,7 @@ export function Sidebar({pageMap}: SidebarProps) { const shouldShowTabs = indexPage.frontMatter?.['show-tabs'] ?? false if (shouldShowTabs) { return ( - + {(indexPage as MdxFile).frontMatter?.title || item.name} ) @@ -137,7 +131,7 @@ export function Sidebar({pageMap}: SidebarProps) { {(child as MdxFile).frontMatter?.title || item.name} @@ -152,8 +146,8 @@ export function Sidebar({pageMap}: SidebarProps) { return (