diff --git a/docusaurus.config.js b/docusaurus.config.js index 79095c0d..c96204e0 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -69,22 +69,26 @@ const config = { label: '', path: 'latest', // When a new version is released and this is no longer the current version, change this to the version number and then delete this comment. banner: 'none', + className: 'X.X.X', // This should be the most recent version (major.minor.patch) so that the Javadoc links point to the latest version based on the major.minor version that the visitor is viewing on the docs site. }, */ current: { // When a new version is released and this is no longer the current version, change this to the version number and then delete this comment. label: '3.10', path: 'latest', // When a new version is released and this is no longer the current version, change this to the version number and then delete this comment. banner: 'none', + className: '3.10.0', }, "3.9": { // When a new version is released and this is no longer the current version, change this to the version number and then delete this comment. label: '3.9', path: '3.9', // When a new version is released and this is no longer the current version, change this to the version number and then delete this comment. banner: 'none', + className: '3.9.4', }, "3.8": { label: '3.8', path: '3.8', banner: 'none', + className: '3.8.4', }, "3.7": { label: '3.7 (unsupported)', diff --git a/src/theme/JavadocLink.js b/src/theme/JavadocLink.js new file mode 100644 index 00000000..eaf7491b --- /dev/null +++ b/src/theme/JavadocLink.js @@ -0,0 +1,30 @@ +import React from 'react'; +import { useActiveVersion } from '@docusaurus/plugin-content-docs/client'; +import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; + +export default function JavadocLink({ packageName, path, className }) { + const { siteConfig } = useDocusaurusContext(); + const activeVersion = useActiveVersion(); + + // Retrieve className from siteConfig based on the active version. + const docsClassName = + siteConfig.presets?.[0]?.[1]?.docs?.versions?.[activeVersion.name]?.className; + + // Log for debugging + console.log('Active Version:', activeVersion?.name); + console.log('Docs ClassName:', docsClassName); + + // The link in the code below is generated based on the following JavadocLink component that must be added in place of a static Javadoc link in the doc: + // + // In addition, be sure to add the following below the title to import the component: + // import JavadocLink from "/src/theme/JavadocLink.js"; + return ( + + {className} + + ); +}