diff --git a/.changeset/two-hats-judge.md b/.changeset/two-hats-judge.md new file mode 100644 index 0000000000..27768aba8b --- /dev/null +++ b/.changeset/two-hats-judge.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-techdocs': patch +--- + +Display [metadata.title](https://backstage.io/docs/features/software-catalog/descriptor-format#title-optional) for components on the TechDocs homepage, if defined; otherwise fall back to `metadata.name` as displayed before. diff --git a/plugins/techdocs-backend/examples/documented-component/catalog-info.yaml b/plugins/techdocs-backend/examples/documented-component/catalog-info.yaml index 125c18200d..e6d14025e1 100644 --- a/plugins/techdocs-backend/examples/documented-component/catalog-info.yaml +++ b/plugins/techdocs-backend/examples/documented-component/catalog-info.yaml @@ -2,6 +2,7 @@ apiVersion: backstage.io/v1alpha1 kind: Component metadata: name: documented-component + title: Documented Component description: A Service with TechDocs documentation annotations: backstage.io/techdocs-ref: dir:. diff --git a/plugins/techdocs/src/home/components/columns.tsx b/plugins/techdocs/src/home/components/columns.tsx index 5cdcc66c37..d29f44da75 100644 --- a/plugins/techdocs/src/home/components/columns.tsx +++ b/plugins/techdocs/src/home/components/columns.tsx @@ -17,8 +17,13 @@ import React from 'react'; import { Link, SubvalueCell, TableColumn } from '@backstage/core-components'; import { EntityRefLinks } from '@backstage/plugin-catalog-react'; +import { Entity } from '@backstage/catalog-model'; import { DocsTableRow } from './types'; +function customTitle(entity: Entity): string { + return entity.metadata.title || entity.metadata.name; +} + export function createNameColumn(): TableColumn { return { title: 'Document', @@ -26,9 +31,7 @@ export function createNameColumn(): TableColumn { highlight: true, render: (row: DocsTableRow) => ( {row.entity.metadata.name} - } + value={{customTitle(row.entity)}} subvalue={row.entity.metadata.description} /> ),