diff --git a/plugins/scaffolder/src/alpha/components/TemplateListPage/TemplateListPage.tsx b/plugins/scaffolder/src/alpha/components/TemplateListPage/TemplateListPage.tsx index 0a7a3df888..37a50ed904 100644 --- a/plugins/scaffolder/src/alpha/components/TemplateListPage/TemplateListPage.tsx +++ b/plugins/scaffolder/src/alpha/components/TemplateListPage/TemplateListPage.tsx @@ -149,18 +149,25 @@ export const TemplateListPage = (props: TemplateListPageProps) => { const additionalLinksForEntity = useCallback( (template: TemplateEntityV1beta3) => { - const hasTechDocs = - !!template.metadata.annotations?.[TECHDOCS_ANNOTATION] || - !!template.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION]; + if ( + !( + template.metadata.annotations?.[TECHDOCS_ANNOTATION] || + template.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION] + ) || + !viewTechDocsLink + ) { + return []; + } - return hasTechDocs && viewTechDocsLink + const url = buildTechDocsURL(template, viewTechDocsLink); + return url ? [ { icon: app.getSystemIcon('docs') ?? DocsIcon, text: t( 'templateListPage.additionalLinksForEntity.viewTechDocsTitle', ), - url: buildTechDocsURL(template, viewTechDocsLink), + url, }, ] : [];