diff --git a/plugins/techdocs/src/Router.tsx b/plugins/techdocs/src/Router.tsx index 45daa3f3d9..6dc0dd02ad 100644 --- a/plugins/techdocs/src/Router.tsx +++ b/plugins/techdocs/src/Router.tsx @@ -15,8 +15,9 @@ */ import React from 'react'; -import { Route, Routes } from 'react-router-dom'; import { Entity } from '@backstage/catalog-model'; +import { Route, Routes } from 'react-router-dom'; +import { WarningPanel } from '@backstage/core'; import { rootRouteRef, @@ -27,6 +28,8 @@ import { TechDocsHome } from './reader/components/TechDocsHome'; import { TechDocsPage } from './reader/components/TechDocsPage'; import { EntityPageDocs } from './EntityPageDocs'; +const TECHDOCS_ANNOTATION = 'backstage.io/techdocs-ref'; + export const Router = () => { return ( @@ -37,6 +40,20 @@ export const Router = () => { }; export const EmbeddedDocsRouter = ({ entity }: { entity: Entity }) => { + const projectId = entity.metadata.annotations?.[TECHDOCS_ANNOTATION]; + + if (!projectId) { + return ( + +
{TECHDOCS_ANNOTATION}
annotation is missing on the entity. +
+ + Getting Started + +
+ ); + } + return (