-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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): Improve the initial templates #4302 #4320
Merged
slorber
merged 30 commits into
facebook:master
from
MLH-Fellowship:besemuna/init-templates
Mar 17, 2021
Merged
Changes from 22 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
9ba149d
Merge pull request #113 from facebook/master
lisa761 b9b6700
Merge pull request #115 from facebook/master
javidrashid 2e9033f
Merge pull request #116 from facebook/master
javidrashid d189b43
feat: add getting started doc at classic inital templates
2ad200e
fix: improve the contents of getting started page
aa9354f
fix: fix slug routing
e72eb71
fix: rename gettingStarted to getting-started and re-adjust the content
e6677a4
feat: add markdown-features docs
bb12e5f
feat: add a page on how to create a simple document
7b34e44
feat: add a page on how to create pages
1c4503b
feat: add create a post doc
054e414
feat: add thank you page with whats next
3b4be4f
feat : update sidebar.js
samuelships 0c3f70a
feat : add introduction content
samuelships 7e920e1
feat : add self hosting content
samuelships 37a47eb
feat : add GitHub pages content
samuelships e21c636
Merge branch 'master' into besemuna/init-templates
slorber d3276c2
fix : remove automatically deploying with github actions content
samuelships 6c8cc27
feat : add deploying to netlify
samuelships c177c57
feat : add Translate your site
samuelships f98adef
add : Manage versions
samuelships af8c0b4
fix : formatted docs with prettier
samuelships 7112acd
Revert "fix : formatted docs with prettier"
slorber 3d1eab3
run prettier to init templates with fixes
slorber ef3d00c
complete new init template
slorber afe02f9
rename manage-docs-versions
slorber b6994a4
change wording
slorber e36ff57
refresh config file
slorber 60e9ae7
rework init template homepage
slorber 4eb31e4
minor changes
slorber File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
packages/docusaurus-init/templates/classic/docs/deploy-your-site.md
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
title: Deploy your site | ||
--- | ||
|
||
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; | ||
|
||
This page will discuss multiple options available when it comes to deploying your docs site. Before even this happens, you need to build the files of your website for production. To do this, run : | ||
|
||
```bash | ||
npm run build | ||
``` | ||
|
||
The static files will be generate in the build/ directory. | ||
|
||
## Self Hosting | ||
|
||
:::warning It is not the most performant solution ::: | ||
|
||
Docusaurus can be self hosted with docusaurus serve. Change your `--port` and `--host` to match appropriately. | ||
|
||
```bash | ||
npm run serve --build --port 80 --host 0.0.0.0 | ||
``` | ||
|
||
## Deploying to Netlify | ||
|
||
One of the fastest ways to deploy is through [Netlify](https://www.netlify.com/). Configure your `docusaurus.config.js` | ||
|
||
```js {2-3} title="docusaurus.config.js" | ||
module.exports = { | ||
url: 'https://docusaurus-2.netlify.com', // Url to your site with no trailing slash | ||
baseUrl: '/', // Base directory of your site relative to your repo | ||
// ... | ||
}; | ||
``` | ||
|
||
After you're done, [setup your site with Netlify](https://app.netlify.com/start). | ||
|
||
Your site should now automatically deploy when ever you merge into your deploy branch, which defaults to master. |
25 changes: 25 additions & 0 deletions
25
packages/docusaurus-init/templates/classic/docs/manage-versions.md
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
title: Manage Versions | ||
--- | ||
|
||
Docusaurus gives you the option to have different versions of your docs, allowing you to update and have previous versions available. | ||
|
||
### Tagging a new version | ||
|
||
To tag a new version make sure the content in the `docs` directory is ready to be frozen as a version. Run the following command to tag a version | ||
|
||
```bash | ||
npm run docusaurus docs:version <version> | ||
``` | ||
|
||
When a new `version` is tagged, the `docs/` directory content will be copied into `versioned_docs/version-<version>/` folder. A [sidebar](https://v2.docusaurus.io/docs/docs-introduction#sidebar) configuration will also be copiend and the version number added to `versions.json`. | ||
|
||
## Updating an existing version | ||
|
||
You can edit any version in its specific folder, comit and push changes and it will be published to that version. Example when you change any file in `versioned_docs/version-2.6/`, it will only affect the docs for `version 2.6` | ||
|
||
## Deleting an existing version | ||
|
||
You can delete an existing version by removing the version from `versions.json` file, deleting the docs directory, Example : `versioned_docs/version-1.8.0` and deleting the versioned sidebar file, Example : `versioned_sidebars/version-1.8.0-sidebars.json`. | ||
|
||
After tagging a new version or deleting an existing version, you can restart the site with `yarn restart` or `npm restart`. |
40 changes: 40 additions & 0 deletions
40
packages/docusaurus-init/templates/classic/docs/translate-your-site.md
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
title: Translate your site | ||
--- | ||
|
||
In this page we would cover translate .md files. We are going to translate the `Getting Started` page in the `Docusaurus Tutorial section` to French - "fr". | ||
|
||
### Site Configuration | ||
|
||
Use the [site i18n configuration](https://v2.docusaurus.io/docs/next/docusaurus.config.js#i18n) to add the fr locale" | ||
|
||
```js title="docusaurus.config.js" | ||
module.exports = { | ||
i18n: { | ||
defaultLocale: 'en', | ||
locales: ['en', 'fr'], | ||
localeConfigs: { | ||
en: { | ||
label: 'English', | ||
}, | ||
fr: { | ||
label: 'Français', | ||
}, | ||
}, | ||
}, | ||
}; | ||
``` | ||
|
||
### Translate the page | ||
|
||
To Transte the `getting-started.md` page, copy `docs/getting-started.md` to `i18n/fr/plugin-docs/getting-started.md`. Replace the content in the i118n folder with the French locale content. | ||
|
||
### Start your site | ||
|
||
Start your localized site in dev mode, using the fr local. | ||
|
||
```bash | ||
npm run start -- --locale fr | ||
``` | ||
|
||
Your site is accessible at **`http://localhost:3000/fr/`**. |
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unfortunately this code is not valid anymore after prettier has been run 😅 that's why I said there were missing line breaks, because you have to add extra line breaks in some places before running prettier
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
going to revert your commit and do the fixes directly so I can merge asap