diff --git a/website/components/badge/index.tsx b/website/components/badge/index.tsx index 358085806..313a259ef 100644 --- a/website/components/badge/index.tsx +++ b/website/components/badge/index.tsx @@ -9,18 +9,21 @@ interface BadgeProps { label: string iconSvg?: string theme?: BadgeTheme + href?: string } function Badge({ theme = 'gray', label, iconSvg, + href, }: BadgeProps): React.ReactElement { + const Elem = href ? 'a' : 'div' return ( -
+ {iconSvg ? : null} {label} -
+ ) } diff --git a/website/components/remote-plugin-docs/server.js b/website/components/remote-plugin-docs/server.js index 04230c9ba..7845e6ce6 100644 --- a/website/components/remote-plugin-docs/server.js +++ b/website/components/remote-plugin-docs/server.js @@ -69,9 +69,13 @@ async function generateStaticProps({ if (pluginData?.isHcpPackerReady) { badgesMdx.push(``) } - // Add badge showing the latest release version number + // Add badge showing the latest release version number, + // and link this badge to the latest release if (latestReleaseTag) { - badgesMdx.push(``) + const href = `https://github.com/${pluginData.repo}/releases/tag/${latestReleaseTag}` + badgesMdx.push( + `` + ) } // If we have badges to add, inject them into the MDX if (badgesMdx.length > 0) {