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

CustomProps for doc items #8256

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

OdedItkinOW
Copy link

@OdedItkinOW OdedItkinOW commented Oct 27, 2022

According to the docs (https://docusaurus.io/docs/sidebar/autogenerated#doc-item-metadata), doc items should support the customProps argument, using the sidebar_custom_props frontmatter item. Added support for it to the default generator

Pre-flight checklist

  • I have read the Contributing Guidelines on pull requests.
  • If this is a code change: I have written unit tests and/or added dogfooding pages to fully verify the new behavior.
  • If this is a new API or substantial change: the PR has an accompanying issue (closes #0000) and the maintainers have approved on my working plan.

Motivation

For a certain website feature, I needed the ability to add customProps to all sidebar items on the website, so I can tag pages more consistently in the navigation. I noticed that the feature itself was documented as supported, but did not work, and then identified the exact piece of code that was missing.

Test Plan

The testing plan was simple - Take an existing passing test for a simple sidebar, copy it, add test custom props to different items of it, and then add those same props to a copy of the resulting snapshot, and check that the two align.

Test links

https://github.com/OdedItkinOW/docusaurus/blob/patch-1/packages/docusaurus-plugin-content-docs/src/sidebars/__tests__/generator.test.ts

Deploy preview: https://deploy-preview-_____--docusaurus-2.netlify.app/

Related issues/PRs

OdedItkinOW and others added 4 commits October 27, 2022 11:23
According to the docs (https://docusaurus.io/docs/sidebar/autogenerated#doc-item-metadata), doc items should support the `customProps` argument, using the `sidebar_custom_props` frontmatter item. Added support for it to the default generator
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Oct 27, 2022
@netlify
Copy link

netlify bot commented Oct 27, 2022

[V2]

Built without sensitive environment variables

Name Link
🔨 Latest commit 165b682
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/635a6bb4c6830f0008873d03
😎 Deploy Preview https://deploy-preview-8256--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants