From b742947d3ed989278fbdb08815fd9a1a26e7d51f Mon Sep 17 00:00:00 2001 From: oghenenyerhovwo-e Date: Tue, 17 Jun 2025 16:23:05 +0100 Subject: [PATCH 1/2] Fix: Correct blog post navigation order --- src/components/Layout/Page.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/Layout/Page.tsx b/src/components/Layout/Page.tsx index c3224e5174a..e65b0ebc998 100644 --- a/src/components/Layout/Page.tsx +++ b/src/components/Layout/Page.tsx @@ -52,6 +52,12 @@ export function Page({ cleanedPath, routeTree ); + const getNavigationRoutes = () => { + if (section !== 'blog') return { nextRoute, prevRoute }; + return { nextRoute: prevRoute, prevRoute: nextRoute }; // Swap for blog + }; + + const { nextRoute: finalNextRoute, prevRoute: finalPrevRoute } = getNavigationRoutes(); const title = meta.title || route?.title || ''; const version = meta.version; const description = meta.description || route?.description || ''; @@ -89,8 +95,8 @@ export function Page({ {!isBlogIndex && ( )} From 709fb0339dca6706a8e5e32718eef5e62dc03912 Mon Sep 17 00:00:00 2001 From: Rick Hanlon Date: Sat, 28 Jun 2025 15:56:50 -0400 Subject: [PATCH 2/2] Refactor --- src/components/DocsFooter.tsx | 28 +++++++++++++++++----------- src/components/Layout/Page.tsx | 17 +++++------------ 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/src/components/DocsFooter.tsx b/src/components/DocsFooter.tsx index 5f2330e7eae..22a07818904 100644 --- a/src/components/DocsFooter.tsx +++ b/src/components/DocsFooter.tsx @@ -19,31 +19,37 @@ function areEqual(prevProps: DocsPageFooterProps, props: DocsPageFooterProps) { export const DocsPageFooter = memo( function DocsPageFooter({nextRoute, prevRoute, route}) { - if (!route || route?.heading) { + if (!route || route?.heading || !route.path || route.path === '/blog') { return null; } + let next; + let prev; + if (route.path.indexOf('/blog') === 0) { + next = prevRoute; + prev = nextRoute; + } else { + next = nextRoute; + prev = prevRoute; + } + return ( <> - {prevRoute?.path || nextRoute?.path ? ( + {prev?.path || next?.path ? ( <>
- {prevRoute?.path ? ( + {prev?.path ? ( ) : (
)} - {nextRoute?.path ? ( - + {next?.path && next.path !== '/blog' ? ( + ) : (
)} diff --git a/src/components/Layout/Page.tsx b/src/components/Layout/Page.tsx index e65b0ebc998..060b5523cd9 100644 --- a/src/components/Layout/Page.tsx +++ b/src/components/Layout/Page.tsx @@ -52,12 +52,7 @@ export function Page({ cleanedPath, routeTree ); - const getNavigationRoutes = () => { - if (section !== 'blog') return { nextRoute, prevRoute }; - return { nextRoute: prevRoute, prevRoute: nextRoute }; // Swap for blog - }; - const { nextRoute: finalNextRoute, prevRoute: finalPrevRoute } = getNavigationRoutes(); const title = meta.title || route?.title || ''; const version = meta.version; const description = meta.description || route?.description || ''; @@ -92,13 +87,11 @@ export function Page({ {children}
- {!isBlogIndex && ( - - )} +
);