Skip to content

Commit 91be50e

Browse files
committed
sidebar.logo is now normalized as an object with light and dark properties
So `sidebar.logo` is never undefined - it may have light or dark undefined, but the object itself exists.
1 parent a672a1a commit 91be50e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/resources/projects/website/templates/sidebar.ejs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@
1919
// may be displayed in different locations, so this will determine where to display the tools
2020
// "logo", "title", "search", "fallthrough"
2121
22+
let hasLogo = sidebar.logo.light || sidebar.logo.dark;
23+
2224
let toolsLocation;
2325
// Under the title if that will be displayed
2426
if (sidebar.title && !navbar) {
2527
toolsLocation = "title";
26-
} else if (sidebar.logo) {
28+
} else if (sidebar.logo.light || sidebar.logo.dark) {
2729
toolsLocation = "logo";
2830
} else if (sidebar.search && sidebar.search !== "overlay") {
2931
toolsLocation = "search";
@@ -32,9 +34,9 @@
3234
}
3335
%>
3436
35-
<% if (sidebar.logo || (sidebar.title && !navbar)) { %>
36-
<div class="pt-lg-2 mt-2 <%= alignCss %> sidebar-header<%= sidebar.logo && sidebar.title ? ' sidebar-header-stacked' : '' %>">
37-
<% if (sidebar.logo) { %>
37+
<% if (hasLogo || (sidebar.title && !navbar)) { %>
38+
<div class="pt-lg-2 mt-2 <%= alignCss %> sidebar-header<%= hasLogo && sidebar.title ? ' sidebar-header-stacked' : '' %>">
39+
<% if (hasLogo) { %>
3840
<a href="<%- sidebar['logo-href'] || '/index.html' %>" class="sidebar-logo-link">
3941
<% if (sidebar.logo.light) { %>
4042
<img src="<%- sidebar.logo.light.path %>" alt="<%- sidebar.logo.light.alt || '' %>" class="sidebar-logo light-content py-0 d-lg-inline d-none"/>

0 commit comments

Comments
 (0)