diff --git a/packages/docusaurus-theme-classic/src/theme/DocCard/index.tsx b/packages/docusaurus-theme-classic/src/theme/DocCard/index.tsx index ad8dba2379..5c4687a2e7 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocCard/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/DocCard/index.tsx @@ -115,25 +115,8 @@ function CardCategory({item}: {item: PropSidebarItemCategory}): ReactNode { function CardLink({item}: {item: PropSidebarItemLink}): ReactNode { const defaultIcon = isInternalUrl(item.href) ? '📄' : '🔗'; - let customIcon; - - // If the icon is a string, it can be an simple string icon or a PNG/JPEG image, render accordingly - if (typeof item.icon === 'string') { - if ( - /^data:image\/(?:png|jpe?g)/i.test(item.icon) || - /\.(?:png|jpe?g)/i.test(item.icon) - ) { - customIcon = ( - {`${item.label}-icon`} - ); - } else { - customIcon = item.icon; - } - } + const customIcon = + typeof item.icon === 'string' && item.icon.length <= 2 ? item.icon : null; const icon = customIcon || defaultIcon; const doc = useDocById(item.docId ?? undefined);