Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion packages/docusaurus-theme-classic/src/theme/Logo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,21 @@ export default function Logo(props: Props): JSX.Element {
light: useBaseUrl(logo.src),
dark: useBaseUrl(logo.srcDark || logo.src),
};

// If visible title is shown, fallback alt text should be
// an empty string to mark the logo as decorative.
const fallbackAlt = navbarTitle ? '' : title;

// Use logo alt text if provided (including empty string),
// and provide a sensible fallback otherwise.
const alt = logo.alt ?? fallbackAlt;

const themedImage = (
<ThemedImage
sources={sources}
height={logo.height}
width={logo.width}
alt={logo.alt || navbarTitle || title}
alt={alt}
/>
);

Expand Down
2 changes: 1 addition & 1 deletion website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ const config = {
hideOnScroll: true,
title: 'Docusaurus',
logo: {
alt: 'Docusaurus Logo',
alt: '',
src: 'img/docusaurus.svg',
srcDark: 'img/docusaurus_keytar.svg',
width: 32,
Expand Down