Skip to content

Support setting sidebar logo in Hybrid navigation (when multiple sidebar) #13565

@cderv

Description

@cderv

While looking at fixing an issue with sidebar, it happens logo can be define only in one mode of navigation. Maybe it would be worth supporting for hybrid navigation.

  • Either one logo for all
  • Or one logo per sidebar

As discussed, we are only resolving the logos in sidebars[0], but we should probably resolve logos in all sidebars:

let sideLogo = sidebars[0].logo;
if (sideLogo) {
if (sidebars[0][kLogoAlt]) {
const alt = sidebars[0][kLogoAlt];
if (typeof sideLogo === "string") {
sideLogo = { path: sideLogo, alt };
}
// possible but absurd
// else if ("path" in sideLogo) {
// sideLogo = { ...sideLogo, alt };
// } else {
// sideLogo = {
// light: !sideLogo.light ? undefined : typeof sideLogo.light === "string"
// ? {
// path: sideLogo.light,
// alt,
// }
// : { ...sideLogo.light, alt },
// dark: !sideLogo.dark ? undefined : typeof sideLogo.dark === "string"
// ? {
// path: sideLogo.dark,
// alt,
// }
// : { ...sideLogo.dark, alt },
// };
// }
}
}
let logo = resolveLogo(projectBrand, sideLogo, [
"medium",
"small",
"large",
]);
logo = logoAddLeadingSlashes(logo, projectBrand, undefined);
sidebars[0].logo = logo;

Originally posted by @gordonwoodhull in #13507 (comment)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions