Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix breadcrumbs #220

Open
2 tasks
futuresoup opened this issue Aug 5, 2023 · 0 comments
Open
2 tasks

Fix breadcrumbs #220

futuresoup opened this issue Aug 5, 2023 · 0 comments

Comments

@futuresoup
Copy link
Member

futuresoup commented Aug 5, 2023

  • Get breadcrumbs to show up for pages not in the sidebar

  • See if we can can also make them navigate to the parent category's landing page

via ChatGPT

Apologies for the confusion. It seems I provided the wrong instructions for configuring the breadcrumbs.

To enable custom breadcrumbs, you need to use a plugin called @docusaurus/plugin-client-redirects. This plugin allows you to specify custom redirects and breadcrumb configurations for your Docusaurus documentation.

Here's how you can set it up:

  1. Install the required plugin:
npm install @docusaurus/plugin-client-redirects --save
  1. Configure the plugin in your docusaurus.config.js:
module.exports = {
  // other config options...
  plugins: ['@docusaurus/plugin-client-redirects'],
  presets: [
    [
      '@docusaurus/preset-classic',
      {
        // other preset options...
      },
    ],
  ],
  // other config options...
};
  1. Set up custom breadcrumb paths for your pages:

For each page that you want to define custom breadcrumbs, you need to add the slug field in the front matter of your Markdown files.

For example, in breadcrumb-test.md:

---
slug: /breadcrumb-test/breadcrumb-test
title: Breadcrumb Test
custom_edit_url: null
---

This is a breadcrumb test page content.
  1. Specify breadcrumb paths in the page metadata:

Next, you need to create a clientRedirects.js file in the /src directory (if it doesn't exist already). In this file, you can specify custom breadcrumb paths for your pages.

Here's how you can set up the clientRedirects.js file:

module.exports = {
  breadcrumb_test: {
    breadcrumb: [
      { to: '/', label: 'Home' },
      { to: '/breadcrumb-test/breadcrumb-test', label: 'Breadcrumb Test' },
    ],
  },
};

The above configuration sets up custom breadcrumbs for the breadcrumb-test.md page. It specifies a breadcrumb path that consists of two parts: "Home" linking to the homepage (/) and "Breadcrumb Test" linking to the breadcrumb-test.md page.

With this setup, the breadcrumbs should work as expected for the breadcrumb-test.md page.

Remember to adjust the slug field and clientRedirects.js configuration for each page where you want to define custom breadcrumbs.

Please note that using custom breadcrumbs requires the use of the @docusaurus/plugin-client-redirects plugin and specifying the breadcrumb paths in the clientRedirects.js file.

@futuresoup futuresoup changed the title Fix breadcrumb paths Fix breadcrumbs Aug 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant