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

docs: add advanced guides #6296

Merged
merged 35 commits into from
Jan 25, 2022
Merged

docs: add advanced guides #6296

merged 35 commits into from
Jan 25, 2022

Conversation

Josh-Cena
Copy link
Collaborator

Motivation

Close #6236
Close #4301

Have you read the Contributing Guidelines on pull requests?

Yes

@Josh-Cena Josh-Cena added the pr: documentation This PR works on the website or other text documents in the repo. label Jan 8, 2022
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Jan 8, 2022
@netlify
Copy link

netlify bot commented Jan 8, 2022

✔️ [V2]

🔨 Explore the source changes: cf3e619

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

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

@github-actions
Copy link

github-actions bot commented Jan 8, 2022

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟠 Performance 76
🟢 Accessibility 100
🟢 Best practices 93
🟢 SEO 100
🟢 PWA 92

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

@github-actions
Copy link

github-actions bot commented Jan 8, 2022

Size Change: +4.39 kB (+1%)

Total Size: 715 kB

Filename Size Change
website/.docusaurus/globalData.json 45.1 kB +1.04 kB (+2%)
website/build/assets/css/styles.********.css 104 kB +682 B (+1%)
website/build/assets/js/main.********.js 536 kB +2.67 kB (+1%)
ℹ️ View Unchanged
Filename Size
website/build/index.html 29.8 kB

compressed-size-action

@Josh-Cena
Copy link
Collaborator Author

@Josh-Cena Josh-Cena marked this pull request as ready for review January 15, 2022 03:46
@Josh-Cena Josh-Cena merged commit 59022c5 into main Jan 25, 2022
@Josh-Cena Josh-Cena deleted the jc/advanced-guides branch January 25, 2022 03:29

Docusaurus' routing system follows single-page application conventions: one route, one component. In this section, we will begin by talking about routing within the three content plugins (docs, blog, and pages), and then go beyond to talk about the underlying routing system.

## Routing in content plugins
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this section is nice, it should probably not be in the advanced part?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rationale is to put all "meta-level" instructions in the advanced part. The "guides" part are more like a step-by-step instruction of "how to make X happen" rather than "how does X happen". I would probably re-organize the advanced guides again in the future to make it more progressive.


## Generating and accessing routes

The `addRoute` lifecycle action is used to generate routes. It registers a piece of route config to the route tree, giving a route, a component, and props that the component needs. The props and the component are both provided as paths for the bundler to `require`, because as explained in the [architecture overview](architecture.md), server and client only communicate through temp files.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't use the term "temp files" but rather "generated files"


At this point, you probably have a big `docusaurus.config.js` already😄 However, you haven't written much code yet! Most of the features are implemented through calling encapsulated Docusaurus APIs. As you continue your journey, you can take three paths:

- Learn more advanced Docusaurus concepts. This will help you gain a deeper understand of what the APIs do.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how do we link to the advanced section? 🤪

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmm, I definitely planned to do that, probably forgot before the merge...

@@ -0,0 +1,17 @@
# Routing
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure to understand the purprose of this file, is it just temporary until the next releases?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, because I want to allow readers to switch between versions and understand how the same page looks like across versions....


import React from 'react';
import {useColorMode} from '@docusaurus/theme-common';
import BasicZoom from 'react-medium-image-zoom';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems to load quite a few extra deps, see lockfile

what about using an existing docusaurus plugin instead?

https://github.com/flexanalytics/plugin-image-zoom
https://github.com/gabrielcsapo/docusaurus-plugin-image-zoom

this could apply to all site images automatically and also be nice to dogfood community plugins

@slorber
Copy link
Collaborator

slorber commented Jan 26, 2022

Great improvements, thanks a lot for that 👍

I think some parts of those docs are not so advanced and should be moved to guides (like basic routing and swizzling) but we'll do that later.

@Josh-Cena
Copy link
Collaborator Author

I do have some opinions about making the "Guides" section maximally approachable. Swizzling inevitably involves writing React code while routing involves more explanations than instructions. I'd want the guides section to only contain instructions on "how do I do X" through a well-defined Docusaurus API

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: documentation This PR works on the website or other text documents in the repo.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

More advanced tutorials: routing, server/client JS... Create ARCHITECTURE.md
3 participants