Skip to content

fix(theme-common): docs breadcrumbs not working with baseUrl#6816

Merged
slorber merged 2 commits into
mainfrom
slorber/fix-breadcrumbs-with-baseurl
Mar 2, 2022
Merged

fix(theme-common): docs breadcrumbs not working with baseUrl#6816
slorber merged 2 commits into
mainfrom
slorber/fix-breadcrumbs-with-baseurl

Conversation

@slorber
Copy link
Copy Markdown
Collaborator

@slorber slorber commented Mar 2, 2022

Motivation

fix bug reported here: #6749 (comment)

Have you read the Contributing Guidelines on pull requests?

yes

Test Plan

unit tests

@slorber slorber added the pr: bug fix This PR fixes a bug in a past release. label Mar 2, 2022
@slorber slorber requested review from Josh-Cena and lex111 as code owners March 2, 2022 16:19
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Mar 2, 2022
@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 2, 2022

✔️ [V2]

🔨 Explore the source changes: ea1bc09

🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/621f992eeb75030007a53149

😎 Browse the preview: https://deploy-preview-6816--docusaurus-2.netlify.app

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 2, 2022

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟠 Performance 65
🟢 Accessibility 100
🟢 Best practices 92
🟢 SEO 100
🟢 PWA 90

Lighthouse ran on https://deploy-preview-6816--docusaurus-2.netlify.app/

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 2, 2022

Size Change: +74 B (0%)

Total Size: 789 kB

Filename Size Change
website/build/assets/js/main.********.js 597 kB +74 B (0%)
ℹ️ View Unchanged
Filename Size
website/.docusaurus/globalData.json 49.7 kB
website/build/assets/css/styles.********.css 105 kB
website/build/index.html 38.3 kB

compressed-size-action

@slorber slorber merged commit fb20131 into main Mar 2, 2022
@slorber slorber deleted the slorber/fix-breadcrumbs-with-baseurl branch March 2, 2022 17:09
@pranabdas
Copy link
Copy Markdown
Contributor

@slorber So the home icon in breadcrumbs is not supposed to show up for docs-only sites? The breadcrumb looks bit empty in this case if there is only one item. Is it possible to have home icon in this case linking to logo.href? Thank you.

@slorber
Copy link
Copy Markdown
Collaborator Author

slorber commented Mar 3, 2022

yes it's showing for docs-only sites if there's a doc with slug: /

For breadcrumbs improvements, I suggest giving your opinion here: #6786

I don't know if logo.href is such a good fallback.

Maybe it would be better to always ensure/force that a docs site has a home 🤷‍♂️

At least you could provide a redirect from / to /something for example

@pranabdas
Copy link
Copy Markdown
Contributor

Maybe there is a bug then, the home icon is not showing up in the breadcrumb in docs-only mode. Steps to reproduce:

  1. Create a new site: npx create-docusaurus@latest website classic
  2. cd website
  3. Update to latest canary: npm i --save-exact @docusaurus/core@canary @docusaurus/preset-classic@canary
  4. Remove index page rm src/pages/index.js
  5. Add routeBasePath for docs in docusaurus.config.js:
module.exports = {
  // ...
  presets: [
    '@docusaurus/preset-classic',
    {
      docs: {
        routeBasePath: '/', 
      },
    },
  ],
};
  1. Add slug to docs/intro.md:
slug: /
  1. npm start and this is what I see:

Screenshot 2022-03-03 at 5 47 37 PM

@Josh-Cena
Copy link
Copy Markdown
Collaborator

Josh-Cena commented Mar 3, 2022

Indeed, it's because the version route that the doc plugin doesn't specify exact: true or false so it isn't recognized as a home parent route... @slorber Is it intended to only match exact === false instead of !exact?

@slorber
Copy link
Copy Markdown
Collaborator Author

slorber commented Mar 3, 2022

hmmm weird, I tested this locally and it worked 😅

Will fix this asap

@slorber
Copy link
Copy Markdown
Collaborator Author

slorber commented Mar 3, 2022

#6824

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Signed Facebook CLA pr: bug fix This PR fixes a bug in a past release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants