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

feat(v2): new docs edit options: editCurrentVersion + editLocalizedDocs #3949

Merged
merged 4 commits into from
Dec 28, 2020

Conversation

slorber
Copy link
Collaborator

@slorber slorber commented Dec 22, 2020

Motivation

        /**
         * When docs are versioned, the edit url will link to the doc
         * in current version, instead of the versioned doc.
         * Useful if you don't want users to submit doc pull-requests to older versions.
         */
        editCurrentVersion: false,
        /**
         * When docs are localized, the edit url will target the localized doc,
         * instead of the original unlocalized doc.
         * Useful if you commit localized docs to git, instead of using a translation service.
         */
        editLocalizedDocs: false,

editCurrentVersion: true

With Docusaurus v1, even with versioning enabled, the edit button always targeted the "upstream" docs (ie the ./docs folder), not the versioned folders.

With Docusaurus v2, this behavior has changed, and this can be annoying because users end up submitting docs pull requests to the "last version" (the version of your last release), so you end up merging doc updates for a specific version, but lose those edits in the upstream version.

editCurrentVersion: true will restore the v1 behavior

editLocalizedDocs: true

Also, for i18n support, you may want the edit button to target either the original untranslated doc, or the localized doc. It does not make sense to always target the localized doc, and really depends on the usecase:

  • committing translated docs to git: it may be useful to edit localized files through the github edit interface
  • using a SaaS service that has a specific edit URL pattern: the localized files are not on git, so we'll likely need to link to a specific translation SaaS url. We'll likely need to improve existing system and make it more flexible and usable in any kind of saas (ie using a function in config?)

@slorber slorber added the pr: new feature This PR adds a new API or behavior. label Dec 22, 2020
@slorber slorber requested a review from lex111 as a code owner December 22, 2020 18:06
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Dec 22, 2020
@slorber
Copy link
Collaborator Author

slorber commented Dec 22, 2020

@Simek I think you wanted this for RN website

@github-actions
Copy link

github-actions bot commented Dec 22, 2020

Size Change: +9 B (0%)

Total Size: 155 kB

ℹ️ View Unchanged
Filename Size Change
website/build/blog/2017/12/14/introducing-docusaurus/index.html 20.7 kB -2 B (0%)
website/build/docs/introduction/index.html 180 B 0 B
website/build/index.html 5.81 kB 0 B
website/build/main.********.js 111 kB +11 B (0%)
website/build/styles.********.css 17.6 kB 0 B

compressed-size-action

@netlify
Copy link

netlify bot commented Dec 22, 2020

✔️ Deploy preview for docusaurus-2 ready!

🔨 Explore the source changes: aac4692

🔍 Inspect the deploy logs: https://app.netlify.com/sites/docusaurus-2/deploys/5fe238cce23b300007e2feff

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

@github-actions
Copy link

github-actions bot commented Dec 22, 2020

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟠 Performance 87
🟢 Accessibility 99
🟢 Best practices 100
🟢 SEO 100
🟢 PWA 95

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

@slorber slorber merged commit b5c46bd into master Dec 28, 2020
@lex111 lex111 added this to the v2.0.0-alpha.71 milestone Mar 1, 2021
This was referenced Mar 10, 2021
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: new feature This PR adds a new API or behavior.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants