diff --git a/.changeset/pink-windows-suffer.md b/.changeset/pink-windows-suffer.md new file mode 100644 index 0000000000..f27af1f4a3 --- /dev/null +++ b/.changeset/pink-windows-suffer.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-techdocs': patch +--- + +Added a check for the TechDocs annotation on the entity diff --git a/plugins/techdocs/api-report.md b/plugins/techdocs/api-report.md index 082dfc1db4..087cdf803a 100644 --- a/plugins/techdocs/api-report.md +++ b/plugins/techdocs/api-report.md @@ -167,6 +167,11 @@ export const EntityTechdocsContent: (_props: { entity?: Entity | undefined; }) => JSX.Element; +// Warning: (ae-missing-release-tag) "isTechDocsAvailable" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const isTechDocsAvailable: (entity: Entity) => boolean; + // Warning: (ae-missing-release-tag) "PanelType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) diff --git a/plugins/techdocs/src/Router.tsx b/plugins/techdocs/src/Router.tsx index 45b0dc756c..102cda979a 100644 --- a/plugins/techdocs/src/Router.tsx +++ b/plugins/techdocs/src/Router.tsx @@ -25,6 +25,9 @@ import { MissingAnnotationEmptyState } from '@backstage/core-components'; const TECHDOCS_ANNOTATION = 'backstage.io/techdocs-ref'; +export const isTechDocsAvailable = (entity: Entity) => + Boolean(entity?.metadata?.annotations?.[TECHDOCS_ANNOTATION]); + export const Router = () => { return ( diff --git a/plugins/techdocs/src/index.ts b/plugins/techdocs/src/index.ts index ba24f1c39d..50e25c5582 100644 --- a/plugins/techdocs/src/index.ts +++ b/plugins/techdocs/src/index.ts @@ -44,4 +44,4 @@ export { TechDocsReaderPage, } from './plugin'; export * from './reader'; -export { EmbeddedDocsRouter, Router } from './Router'; +export { EmbeddedDocsRouter, Router, isTechDocsAvailable } from './Router';