diff --git a/src/frame/components/DefaultLayout.tsx b/src/frame/components/DefaultLayout.tsx index b57e727d68..44700fc3ef 100644 --- a/src/frame/components/DefaultLayout.tsx +++ b/src/frame/components/DefaultLayout.tsx @@ -77,6 +77,15 @@ export const DefaultLayout = (props: Props) => { return getCategoryImageUrl('default') } + // Helper function to build API article URLs with proper query parameter handling + function buildApiArticleUrl(apiPath: string): string { + // Parse router.asPath to separate pathname and query parameters + const [pathname, queryString] = router.asPath.split('?') + const fullPathname = `/${router.locale}${pathname}` + const queryParams = queryString ? `&${queryString}` : '' + return `https://docs.github.com${apiPath}?pathname=${fullPathname}${queryParams}` + } + return ( @@ -147,14 +156,14 @@ export const DefaultLayout = (props: Props) => {