File tree Expand file tree Collapse file tree
apify-docs-theme/src/theme/Layout Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import Head from '@docusaurus/Head' ;
2+ import { useAllDocsData } from '@docusaurus/plugin-content-docs/client' ;
23import { useLocation } from '@docusaurus/router' ;
34// cannot use any of the theme aliases here as it causes a circular dependency :( ideas welcome
45import Layout from '@docusaurus/theme-classic/lib/theme/Layout/index' ;
@@ -9,8 +10,14 @@ import React from 'react';
910export default function LayoutWrapper ( props ) {
1011 const { options : { subNavbar } } = usePluginData ( '@apify/docs-theme' ) ;
1112 const baseUrl = useBaseUrl ( '/' ) ;
12- const currentPath = useLocation ( ) . pathname . replace ( new RegExp ( `^${ baseUrl } ` ) , '' ) . trim ( ) ;
13- const shouldRenderAlternateLink = currentPath && currentPath !== '404' ;
13+ const { pathname } = useLocation ( ) ;
14+ const currentPath = pathname . replace ( new RegExp ( `^${ baseUrl } ` ) , '' ) . trim ( ) ;
15+ const allDocsData = useAllDocsData ( ) ;
16+ const isVersionedPage = Object . values ( allDocsData ) . some (
17+ ( pluginData ) => pluginData . versions . some ( ( version ) => ! version . isLast && pathname . startsWith ( version . path ) ) ,
18+ ) ;
19+
20+ const shouldRenderAlternateLink = currentPath && currentPath !== '404' && ! isVersionedPage ;
1421
1522 const alternateMarkdownLink = useBaseUrl ( `/${ currentPath } .md` , { absolute : true } ) ;
1623
You can’t perform that action at this time.
0 commit comments