diff --git a/apify-docs-theme/src/theme/ApiLink/index.jsx b/apify-docs-theme/src/theme/ApiLink/index.jsx new file mode 100644 index 0000000000..fe22fd5a59 --- /dev/null +++ b/apify-docs-theme/src/theme/ApiLink/index.jsx @@ -0,0 +1,17 @@ +import Link from '@docusaurus/Link'; +import { useDocsVersion } from '@docusaurus/plugin-content-docs/client'; +import { usePluginData } from '@docusaurus/useGlobalData'; +import React from 'react'; + +export default function ApiLink({ to, children }) { + const { version, isLast } = useDocsVersion(); + const typedocData = usePluginData('docusaurus-plugin-typedoc-api'); + const routeBasePath = (typedocData?.routeBasePath ?? 'api').replace(/^\/+|\/+$/g, ''); + + if (isLast) { + return {children}; + } + + const versionSlug = version === 'current' ? 'next' : version; + return {children}; +}