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): Improve the initial templates #4302 #4320

Merged
merged 30 commits into from
Mar 17, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
9ba149d
Merge pull request #113 from facebook/master
lisa761 Feb 15, 2021
b9b6700
Merge pull request #115 from facebook/master
javidrashid Feb 23, 2021
2e9033f
Merge pull request #116 from facebook/master
javidrashid Feb 25, 2021
d189b43
feat: add getting started doc at classic inital templates
Feb 25, 2021
2ad200e
fix: improve the contents of getting started page
Feb 26, 2021
aa9354f
fix: fix slug routing
Feb 26, 2021
e72eb71
fix: rename gettingStarted to getting-started and re-adjust the content
Feb 27, 2021
e6677a4
feat: add markdown-features docs
Feb 27, 2021
bb12e5f
feat: add a page on how to create a simple document
Feb 27, 2021
7b34e44
feat: add a page on how to create pages
Feb 27, 2021
1c4503b
feat: add create a post doc
Feb 27, 2021
054e414
feat: add thank you page with whats next
Feb 27, 2021
3b4be4f
feat : update sidebar.js
samuelships Mar 1, 2021
0c3f70a
feat : add introduction content
samuelships Mar 1, 2021
7e920e1
feat : add self hosting content
samuelships Mar 1, 2021
37a47eb
feat : add GitHub pages content
samuelships Mar 1, 2021
e21c636
Merge branch 'master' into besemuna/init-templates
slorber Mar 14, 2021
d3276c2
fix : remove automatically deploying with github actions content
samuelships Mar 15, 2021
6c8cc27
feat : add deploying to netlify
samuelships Mar 15, 2021
c177c57
feat : add Translate your site
samuelships Mar 15, 2021
f98adef
add : Manage versions
samuelships Mar 15, 2021
af8c0b4
fix : formatted docs with prettier
samuelships Mar 16, 2021
7112acd
Revert "fix : formatted docs with prettier"
slorber Mar 17, 2021
3d1eab3
run prettier to init templates with fixes
slorber Mar 17, 2021
ef3d00c
complete new init template
slorber Mar 17, 2021
afe02f9
rename manage-docs-versions
slorber Mar 17, 2021
b6994a4
change wording
slorber Mar 17, 2021
e36ff57
refresh config file
slorber Mar 17, 2021
60e9ae7
rework init template homepage
slorber Mar 17, 2021
4eb31e4
minor changes
slorber Mar 17, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
---
title: Deploy your site
title: Deploy your site
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
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 :
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
:::

:::warning It is not the most performant solution :::
Copy link
Collaborator

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

Copy link
Collaborator

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


Docusaurus can be self hosted with docusaurus serve. Change your `--port` and `--host` to match appropriately.

Expand All @@ -28,7 +23,9 @@ 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
Expand All @@ -39,4 +36,4 @@ module.exports = {

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.
Your site should now automatically deploy when ever you merge into your deploy branch, which defaults to master.
21 changes: 9 additions & 12 deletions packages/docusaurus-init/templates/classic/docs/manage-versions.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
---
title: Manage Versions
title: Manage Versions
---

Docusaurus gives you the option to have different versions of your docs,
allowing you to update and have previous versions available.

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

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
```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`

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`.
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`.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
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".
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"
Expand All @@ -26,13 +26,14 @@ module.exports = {
```

### 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.

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
```bash
npm run start -- --locale fr
```

Expand Down