feat(v2): exhaustive docs frontmatter schema#4796
Merged
slorber merged 1 commit intofacebook:masterfrom May 18, 2021
Merged
Conversation
|
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-4796--docusaurus-2.netlify.app/ |
9cf4c73 to
f632a6f
Compare
slorber
approved these changes
May 18, 2021
Collaborator
slorber
left a comment
There was a problem hiding this comment.
Thanks, that looks great 👍
| sidebar_label: Joi.string(), | ||
| sidebar_position: Joi.number(), | ||
| custom_edit_url: Joi.string().allow('', null), | ||
| sidebar_position: Joi.number().min(0), |
Collaborator
There was a problem hiding this comment.
I don't think this is technically required and negative values would also work, but it would probably not harm to forbid this
slorber
pushed a commit
that referenced
this pull request
Jun 28, 2021
In some cases, negative sidebar positions can be useful for reversing the sorting order with minimal maintenance overhead. For example, a docs folder with changelogs for historical versions should be sorted in reverse chronological order. This is easy to do for semantic version numbers by converting them into a negative numerical representation, e.g. 11.5.1 -> -110501. The alternative is to make the first version start with a large position number (e.g. 9999) and decrement it for each version. However, this requires referring to older versions to get the current sequence number, thus increasing maintenance overhead. It also makes the number less intuitive and more prone to error. Negative sidebar positions work great for this purpose, so make the front matter validator allow them again as #4796 broke this use case.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The continuation of #4591.
Have you read the Contributing Guidelines on pull requests?
Yes.
Test Plan
Unit test.
Related PRs
#4759.