@conduction/docusaurus-preset 2.8.0 → 2.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conduction/docusaurus-preset",
3
- "version": "2.8.0",
3
+ "version": "2.8.1",
4
4
  "scripts": {
5
5
  "prepack": "node scripts/prepack-bundle-css.js"
6
6
  },
@@ -45,6 +45,7 @@
45
45
  import React from 'react';
46
46
  import Link from '@docusaurus/Link';
47
47
  import {useLocation} from '@docusaurus/router';
48
+ import useBaseUrl from '@docusaurus/useBaseUrl';
48
49
  import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
49
50
  import {useThemeConfig} from '@docusaurus/theme-common';
50
51
  import LocaleDropdownNavbarItem from '@theme/NavbarItem/LocaleDropdownNavbarItem';
@@ -212,8 +213,14 @@ export default function Navbar() {
212
213
  app's hex-glyph next to the wordmark. The icon is sourced from
213
214
  navbar.logo (createConfig defaults it to img/logo.svg, which every
214
215
  Conduction docs site ships under static/img/). Sites can opt the
215
- icon out by passing `logo: null` in their navbar config. */
216
- const logoSrc = navbar.logo?.src;
216
+ icon out by passing `logo: null` in their navbar config.
217
+
218
+ `useBaseUrl` resolves the src against the site's configured
219
+ baseUrl — without it, a relative `img/app-logo.svg` resolves
220
+ against the current page's path, so the icon 404s on every
221
+ sub-route (e.g. /docs/intro/img/app-logo.svg). */
222
+ const logoSrcRaw = navbar.logo?.src;
223
+ const logoSrc = useBaseUrl(logoSrcRaw || '');
217
224
  const logoAlt = navbar.logo?.alt || `${navbar.title} avatar`;
218
225
 
219
226
  /* Split into "left links" (regular nav) and "right CTAs" (locale,
@@ -241,7 +248,7 @@ export default function Navbar() {
241
248
  <nav className={`navbar ${styles.nav}`} role="navigation" aria-label="Main">
242
249
  <div className={styles.left}>
243
250
  <Link to={homeHref} className={styles.wordmark}>
244
- {logoSrc && (
251
+ {logoSrcRaw && (
245
252
  <img
246
253
  src={logoSrc}
247
254
  alt={logoAlt}