{entity?.metadata?.description}
{linkContent || 'Read Docs'}
diff --git a/plugins/techdocs/src/home/components/TechDocsCustomHome.test.tsx b/plugins/techdocs/src/home/components/TechDocsCustomHome.test.tsx
index 409d68a593..66e01ce780 100644
--- a/plugins/techdocs/src/home/components/TechDocsCustomHome.test.tsx
+++ b/plugins/techdocs/src/home/components/TechDocsCustomHome.test.tsx
@@ -96,4 +96,133 @@ describe('TechDocsCustomHome', () => {
await screen.findByText('Second Tab Description'),
).toBeInTheDocument();
});
+ it('should render ContentHeader based on showHeader prop', async () => {
+ const tabsConfig = [
+ {
+ label: 'First Tab',
+ panels: [
+ {
+ title: 'First Tab',
+ description: 'First Tab Description',
+ panelType: 'DocsCardGrid' as PanelType,
+ panelProps: { showHeader: false },
+ filterPredicate: () => true,
+ },
+ ],
+ },
+ ];
+
+ await renderInTestApp(
+
+
+ ,
+ {
+ mountedRoutes: {
+ '/docs/:namespace/:kind/:name/*': rootDocsRouteRef,
+ },
+ },
+ );
+
+ expect(
+ screen.queryByText('Discover documentation in your ecosystem.'),
+ ).not.toBeInTheDocument();
+ });
+ it('should render SupportButton based on hideSupport prop', async () => {
+ const tabsConfig = [
+ {
+ label: 'First Tab',
+ panels: [
+ {
+ title: 'First Tab',
+ description: 'First Tab Description',
+ panelType: 'DocsCardGrid' as PanelType,
+ filterPredicate: () => true,
+ panelProps: { hideSupport: true },
+ },
+ ],
+ },
+ ];
+
+ await renderInTestApp(
+
+
+ ,
+ {
+ mountedRoutes: {
+ '/docs/:namespace/:kind/:name/*': rootDocsRouteRef,
+ },
+ },
+ );
+
+ expect(
+ screen.queryByText('Discover documentation in your ecosystem.'),
+ ).not.toBeInTheDocument();
+ });
+ it('should hide subtitle when hideSubtitle is true', async () => {
+ const tabsConfig = [
+ {
+ label: 'First Tab',
+ panels: [
+ {
+ title: 'First Tab',
+ description: 'First Tab Description',
+ panelType: 'DocsCardGrid' as PanelType,
+ filterPredicate: () => true,
+ },
+ ],
+ },
+ ];
+
+ await renderInTestApp(
+
+
+ ,
+ {
+ mountedRoutes: {
+ '/docs/:namespace/:kind/:name/*': rootDocsRouteRef,
+ },
+ },
+ );
+
+ expect(screen.getByText('Custom Title')).toBeInTheDocument();
+ expect(screen.queryByText('Custom Subtitle')).not.toBeInTheDocument();
+ });
+ it('should render title and subtitle', async () => {
+ const tabsConfig = [
+ {
+ label: 'First Tab',
+ panels: [
+ {
+ title: 'First Tab',
+ description: 'First Tab Description',
+ panelType: 'DocsCardGrid' as PanelType,
+ filterPredicate: () => true,
+ },
+ ],
+ },
+ ];
+
+ await renderInTestApp(
+
+
+ ,
+ {
+ mountedRoutes: {
+ '/docs/:namespace/:kind/:name/*': rootDocsRouteRef,
+ },
+ },
+ );
+
+ expect(screen.getByText('Custom Title')).toBeInTheDocument();
+ expect(screen.getByText('Custom Subtitle')).toBeInTheDocument();
+ });
});
diff --git a/plugins/techdocs/src/home/components/TechDocsCustomHome.tsx b/plugins/techdocs/src/home/components/TechDocsCustomHome.tsx
index 5024eab5c3..781d4b337c 100644
--- a/plugins/techdocs/src/home/components/TechDocsCustomHome.tsx
+++ b/plugins/techdocs/src/home/components/TechDocsCustomHome.tsx
@@ -26,7 +26,7 @@ import {
} from '@backstage/plugin-catalog-react';
import { Entity } from '@backstage/catalog-model';
import { DocsTable } from './Tables';
-import { DocsCardGrid, InfoCardGird } from './Grids';
+import { DocsCardGrid, InfoCardGrid } from './Grids';
import { TechDocsPageWrapper } from './TechDocsPageWrapper';
import { TechDocsIndexPage } from './TechDocsIndexPage';
@@ -47,7 +47,7 @@ const panels = {
DocsTable: DocsTable,
DocsCardGrid: DocsCardGrid,
TechDocsIndexPage: TechDocsIndexPage,
- InfoCardGird: InfoCardGird,
+ InfoCardGrid: InfoCardGrid,
};
/**
@@ -59,7 +59,7 @@ export type PanelType =
| 'DocsCardGrid'
| 'DocsTable'
| 'TechDocsIndexPage'
- | 'InfoCardGird';
+ | 'InfoCardGrid';
/**
* Type representing a TechDocsCustomHome panel.
@@ -172,7 +172,8 @@ export const TechDocsCustomHome = (props: TechDocsCustomHomeProps) => {
error,
} = useAsync(async () => {
const response = await catalogApi.getEntities({
- filter: filter || {
+ filter: {
+ ...filter,
[`metadata.annotations.${TECHDOCS_ANNOTATION}`]: CATALOG_FILTER_EXISTS,
},
fields: [
@@ -184,7 +185,9 @@ export const TechDocsCustomHome = (props: TechDocsCustomHomeProps) => {
'spec.type',
],
});
- return response.items;
+ return response.items.filter((entity: Entity) => {
+ return !!entity.metadata.annotations?.[TECHDOCS_ANNOTATION];
+ });
});
const currentTabConfig = tabsConfig[selectedTab];