mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-20 12:37:01 +02:00
Publish v1.2.1 (#785)
This commit is contained in:
parent
bbe4b9e0b5
commit
ca8afb0951
12 changed files with 1341 additions and 47 deletions
48
CHANGELOG.md
48
CHANGELOG.md
|
@ -6,6 +6,51 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
## [1.2.1] - 2018-06-17
|
||||
|
||||
Fixes from existing issues and those found in the 1.2.0 release. Fixes include being able to modify the metadata of a doc without resorting to deleting `en.json`, using absolute URLs instead of relative for docs links, and more. We also added a few new things as well.
|
||||
|
||||
Welcome to our newest users, [Babel](https://babeljs.io), [Sonar](https://fbsonar.com), [Metro](https://facebook.github.io/), [StreamPipes](https://docs.streampipes.org/), and [rest-hapi](https://jkheadley.github.io/rest-hapi/).
|
||||
|
||||
Thank you to the following contributors who helped with this release:
|
||||
|
||||
- @endiliey
|
||||
- @yangshun
|
||||
- @Kelltimo
|
||||
- @ayshiff
|
||||
- @rupeshparab
|
||||
- @gustavohenke
|
||||
- @maxogden
|
||||
- @jonathaningram
|
||||
- @dominikriemer
|
||||
- @anru
|
||||
- @Rendez
|
||||
- @Thai56
|
||||
- @JKHeadley
|
||||
|
||||
### Breaking changes
|
||||
|
||||
- This may not affect many users, but if you modified the `en.json` to add your own custom translation strings, we [changed](https://github.com/facebook/Docusaurus/commit/608e2c85a21cd17d9f45496a479ec82f5620a48a) how this is handled, and you will need to [follow the instructions here](https://docusaurus.io/docs/en/translation#custom-translation-strings) to modify your setup.
|
||||
|
||||
### Added
|
||||
|
||||
- Option to [disable](https://github.com/facebook/Docusaurus/commit/62a2c7c1a599ccaf04a86e9ca2ec0fbca5220f5c) live reload during development.
|
||||
- Configuration options for [changing](https://github.com/facebook/Docusaurus/commit/58fba70dead064e8c6910e07d3523a548258022f) the title of the blog sidebar info.
|
||||
- Better support and [documentation](https://docusaurus.io/docs/en/publishing#using-github-pages) for [cross-repo publishing](https://github.com/facebook/Docusaurus/commit/fd9a3ffb6deca84b41dc5a3b43b0db1ca4f3143e).
|
||||
|
||||
### Fixed/Changed
|
||||
|
||||
- 1.2.0 introduced a bug where you could not update documentation metadata without deleting `en.json`. This has been [fixed](https://github.com/facebook/Docusaurus/commit/608e2c85a21cd17d9f45496a479ec82f5620a48a) as part of the custom translation string breaking change.
|
||||
- Absolute URLs are now [used](https://github.com/facebook/Docusaurus/commit/0f01eace8be1be273a63089a14d1e3ea2d2cae57) instead of relative URLs for documentation linking to avoid trailing slash issues.
|
||||
- If you have had trouble updating Docusaurus, it may have been your [Babel cache](https://docusaurus.io/docs/en/installation#updating-your-docusaurus-version).
|
||||
- No more errors if heading anchors are [empty](https://github.com/facebook/Docusaurus/commit/371fdda4a8c82b5f29dd5c2dd9f04c8ef28dd025).
|
||||
- Fixed bug when [renaming version](https://github.com/facebook/Docusaurus/commit/a2b076bdcaf7099e595f2f106b38dd0cabeee1ef) where `sidebars.json` were not getting updated.
|
||||
- Table of contents are now [hidden](https://github.com/facebook/Docusaurus/commit/7bef1b96dc8de8c42795b0983195f66a7ae78c27) when `onPageNav` is not separate.
|
||||
|
||||
### Removed
|
||||
|
||||
N/A
|
||||
|
||||
## [1.2.0] - 2018-06-10
|
||||
|
||||
A major point release. This release adds highly requested features, including extension-less URLs, nested directories for docs and adding a second option (Prism) for syntax highlighting.
|
||||
|
@ -518,7 +563,8 @@ N/A
|
|||
- Blog
|
||||
- Documentation
|
||||
|
||||
[Unreleased]: https://github.com/facebook/Docusaurus/compare/v1.2.0...HEAD
|
||||
[Unreleased]: https://github.com/facebook/Docusaurus/compare/v1.2.1...HEAD
|
||||
[1.2.1]: https://github.com/facebook/Docusaurus/compare/v1.2.0...v1.2.1
|
||||
[1.2.0]: https://github.com/facebook/Docusaurus/compare/v1.1.5...v1.2.0
|
||||
[1.1.5]: https://github.com/facebook/Docusaurus/compare/v1.1.4...v1.1.5
|
||||
[1.1.4]: https://github.com/facebook/Docusaurus/compare/v1.1.3...v1.1.4
|
||||
|
|
28
package-lock.json
generated
28
package-lock.json
generated
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "docusaurus",
|
||||
"version": "1.2.0",
|
||||
"version": "1.2.1",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -3198,9 +3198,9 @@
|
|||
}
|
||||
},
|
||||
"fbjs": {
|
||||
"version": "0.8.16",
|
||||
"resolved": "https://registry.npmjs.org/fbjs/-/fbjs-0.8.16.tgz",
|
||||
"integrity": "sha1-XmdDL1UNxBtXK/VYR7ispk5TN9s=",
|
||||
"version": "0.8.17",
|
||||
"resolved": "https://registry.npmjs.org/fbjs/-/fbjs-0.8.17.tgz",
|
||||
"integrity": "sha1-xNWY6taUkRJlPWWIsBpc3Nn5D90=",
|
||||
"requires": {
|
||||
"core-js": "^1.0.0",
|
||||
"isomorphic-fetch": "^2.1.1",
|
||||
|
@ -3208,7 +3208,7 @@
|
|||
"object-assign": "^4.1.0",
|
||||
"promise": "^7.1.1",
|
||||
"setimmediate": "^1.0.5",
|
||||
"ua-parser-js": "^0.7.9"
|
||||
"ua-parser-js": "^0.7.18"
|
||||
},
|
||||
"dependencies": {
|
||||
"core-js": {
|
||||
|
@ -7507,9 +7507,9 @@
|
|||
}
|
||||
},
|
||||
"prismjs": {
|
||||
"version": "1.14.0",
|
||||
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.14.0.tgz",
|
||||
"integrity": "sha512-sa2s4m60bXs+kU3jcuUwx3ZCrUH7o0kuqnOOINbODqlRrDB7KY8SRx+xR/D7nHLlgfDdG7zXbRO8wJ+su5Ls0A==",
|
||||
"version": "1.15.0",
|
||||
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.15.0.tgz",
|
||||
"integrity": "sha512-Lf2JrFYx8FanHrjoV5oL8YHCclLQgbJcVZR+gikGGMqz6ub5QVWDTM6YIwm3BuPxM/LOV+rKns3LssXNLIf+DA==",
|
||||
"requires": {
|
||||
"clipboard": "^2.0.0"
|
||||
}
|
||||
|
@ -7671,9 +7671,9 @@
|
|||
}
|
||||
},
|
||||
"react": {
|
||||
"version": "16.4.0",
|
||||
"resolved": "https://registry.npmjs.org/react/-/react-16.4.0.tgz",
|
||||
"integrity": "sha512-K0UrkLXSAekf5nJu89obKUM7o2vc6MMN9LYoKnCa+c+8MJRAT120xzPLENcWSRc7GYKIg0LlgJRDorrufdglQQ==",
|
||||
"version": "16.4.1",
|
||||
"resolved": "https://registry.npmjs.org/react/-/react-16.4.1.tgz",
|
||||
"integrity": "sha512-3GEs0giKp6E0Oh/Y9ZC60CmYgUPnp7voH9fbjWsvXtYFb4EWtgQub0ADSq0sJR0BbHc4FThLLtzlcFaFXIorwg==",
|
||||
"requires": {
|
||||
"fbjs": "^0.8.16",
|
||||
"loose-envify": "^1.1.0",
|
||||
|
@ -7729,9 +7729,9 @@
|
|||
}
|
||||
},
|
||||
"react-dom": {
|
||||
"version": "16.4.0",
|
||||
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.4.0.tgz",
|
||||
"integrity": "sha512-bbLd+HYpBEnYoNyxDe9XpSG2t9wypMohwQPvKw8Hov3nF7SJiJIgK56b46zHpBUpHb06a1iEuw7G3rbrsnNL6w==",
|
||||
"version": "16.4.1",
|
||||
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.4.1.tgz",
|
||||
"integrity": "sha512-1Gin+wghF/7gl4Cqcvr1DxFX2Osz7ugxSwl6gBqCMpdrxHjIFUS7GYxrFftZ9Ln44FHw0JxCFD9YtZsrbR5/4A==",
|
||||
"requires": {
|
||||
"fbjs": "^0.8.16",
|
||||
"loose-envify": "^1.1.0",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "docusaurus",
|
||||
"description": "Easy to Maintain Open Source Documentation Websites",
|
||||
"version": "1.2.0",
|
||||
"version": "1.2.1",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"documentation",
|
||||
|
@ -52,10 +52,10 @@
|
|||
"imagemin-svgo": "^6.0.0",
|
||||
"markdown-toc": "^1.2.0",
|
||||
"mkdirp": "^0.5.1",
|
||||
"prismjs": "^1.14.0",
|
||||
"react": "^16.4.0",
|
||||
"prismjs": "^1.15.0",
|
||||
"react": "^16.4.1",
|
||||
"react-dev-utils": "^5.0.1",
|
||||
"react-dom": "^16.4.0",
|
||||
"react-dom": "^16.4.1",
|
||||
"remarkable": "^1.7.1",
|
||||
"request": "^2.87.0",
|
||||
"shelljs": "^0.7.8",
|
||||
|
|
167
website/versioned_docs/version-1.2.1/api-commands.md
Normal file
167
website/versioned_docs/version-1.2.1/api-commands.md
Normal file
|
@ -0,0 +1,167 @@
|
|||
---
|
||||
id: version-1.2.1-commands
|
||||
title: CLI Commands
|
||||
original_id: commands
|
||||
---
|
||||
|
||||
Docusaurus provides a set of scripts to help you generate, serve, and deploy your website. These scripts can be invoked with the `run` command when using Yarn or npm. Some common commands are:
|
||||
|
||||
* [`yarn run start`](api-commands.md#docusaurus-start-port-number): build and serve the website from a local server
|
||||
* [`yarn run examples`](api-commands.md#docusaurus-examples): create example configuration files
|
||||
|
||||
## Running from the command line
|
||||
|
||||
The scripts can be run using either Yarn or npm. If you've already gone through our Getting Started guide, you may already be familiar with the `start` command. It's the command that tells Docusaurus to run the `docusaurus-start` script which generates the site and starts up a server, and it's usually invoked like so:
|
||||
|
||||
```bash
|
||||
yarn run start
|
||||
```
|
||||
|
||||
The same script can be invoked using npm:
|
||||
|
||||
```bash
|
||||
npm run start
|
||||
```
|
||||
|
||||
To run a particular script, just replace the `start` command in the examples above with the command associated with your script.
|
||||
|
||||
## Using arguments
|
||||
|
||||
Some commands support optional arguments. For example, to start a server on port 8080, you can specify the `--port` argument when running `start`:
|
||||
|
||||
```bash
|
||||
yarn run start --port 8080
|
||||
```
|
||||
|
||||
If you run Docusaurus using npm, you can still use the command line arguments by inserting a `--` between `npm run <command>` and the command arguments:
|
||||
|
||||
```bash
|
||||
npm run start -- --port 8080
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
These scripts are set up under the `"scripts"` key in your `website/package.json` file as part of the installation process. If you need help setting them up again, please refer to the [Installation guide](getting-started-installation.md).
|
||||
|
||||
Docusaurus provides some default mappings to allow you to run commands following Node conventions. Instead of typing `docusaurus-start` every time, you can type `yarn run start` or `npm start` to achieve the same.
|
||||
|
||||
## Commands
|
||||
|
||||
<AUTOGENERATED_TABLE_OF_CONTENTS>
|
||||
|
||||
---
|
||||
|
||||
## Reference
|
||||
|
||||
### `docusaurus-build`
|
||||
|
||||
Alias: `build`.
|
||||
|
||||
| Options | Default | Description |
|
||||
| -------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------- |
|
||||
| `--skip-image-compression` | `false` | Skip compression of image assets. You usually won't want to skip this unless your images have already been optimized. |
|
||||
|
||||
Generates the static website, applying translations if necessary. Useful for building the website prior to deployment.
|
||||
|
||||
See also [`docusaurus-start`](api-commands.md#docusaurus-start).
|
||||
|
||||
---
|
||||
|
||||
### `docusaurus-examples`
|
||||
|
||||
Alias: `examples`
|
||||
|
||||
| Arguments | Default | Description |
|
||||
| ----------- | ------- | ---------------------------------------------------------------------------------------------------- |
|
||||
| `<feature>` | - | Specify a feature `translations` or `versions` to generate the extra example files for that feature. |
|
||||
|
||||
**Example**
|
||||
|
||||
```bash
|
||||
docusaurus-examples <feature>
|
||||
```
|
||||
|
||||
When no feature is specified, sets up a minimally configured example website in your project. This command is covered in depth in the [Site Preparation guide](getting-started-preparation.md).
|
||||
|
||||
---
|
||||
|
||||
### `docusaurus-publish`
|
||||
|
||||
Alias: `publish-gh-pages`
|
||||
|
||||
[Builds](api-commands.md#docusaurus-build), then deploys the static website to GitHub Pages. This command is meant to be run during the deployment step in Circle CI, and therefore expects a few environment variables to be defined:
|
||||
|
||||
The following environment variables are generally set manually by the user in the CircleCI `config.yml` file.
|
||||
|
||||
* `GIT_USER`: The git user to be associated with the deploy commit.
|
||||
* `USE_SSH`: Whether to use SSH instead of HTTPS for your connection to the GitHub repo.
|
||||
|
||||
**Example**
|
||||
|
||||
```bash
|
||||
GIT_USER=docusaurus-bot USE_SSH=true yarn run publish-gh-pages
|
||||
```
|
||||
|
||||
The following environment variables are [set by CircleCI](https://circleci.com/docs/1.0/environment-variables/) during the build process.
|
||||
|
||||
* `CIRCLE_BRANCH`: The git branch associated with the commit that triggered the CI run.
|
||||
* `CI_PULL_REQUEST`: Expected to be truthy if the current CI run was triggered by a commit in a pull request.
|
||||
|
||||
The following should be set by you in `siteConfig.js` as `organizationName` and `projectName`, respectively. If they are not set in your site configuration, they fall back to the [CircleCI environment](https://circleci.com/docs/1.0/environment-variables/).
|
||||
|
||||
* `CIRCLE_PROJECT_USERNAME`: The GitHub username or organization name that hosts the Git repo, e.g. "facebook".
|
||||
* `CIRCLE_PROJECT_REPONAME`: The name of the Git repo, e.g. "Docusaurus".
|
||||
|
||||
You can learn more about configuring automatic deployments with CircleCI in the [Publishing guide](getting-started-publishing.md).
|
||||
|
||||
---
|
||||
|
||||
### `docusaurus-rename-version`
|
||||
|
||||
Alias: `rename-version`
|
||||
|
||||
Renames an existing version of the docs to a new version name.
|
||||
|
||||
| Arguments | Default | Description |
|
||||
| ------------------ | ------- | ------------------------- |
|
||||
| `<currentVersion>` | - | Version to be renamed. |
|
||||
| `<newVersion>` | - | Version to be renamed to. |
|
||||
|
||||
**Example**
|
||||
|
||||
```bash
|
||||
docusaurus-rename-version <currentVersion> <newVersion>
|
||||
```
|
||||
|
||||
See the [Versioning guide](guides-versioning.md#renaming-existing-versions) to learn more.
|
||||
|
||||
---
|
||||
|
||||
### `docusaurus-start`
|
||||
|
||||
Alias: `start`.
|
||||
|
||||
This script will build the static website, apply translations if necessary, and then start a local server.
|
||||
|
||||
| Options | Default | Description |
|
||||
| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `--port <number>` | `3000` | The website will be served from port 3000 by default, but if the port is taken up, Docusaurus will attempt to find an available one. |
|
||||
| `--watch` | - | Whether to watch the files and live reload the page when files are changed. Defaults to true. Disable this by using `--no-watch`. |
|
||||
|
||||
---
|
||||
|
||||
### `docusaurus-version <version>`
|
||||
|
||||
Alias: `version`
|
||||
|
||||
Generates a new version of the docs. This will result in a new copy of your site being generated and stored in its own versioned directory. Useful for capturing snapshots of API docs that map to specific versions of your software. Accepts any string as a version number.
|
||||
|
||||
See the [Versioning guide](guides-versioning.md) to learn more.
|
||||
|
||||
---
|
||||
|
||||
### `docusaurus-write-translations`
|
||||
|
||||
Alias: `write-translations`
|
||||
|
||||
Writes the English for any strings that need to be translated into an `website/i18n/en.json` file. The script will go through every file in `website/pages/en` and through the `siteConfig.js` file and other config files to fetch English strings that will then be translated on Crowdin. See the [Translation guide](guides-translation.md) to learn more.
|
268
website/versioned_docs/version-1.2.1/api-site-config.md
Normal file
268
website/versioned_docs/version-1.2.1/api-site-config.md
Normal file
|
@ -0,0 +1,268 @@
|
|||
---
|
||||
id: version-1.2.1-site-config
|
||||
title: siteConfig.js
|
||||
original_id: site-config
|
||||
---
|
||||
|
||||
A large part of site configuration is done by editing the `siteConfig.js` file.
|
||||
|
||||
## User Showcase
|
||||
|
||||
The `users` array is used to store objects for each project/user that you want to show on your site. Currently this field is used by example the `pages/en/index.js` and `pages/en/users.js` files provided. Each user object should have `caption`, `image`, `infoLink`, and `pinned` fields. The `caption` is the text showed when someone hovers over the `image` of that user, and the `infoLink` is where clicking the image will bring someone. The `pinned` field determines whether or not it shows up on the `index` page.
|
||||
|
||||
Currently this `users` array is used only by the `index.js` and `users.js` example files. If you do not wish to have a users page or show users on the `index` page, you may remove this section.
|
||||
|
||||
## siteConfig Fields
|
||||
|
||||
The `siteConfig` object contains the bulk of the configuration settings for your website.
|
||||
|
||||
### Mandatory Fields
|
||||
|
||||
`baseUrl` - baseUrl for your site.
|
||||
|
||||
`colors` - Color configurations for the site.
|
||||
|
||||
* `primaryColor` is the color used the header navigation bar and sidebars.
|
||||
* `secondaryColor` is the color seen in the second row of the header navigation bar when the site window is narrow (including on mobile).
|
||||
* Custom color configurations can also be added. For example, if user styles are added with colors specified as `$myColor`, then adding a `myColor` field to `colors` will allow you to easily configure this color.
|
||||
|
||||
`copyright` - The copyright string at footer of site and within feed
|
||||
|
||||
`favicon` - URL for site favicon.
|
||||
|
||||
`headerIcon` - URL for icon used in header navigation bar.
|
||||
|
||||
`headerLinks` - Links that will be used in the header navigation bar. The `label` field of each object will be the link text and will also be translated for each language.
|
||||
|
||||
Example Usage:
|
||||
|
||||
```js
|
||||
headerLinks: [
|
||||
// Links to document with id doc1 for current language/version
|
||||
{ doc: "doc1", label: "Getting Started" },
|
||||
// Link to page found at pages/en/help.js or if that does not exist, pages/help.js, for current language
|
||||
{ page: "help", label: "Help" },
|
||||
// Links to href destination
|
||||
{ href: "https://github.com/", label: "GitHub" },
|
||||
// Links to blog generated by Docusaurus (${baseUrl}blog)
|
||||
{ blog: true, label: "Blog" },
|
||||
// Determines search bar position among links
|
||||
{ search: true },
|
||||
// Determines language drop down position among links
|
||||
{ languages: true }
|
||||
],
|
||||
```
|
||||
|
||||
`noIndex` - Boolean. If true, Docusaurus will politely ask crawlers and search engines to avoid indexing your site. This is done with a header tag and so only applies to docs and pages. Will not attempt to hide static resources. This is a best effort request. Malicious crawlers can and will still index your site.
|
||||
|
||||
`organizationName` - GitHub username of the organization or user hosting this project. This is used by the publishing script to determine where your GitHub pages website will be hosted.
|
||||
|
||||
`projectName` - Project name. This must match your GitHub repository project name (case-sensitive).
|
||||
|
||||
`tagline` - Tagline for your website.
|
||||
|
||||
`title` - Title for your website.
|
||||
|
||||
`url` - URL for your website.
|
||||
|
||||
### Optional Fields
|
||||
|
||||
`algolia` - Information for Algolia search integration. If this field is excluded, the search bar will not appear in the header. You must specify two values for this field, and one (`appId`) is optional.
|
||||
|
||||
* `apiKey` - the Algolia provided API key for your search.
|
||||
* `indexName` - the Algolia provided index name for your search (usually this is the project name)
|
||||
* `appId` - Algolia provides a default scraper for your docs. If you provide your own, you will probably get this id from them.
|
||||
|
||||
`blogSidebarCount` - Control the number of blog posts that show up in the sidebar. See the [adding a blog docs](guides-blog.md#changing-how-many-blog-posts-show-on-sidebar) for more information.
|
||||
|
||||
`blogSidebarTitle` - Control the title of the blog sidebar. See the [adding a blog docs](guides-blog.md#changing-the-sidebar-title) for more information.
|
||||
|
||||
`cleanUrl` - If `true`, allow URLs with no `html` extension. For example, a request to URL https://docusaurus.io/docs/installation will returns the same result as https://docusaurus.io/docs/installation.html.
|
||||
|
||||
`cname` - The CNAME for your website. It will go into a `CNAME` file when your site is built.
|
||||
|
||||
`customDocsPath` - By default, Docusaurus expects your documentation to be in a directory called `docs`. This directory is at the same level as the `website` directory (i.e., not inside the `website` directory). You can specify a custom path to your documentation with this field.
|
||||
|
||||
```js
|
||||
customDocsPath: 'docs/site';
|
||||
```
|
||||
|
||||
```js
|
||||
customDocsPath: 'website-docs';
|
||||
```
|
||||
|
||||
`defaultVersionShown` - The default version for the site to be shown. If this is not set, the latest version will be shown.
|
||||
|
||||
`disableHeaderTitle` - An option to disable showing the title in the header next to the header icon. Exclude this field to keep the header as normal, otherwise set to `true`.
|
||||
|
||||
`disableTitleTagline` - An option to disable showing the tagline in the title of main pages. Exclude this field to keep page titles as `Title • Tagline`. Set to `true` to make page titles just `Title`.
|
||||
|
||||
`editUrl` - URL for editing docs, usage example: `editUrl + 'en/doc1.md'`. If this field is omitted, there will be no "Edit this Doc" button for each document.
|
||||
|
||||
`facebookAppId` - If you want Facebook Like/Share buttons in the footer and at the bottom of your blog posts, provide a [Facebook application id](https://www.facebook.com/help/audiencenetwork/804209223039296).
|
||||
|
||||
`facebookComments` - Set this to `true` if you want to enable Facebook comments at the bottom of your blog post. `facebookAppId` has to be also set.
|
||||
|
||||
`facebookPixelId` - [Facebook Pixel](https://www.facebook.com/business/a/facebook-pixel) ID to track page views.
|
||||
|
||||
`fonts` - Font-family CSS configuration for the site. If a font family is specified in `siteConfig.js` as `$myFont`, then adding a `myFont` key to an array in `fonts` will allow you to configure the font. Items appearing earlier in the array will take priority of later elements, so ordering of the fonts matter.
|
||||
|
||||
In the below example, we have two sets of font configurations, `myFont` and `myOtherFont`. `Times New Roman` is the preferred font in `myFont`. `-apple-system` is the preferred in `myOtherFont`.
|
||||
|
||||
```js
|
||||
fonts: {
|
||||
myFont: [
|
||||
'Times New Roman',
|
||||
'Serif'
|
||||
],
|
||||
myOtherFont: [
|
||||
'-apple-system',
|
||||
'system-ui'
|
||||
]
|
||||
},
|
||||
```
|
||||
|
||||
The above fonts would be represented in your CSS file(s) as variables `$myFont` and `$myOtherFont`.
|
||||
|
||||
```css
|
||||
h1 {
|
||||
font-family: $myFont;
|
||||
}
|
||||
```
|
||||
|
||||
`footerIcon` - URL for a footer icon. Currently used in the `core/Footer.js` file provided as an example, but it can be removed from that file.
|
||||
|
||||
`gaTrackingId` - Google Analytics tracking ID to track page views.
|
||||
|
||||
`gaGtag` - Set this to `true` if you want to use [global site tags (gtag.js)](https://developers.google.com/gtagjs/) for Google analytics instead of `analytics.js`.
|
||||
|
||||
`githubHost` - Hostname of your server. Useful if you are using GitHub Enterprise.
|
||||
|
||||
`highlight` - [Syntax highlighting](api-doc-markdown.md) options:
|
||||
|
||||
* `theme` is the name of the theme used by Highlight.js when highlighting code. You can find the [list of supported themes here](https://github.com/isagalaev/highlight.js/tree/master/src/styles).
|
||||
* `version` specifies a particular version of Highlight.js to be used.
|
||||
* `hljs` provides an escape valve by passing an instance of Highlight.js to the function specified here, allowing additional languages to be registered for syntax highlighting.
|
||||
* `defaultLang` defines a default language. It will be used if one is not specified at the top of the code block. You can find the [list of supported languages here](https://github.com/isagalaev/highlight.js/tree/master/src/languages).
|
||||
* `themeUrl` is the custom URL of CSS theme file that you want to use with Highlight.js. If this is provided, the `theme` and `version` fields will be ignored.
|
||||
|
||||
`markdownPlugins` - An array of plugins to be loaded by Remarkable, the markdown parser and renderer used by Docusaurus. The plugin will receive a reference to the Remarkable instance, allowing custom parsing and rendering rules to be defined.
|
||||
|
||||
`ogImage` - Local path to an Open Graph image (e.g., `img/myImage.png`). This image will show up when your site is shared on Facebook and other websites/apps where the Open Graph protocol is supported.
|
||||
|
||||
`onPageNav` - If you want a visible navigation option for representing topics on the current page. Currently, there is one accepted value for this option:
|
||||
|
||||
* `separate` - The secondary navigation is a separate pane defaulting on the right side of a document. See http://docusaurus.io/docs/en/translation.html for an example.
|
||||
|
||||
`scripts` - Array of JavaScript sources to load. The script tag will be inserted in the HTML head.
|
||||
|
||||
`separateCss` - Directories inside which any `css` files will not be processed and concatenated to Docusaurus' styles. This is to support static `html` pages that may be separate from Docusaurus with completely separate styles.
|
||||
|
||||
`scrollToTop` - Set this to `true` if you want to enable the scroll to top button at the bottom of your site.
|
||||
|
||||
`scrollToTopOptions` - Optional options configuration for the scroll to top button. You do not need to use this, even if you set `scrollToTop` to `true`; it just provides you more configuration control of the button. You can find more options [here](https://github.com/vfeskov/vanilla-back-to-top/blob/v7.1.14/OPTIONS.md). By default, we set the zIndex option to 100.
|
||||
|
||||
`stylesheets` - Array of CSS sources to load. The link tag will be inserted in the HTML head.
|
||||
|
||||
`translationRecruitingLink` - URL for the `Help Translate` tab of language selection when languages besides English are enabled. This can be included you are using translations but does not have to be.
|
||||
|
||||
`twitter` - Set this to `true` if you want a Twitter social button to appear at the bottom of your blog posts.
|
||||
|
||||
`twitterUsername` - If you want a Twitter follow button at the bottom of your page, provide a Twitter username to follow. For example: `docusaurus`.
|
||||
|
||||
`twitterImage` - Local path to your Twitter card image (e.g., `img/myImage.png`). This image will show up on the Twitter card when your site is shared on Twitter.
|
||||
|
||||
`useEnglishUrl` - If you do not have [translations](guides-translation.md) enabled (e.g., by having a `languages.js` file), but still want a link of the form `/docs/en/doc.html` (with the `en`), set this to `true`.
|
||||
|
||||
`users` - The `users` array mentioned earlier.
|
||||
|
||||
`usePrism` - Array of languages to use Prism syntax highlighter. Refer to [Using Prism as additional syntax highlighter](api-doc-markdown.md#using-prism-as-additional-syntax-highlighter). Set it to `true` to use Prism on all languages.
|
||||
|
||||
`wrapPagesHTML` - Boolean flag to indicate whether `html` files in `/pages` should be wrapped with Docusaurus site styles, header and footer. This feature is experimental and relies on the files being `html` fragments instead of complete pages. It inserts the contents of your `html` file with no extra processing. Defaults to `false`.
|
||||
|
||||
Users can also add their own custom fields if they wish to provide some data across different files.
|
||||
|
||||
## Example siteConfig.js with many available fields
|
||||
|
||||
```js
|
||||
const users = [
|
||||
{
|
||||
caption: 'User1',
|
||||
image: '/test-site/img/docusaurus.svg',
|
||||
infoLink: 'https://www.example.com',
|
||||
pinned: true,
|
||||
},
|
||||
];
|
||||
|
||||
const siteConfig = {
|
||||
title: 'Docusaurus',
|
||||
tagline: 'Generate websites!',
|
||||
url: 'https://docusaurus.io',
|
||||
baseUrl: '/',
|
||||
// For github.io type URLS, you would combine the URL and baseUrl like:
|
||||
// url: 'https://reasonml.github.io',
|
||||
// baseUrl: '/reason-react/',
|
||||
defaultVersionShown: '1.0.0',
|
||||
organizationName: 'facebook',
|
||||
projectName: 'docusaurus',
|
||||
noIndex: false,
|
||||
// For no header links in the top nav bar -> headerLinks: [],
|
||||
headerLinks: [
|
||||
{doc: 'doc1', label: 'Docs'},
|
||||
{page: 'help', label: 'Help'},
|
||||
{search: true},
|
||||
{blog: true},
|
||||
],
|
||||
headerIcon: 'img/docusaurus.svg',
|
||||
favicon: 'img/favicon.png',
|
||||
colors: {
|
||||
primaryColor: '#2E8555',
|
||||
secondaryColor: '#205C3B',
|
||||
},
|
||||
editUrl: 'https://github.com/facebook/docusaurus/edit/master/docs/',
|
||||
// Users variable set above
|
||||
users,
|
||||
disableHeaderTitle: true,
|
||||
disableTitleTagline: true,
|
||||
separateCss: ['static/css/non-docusaurus', 'static/assets/separate-css'],
|
||||
footerIcon: 'img/docusaurus.svg',
|
||||
translationRecruitingLink: 'https://crowdin.com/project/docusaurus',
|
||||
algolia: {
|
||||
apiKey: '0f9f28b9ab9efae89810921a351753b5',
|
||||
indexName: 'github',
|
||||
},
|
||||
gaTrackingId: 'UA-12345678-9',
|
||||
highlight: {
|
||||
theme: 'default',
|
||||
},
|
||||
markdownPlugins: [
|
||||
function foo(md) {
|
||||
md.renderer.rules.fence_custom.foo = function(
|
||||
tokens,
|
||||
idx,
|
||||
options,
|
||||
env,
|
||||
instance
|
||||
) {
|
||||
return '<div class="foo">bar</div>';
|
||||
};
|
||||
},
|
||||
],
|
||||
scripts: ['https://docusaurus.io/slash.js'],
|
||||
stylesheets: ['https://docusaurus.io/style.css'],
|
||||
facebookAppId: '1615782811974223',
|
||||
facebookComments: true,
|
||||
facebookPixelId: '352490515235776',
|
||||
twitter: 'true',
|
||||
twitterUsername: 'docusaurus',
|
||||
twitterImage: 'img/docusaurus.png',
|
||||
ogImage: 'img/docusaurus.png',
|
||||
cleanUrl: true,
|
||||
scrollToTop: true,
|
||||
scrollToTopOptions: {
|
||||
zIndex: 100,
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = siteConfig;
|
||||
```
|
|
@ -0,0 +1,100 @@
|
|||
---
|
||||
id: version-1.2.1-installation
|
||||
title: Installation
|
||||
original_id: installation
|
||||
---
|
||||
|
||||
Docusaurus was designed from the ground up to be easily installed and used to get your website up and running quickly. To install Docusaurus, we have created an easy script that will get all of the infrastructure set up for you:
|
||||
|
||||
1. Ensure you have the latest version of [Node](https://nodejs.org/en/download/) installed. We also recommend you install [Yarn](https://yarnpkg.com/en/docs/install) as well.
|
||||
|
||||
> You have to be on Node >= 8.x and Yarn >= 1.5.
|
||||
|
||||
1. Go into the root of your GitHub repo directory where you will be creating the docs.
|
||||
1. `npx docusaurus-init`
|
||||
|
||||
> If you don't have Node 8.2+ or if you prefer to install Docusaurus globally, run `yarn global add docusaurus-init` or `npm install --global docusaurus-init`. After that, run `docusaurus-init`.
|
||||
|
||||
## Verifying Installation
|
||||
|
||||
Along with previously existing files and directories, your root directory will now contain a structure similar to:
|
||||
|
||||
```bash
|
||||
root-directory
|
||||
├── docs-examples-from-docusaurus
|
||||
│ ├── doc1.md
|
||||
│ ├── doc2.md
|
||||
│ ├── doc3.md
|
||||
│ ├── exampledoc4.md
|
||||
│ └── exampledoc5.md
|
||||
└── website
|
||||
├── blog-examples-from-docusaurus
|
||||
│ ├── 2016-03-11-blog-post.md
|
||||
│ ├── 2017-04-10-blog-post-two.md
|
||||
│ ├── 2017-09-25-testing-rss.md
|
||||
│ ├── 2017-09-26-adding-rss.md
|
||||
│ └── 2017-10-24-new-version-1.0.0.md
|
||||
├── core
|
||||
│ └── Footer.js
|
||||
├── package.json
|
||||
├── pages
|
||||
├── sidebars.json
|
||||
├── siteConfig.js
|
||||
└── static
|
||||
```
|
||||
|
||||
Running the Docusaurus initialization script, `docusaurus-init`, produces a runnable, example website to base your site upon.
|
||||
|
||||
1. In your root, rename `docs-examples-from-docusaurus` to `docs`.
|
||||
1. `cd website`
|
||||
1. Rename `blog-examples-from-docusaurus` to `blog`.
|
||||
1. Run the local webserver via `yarn start` or `npm start`.
|
||||
1. Load the example site at http://localhost:3000. You should see the example site loaded in your web browser. There's also a LiveReload server running and any changes made to the docs and files in the `website` directory will cause the page to refresh.
|
||||
|
||||

|
||||
|
||||
### Launching the server behind a proxy
|
||||
|
||||
If you are behind a corporate proxy, you need to disable it for the development server requests. It can be done using the `NO_PROXY` environment variable.
|
||||
|
||||
```sh
|
||||
SET NO_PROXY=localhost
|
||||
yarn start (or npm run start)
|
||||
```
|
||||
|
||||
## Updating Your Docusaurus Version
|
||||
|
||||
After Docusaurus is installed, moving forward, you can check your current version of Docusaurus by going into the `website` directory and typing `yarn outdated docusaurus` or `npm outdated docusaurus`.
|
||||
|
||||
You will see something like this:
|
||||
|
||||
```
|
||||
$ yarn outdated
|
||||
Using globally installed version of Yarn
|
||||
yarn outdated v1.5.1
|
||||
warning package.json: No license field
|
||||
warning No license field
|
||||
info Color legend :
|
||||
"<red>" : Major Update backward-incompatible updates
|
||||
"<yellow>" : Minor Update backward-compatible features
|
||||
"<green>" : Patch Update backward-compatible bug fixes
|
||||
Package Current Wanted Latest Package Type URL
|
||||
docusaurus 1.0.9 1.2.0 1.2.0 devDependencies https://github.com/facebook/Docusaurus#readme
|
||||
✨ Done in 0.41s.
|
||||
```
|
||||
|
||||
> If there is no noticeable version output from the `outdated` commands, then you are up-to-date.
|
||||
|
||||
You can update to the [latest version](https://www.npmjs.com/package/docusaurus) of Docusaurus by:
|
||||
|
||||
```
|
||||
yarn upgrade docusaurus --latest
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```
|
||||
npm update docusaurus
|
||||
```
|
||||
|
||||
> If you are finding that you are getting errors after your upgrade, try to either clear your Babel cache (usually it's in a [temporary directory](https://babeljs.io/docs/en/babel-register/#environment-variables) or run the Docusaurus server (e.g., `yarn start`) with the `BABEL_DISABLE_CACHE=1` environment configuration.
|
|
@ -0,0 +1,219 @@
|
|||
---
|
||||
id: version-1.2.1-publishing
|
||||
title: Publishing your site
|
||||
original_id: publishing
|
||||
---
|
||||
|
||||
You should now have a [site up and running locally](getting-started-site-creation.md). Once you have [customized](api-site-config.md) it to your liking, it's time to publish it. Docusaurus generates a static HTML website that is ready to be served by your favorite web server or online hosting solution.
|
||||
|
||||
## Building Static HTML Pages
|
||||
|
||||
To create a static build of your website, run the following script from the `website` directory:
|
||||
|
||||
```bash
|
||||
yarn run build # or `npm run build`
|
||||
```
|
||||
|
||||
This will generate a `build` directory inside the `website` directory containing the `.html` files from all of your docs and other pages included in `pages`.
|
||||
|
||||
## Hosting Static HTML Pages
|
||||
|
||||
At this point, you can grab all of the files inside the `website/build` directory and copy them over to your favorite web server's `html` directory.
|
||||
|
||||
> For example, both Apache and nginx serve content from `/var/www/html` by default. That said, choosing a web server or provider is outside the scope of Docusaurus.
|
||||
|
||||
> When serving the site from your own web server, ensure the web server is serving the asset files with the proper HTTP headers. CSS files should be served with the `content-type` header of `text/css`. In the case of nginx, this would mean setting `include /etc/nginx/mime.types;` in your `nginx.conf` file. See [this issue](https://github.com/facebook/Docusaurus/issues/602) for more info.
|
||||
|
||||
### Hosting on a Service:
|
||||
|
||||
* [GitHub Pages](#using-github-pages)
|
||||
* [Netlify](#hosting-on-netlify)
|
||||
|
||||
### Using GitHub Pages
|
||||
|
||||
While choosing a web server or host is outside Docusaurus' scope, Docusaurus was designed to work really well with one of the most popular hosting solutions for open source projects: [GitHub Pages](https://pages.github.com/).
|
||||
|
||||
Deploying your Docusaurus site to GitHub Pages is straightforward if you are already using GitHub to host your project. Your code repository does not even need to be public.
|
||||
|
||||
> Even if your repository is private, anything published to a `gh-pages` branch will be [public](https://help.github.com/articles/user-organization-and-project-pages/).
|
||||
|
||||
Most of the work to publish to GitHub pages is done for you automatically through the [`publish-gh-pages`](./api-commands.md#docusaurus-publish) script. You just need to determine the values for a few parameters required by the script.
|
||||
|
||||
Two of the required parameters are set in the [`siteConfig.js`](api-site-config.md):
|
||||
|
||||
| Name | Description |
|
||||
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `organizationName` | The GitHub user or organization that owns the repository. In the case of Docusaurus, that would be the "facebook" GitHub organization. |
|
||||
| `projectName` | The name of the GitHub repository for your project. For example, Docusaurus is hosted at https://github.com/facebook/docusaurus, so our project name in this case would be "docusaurus". |
|
||||
|
||||
> Docusaurus also supports deploying [user or organization sites](https://help.github.com/articles/user-organization-and-project-pages/#user--organization-pages). To do this, just set `projectName` to "_username_.github.io" (where _username_ is your username or organization name on GitHub) and `organizationName` to "_username_".
|
||||
> For user or org sites, the publish script will deploy these sites to the root of the `master` branch of the _username_.github.io repo. In this case, note that you will want to have the Docusaurus infra, your docs, etc. either in another branch of the _username_.github.io repo (e.g., maybe call it `source`), or in another, separated repo (e.g. in the same as the documented source code).
|
||||
|
||||
> While we recommend setting the `projectName` and `organizationName` in `siteConfig.js`, you can also use environment variables `ORGANIZATION_NAME` and `PROJECT_NAME`.
|
||||
|
||||
One of the required parameters is set as a environment variable:
|
||||
|
||||
| Name | Description |
|
||||
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `GIT_USER` | The username for a GitHub account that has commit access to this repo. For your own repositories, this will usually be your own GitHub username. |
|
||||
|
||||
There are also two optional parameters that are set as environment variables:
|
||||
|
||||
| Name | Description |
|
||||
| ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `USE_SSH` | If this is set to `true`, then SSH is used instead of HTTPS for the connection to the GitHub repo. HTTPS is the default if this variable is not set. |
|
||||
| `CURRENT_BRANCH` | The branch that contains the latest docs changes that will be deployed. Usually, the branch will be `master`, but it could be any branch (default or otherwise) except for `gh-pages`. If nothing is set for this variable, then the current branch will be used. |
|
||||
|
||||
Once you have the parameter value information, you can go ahead and run the publish script, ensuring you have inserted your own values inside the various parameter placeholders:
|
||||
|
||||
To run the script directly from the command-line, you can use the following, filling in the parameter values as appropriate. If you run into issues related to SSH keys, visit [GitHub's authentication documentation](https://help.github.com/articles/connecting-to-github-with-ssh/).
|
||||
|
||||
```bash
|
||||
GIT_USER=<GIT_USER> \
|
||||
CURRENT_BRANCH=master \
|
||||
USE_SSH=true \
|
||||
yarn run publish-gh-pages # or `npm run publish-gh-pages`
|
||||
```
|
||||
|
||||
> The specified `GIT_USER` must have push access to the repository specified in the combination of `organizationName` and `projectName`.
|
||||
|
||||
You should now be able to load your website by visiting its GitHub Pages URL, which could be something along the lines of https://_username_.github.io/_projectName_, or a custom domain if you have set that up. For example, Docusaurus' own GitHub Pages URL is https://facebook.github.io/Docusaurus (it can also be accessed via https://docusaurus.io/), because it is served from the `gh-pages` branch of the https://github.com/facebook/docusaurus GitHub repository. We highly encourage reading through the [GitHub Pages documentation](https://pages.github.com) to learn more about how this hosting solution works.
|
||||
|
||||
You can run the command above any time you update the docs and wish to deploy the changes to your site. Running the script manually may be fine for sites where the documentation rarely changes and it is not too much of an inconvenience to remember to manually deploy changes.
|
||||
|
||||
However, you can automate the publishing process with continuous integration (CI).
|
||||
|
||||
## Automating Deployments Using Continuous Integration
|
||||
|
||||
Continuous integration (CI) services are typically used to perform routine tasks whenever new commits are checked in to source control. These tasks can be any combination of running unit tests and integration tests, automating builds, publishing packages to NPM, and yes, deploying changes to your website. All you need to do to automate deployment of your website is to invoke the `publish-gh-pages` script whenever your docs get updated. In the following section we'll be covering how to do just that using [Circle CI](https://circleci.com/), a popular continuous integration service provider.
|
||||
|
||||
### Using Circle CI 2.0
|
||||
|
||||
If you haven't done so already, you can [setup CircleCI](https://circleci.com/signup/) for your open source project. Afterwards, in order to enable automatic deployment of your site and documentation via CircleCI, just configure Circle to run the `publish-gh-pages` script as part of the deployment step. You can follow the steps below to get that setup.
|
||||
|
||||
1. Ensure the GitHub account that will be set as the `GIT_USER` has `write` access to the repository that contains the documentation, by checking `Settings | Collaborators & teams` in the repository.
|
||||
1. Log into GitHub as the `GIT_USER`.
|
||||
1. Go to https://github.com/settings/tokens for the `GIT_USER` and generate a new [personal access token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/), granting it full control of private repositories through the `repository` access scope. Store this token in a safe place, making sure to not share it with anyone. This token can be used to authenticate GitHub actions on your behalf in place of your GitHub password.
|
||||
1. Open your Circle CI dashboard, and navigate to the Settings page for your repository, then select "Environment variables". The URL looks like https://circleci.com/gh/ORG/REPO/edit#env-vars, where "ORG/REPO" should be replaced with your own GitHub organization/repository.
|
||||
1. Create a new environment variable named `GITHUB_TOKEN`, using your newly generated access token as the value.
|
||||
1. Create a `.circleci` directory and create a `config.yml` under that directory.
|
||||
1. Copy the text below into `.circleci/config.yml`.
|
||||
|
||||
```yaml
|
||||
# If you only want circle to run on direct commits to master, you can uncomment this out
|
||||
# and uncomment the filters: *filter-only-master down below too
|
||||
#
|
||||
# aliases:
|
||||
# - &filter-only-master
|
||||
# branches:
|
||||
# only:
|
||||
# - master
|
||||
|
||||
version: 2
|
||||
jobs:
|
||||
deploy-website:
|
||||
docker:
|
||||
# specify the version you desire here
|
||||
- image: circleci/node:8.11.1
|
||||
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Deploying to GitHub Pages
|
||||
command: |
|
||||
git config --global user.email "<GITHUB_USERNAME>@users.noreply.github.com"
|
||||
git config --global user.name "<YOUR_NAME>"
|
||||
echo "machine github.com login <GITHUB_USERNAME> password $GITHUB_TOKEN" > ~/.netrc
|
||||
cd website && yarn install && GIT_USER=<GIT_USER> yarn run publish-gh-pages
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
build_and_deploy:
|
||||
jobs:
|
||||
- deploy-website:
|
||||
# filters: *filter-only-master
|
||||
```
|
||||
|
||||
Make sure to replace all `<....>` in the `command:` sequence with appropriate values. For `<GIT_USER>`, it should be a GitHub account that has access to push documentation to your GitHub repository. Many times `<GIT_USER>` and `<GITHUB_USERNAME>` will be the same.
|
||||
|
||||
**DO NOT** place the actual value of `$GITHUB_TOKEN` in `circle.yml`. We already configured that as an environment variable back in Step 3.
|
||||
|
||||
> If you want to use SSH for your GitHub repository connection, you can set `USE_SSH=true`. So the above command would look something like: `cd website && npm install && GIT_USER=<GIT_USER> USE_SSH=true npm run publish-gh-pages`.
|
||||
|
||||
> Unlike when you run the `publish-gh-pages` script manually, when the script runs within the Circle environment, the value of `CURRENT_BRANCH` is already defined as an [environment variable within CircleCI](https://circleci.com/docs/1.0/environment-variables/) and will be picked up by the script automatically.
|
||||
|
||||
Now, whenever a new commit lands in `master`, CircleCI will run your suite of tests and, if everything passes, your website will be deployed via the `publish-gh-pages` script.
|
||||
|
||||
> If you would rather use a deploy key instead of a personal access token, you can by starting with the Circle CI [instructions](https://circleci.com/docs/1.0/adding-read-write-deployment-key/) for adding a read/write deploy key.
|
||||
|
||||
### Tips & Tricks
|
||||
|
||||
When initially deploying to a `gh-pages` branch using Circle CI, you may notice that some jobs triggered by commits to the `gh-pages` branch fail to run successfully due to a lack of tests. You can easily work around this by creating a basic Circle CI config with the following contents:
|
||||
|
||||
```yaml
|
||||
# Circle CI 2.0 Config File
|
||||
# This config file will prevent tests from being run on the gh-pages branch.
|
||||
version: 2
|
||||
jobs:
|
||||
build:
|
||||
machine: true
|
||||
branches:
|
||||
ignore: gh-pages
|
||||
steps:
|
||||
- run: echo "Skipping tests on gh-pages branch"
|
||||
```
|
||||
|
||||
Save this file as `config.yml` and place it in a `.circleci` directory inside your `website/static` directory.
|
||||
|
||||
### Using Travis CI
|
||||
|
||||
1. Go to https://github.com/settings/tokens and generate a new [personal access token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/)
|
||||
1. Using your GitHub account, [add the Travis CI app](https://github.com/marketplace/travis-ci) to the repository you want to activate.
|
||||
1. Open your Travis CI dashboard. The URL looks like https://travis-ci.com/USERNAME/REPO, and navigate to the `More options` > `Setting` > `Environment Variables` section of your repository.
|
||||
1. Create a new environment variable named `GH_TOKEN` with your newly generated token as its value, then `GH_EMAIL` (your email address) and `GH_NAME` (your GitHub username).
|
||||
1. Create a `.travis.yml` on the root of your repository with below text.
|
||||
|
||||
```yaml
|
||||
# .travis.yml
|
||||
language: node_js
|
||||
node_js:
|
||||
- '8'
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
cache:
|
||||
yarn: true
|
||||
script:
|
||||
- git config --global user.name "${GH_NAME}"
|
||||
- git config --global user.email "${GH_EMAIL}"
|
||||
- echo "machine github.com login ${GH_NAME} password ${GH_TOKEN}" > ~/.netrc
|
||||
- cd website && yarn install && GIT_USER="${GH_NAME}" yarn run publish-gh-pages
|
||||
```
|
||||
|
||||
Now, whenever a new commit lands in `master`, Travis CI will run your suite of tests and, if everything passes, your website will be deployed via the `publish-gh-pages` script.
|
||||
|
||||
### Hosting on Netlify
|
||||
|
||||
Steps to configure your Docusaurus-powered site on Netlify.
|
||||
|
||||
1. Select **New site from Git**
|
||||
1. Connect to your preferred Git provider.
|
||||
1. Select the branch to deploy. Default is `master`
|
||||
1. Configure your build steps:
|
||||
|
||||
* For your build command enter: `cd website; npm install; npm run build;`
|
||||
* For publish directory: `website/build/<projectName>` (use the `projectName` from your `siteConfig`)
|
||||
|
||||
1. Click **Deploy site**
|
||||
|
||||
You can also configure Netlify to rebuild on every commit to your repository, or only `master` branch commits.
|
||||
|
||||
### Publishing to GitHub Enterprise
|
||||
|
||||
GitHub enterprise installations should work in the same manner as github.com; you only need to identify the organization's GitHub Enterprise host.
|
||||
|
||||
| Name | Description |
|
||||
| ------------- | ---------------------------------------------- |
|
||||
| `GITHUB_HOST` | The hostname for the GitHub enterprise server. |
|
||||
|
||||
Alter your `siteConfig.js` to add a property `'githubHost'` which represents the GitHub Enterprise hostname. Alternatively, set an environment variable `GITHUB_HOST` when executing the publish command.
|
138
website/versioned_docs/version-1.2.1/guides-blog.md
Normal file
138
website/versioned_docs/version-1.2.1/guides-blog.md
Normal file
|
@ -0,0 +1,138 @@
|
|||
---
|
||||
id: version-1.2.1-blog
|
||||
title: Adding a Blog
|
||||
original_id: blog
|
||||
---
|
||||
|
||||
## Initial Setup
|
||||
|
||||
To setup your site's blog, start by creating a `blog` directory within your repo's `website` directory.
|
||||
|
||||
Then, add a header link to your blog within `siteConfig.js`:
|
||||
|
||||
```js
|
||||
headerLinks: [
|
||||
...
|
||||
{ blog: true, label: 'Blog' },
|
||||
...
|
||||
]
|
||||
```
|
||||
|
||||
## Adding Posts
|
||||
|
||||
To publish in the blog, create a file within the blog directory with a formatted name of `YYYY-MM-DD-My-Blog-Post-Title.md`. The post date is extracted from the file name.
|
||||
|
||||
For example, at `website/blog/2017-08-18-Introducing-Docusaurus.md`:
|
||||
|
||||
```yml
|
||||
---
|
||||
author: Frank Li
|
||||
authorURL: https://twitter.com/foobarbaz
|
||||
authorFBID: 503283835
|
||||
title: Introducing Docusaurus
|
||||
---
|
||||
|
||||
Lorem Ipsum...
|
||||
```
|
||||
|
||||
## Header Options
|
||||
|
||||
The only required field is `title`; however, we provide options to add author information to your blog post as well.
|
||||
|
||||
* `author` - The text label of the author byline.
|
||||
* `authorURL` - The URL associated with the author. This could be a Twitter, GitHub, Facebook account, etc.
|
||||
* `authorFBID` - The Facebook profile ID that is used to fetch the profile picture.
|
||||
* `authorImageURL` - The URL to the author's image. (Note: If you use both `authorFBID` and `authorImageURL`, `authorFBID` will take precedence. Don't include `authorFBID` if you want `authorImageURL` to appear.)
|
||||
* `title` - The blog post title.
|
||||
|
||||
## Summary Truncation
|
||||
|
||||
Use the `<!--truncate-->` marker in your blog post to represent what will be shown as the summary when viewing all published blog posts. Anything above `<!--truncate-->` will be part of the summary. For example:
|
||||
|
||||
```yaml
|
||||
---
|
||||
title: Truncation Example
|
||||
---
|
||||
|
||||
All this will be part of the blog post summary.
|
||||
|
||||
Even this.
|
||||
|
||||
<!--truncate-->
|
||||
|
||||
But anything from here on down will not be.
|
||||
|
||||
Not this.
|
||||
|
||||
Or this.
|
||||
```
|
||||
|
||||
## Changing How Many Blog Posts Show on Sidebar
|
||||
|
||||
By default, 5 recent blog posts are shown on the sidebar.
|
||||
|
||||
You can configure a specific amount of blog posts to show by adding a `blogSidebarCount` setting to your `siteConfig.js`.
|
||||
|
||||
The available options are an integer representing the number of posts you wish to show or a string with the value `'ALL'`.
|
||||
|
||||
Example:
|
||||
|
||||
```js
|
||||
blogSidebarCount: 'ALL';
|
||||
```
|
||||
|
||||
## Changing The Sidebar Title
|
||||
|
||||
You can configure a specific sidebar title by adding a `blogSidebarTitle` setting to your `siteConfig.js`.
|
||||
|
||||
The option is an object which can have the keys `default` and `all`. Specifying a value for `default` allows you to change the default sidebar title. Specifying a value for `all` allows you to change the sidebar title when the `blogSidebarCount` option is set to `'ALL'`.
|
||||
|
||||
Example:
|
||||
|
||||
```js
|
||||
blogSidebarTitle: { default: 'Recent posts', all: 'All blog posts' },
|
||||
```
|
||||
|
||||
## RSS Feed
|
||||
|
||||
Docusaurus provides a simple RSS feed for your blog posts. Both RSS and Atom feed formats are supported. This data is automatically to your website page's HTML <HEAD> tag.
|
||||
|
||||
A summary of the post's text is provided in the RSS feed up to the `<!--truncate-->`. If no `<!--truncate-->` tag is found, then all text up 250 characters are used.
|
||||
|
||||
## Social Buttons
|
||||
|
||||
If you want Facebook and/or Twitter social buttons at the bottom of your blog posts, set the `facebookAppId` and/or `twitter` [site configuration](api-site-config.md) options in `siteConfig.js`.
|
||||
|
||||
## Advanced Topics
|
||||
|
||||
### I want to run in "Blog Only" mode.
|
||||
|
||||
You can run your Docusaurus site without a landing page and instead have your blog load first.
|
||||
|
||||
To do this:
|
||||
|
||||
1. Create a file `index.html` in `website/static/`.
|
||||
1. Place the contents of the template below into `website/static/index.html`
|
||||
1. Customize the `<title>` of `website/static/index.html`
|
||||
1. Delete the dynamic landing page `website/pages/en/index.js`
|
||||
|
||||
> Now, when Docusaurus generates or builds your site, it will copy the file from `static/index.html` and place it in the site's main directory. The static file is served when a visitor arrives on your page. When the page loads it will redirect the visitor to `/blog`.
|
||||
|
||||
You can use this template:
|
||||
|
||||
```html
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en-US">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="refresh" content="0; url=blog/">
|
||||
<script type="text/javascript">
|
||||
window.location.href = 'blog/';
|
||||
</script>
|
||||
<title>Title of Your Blog</title>
|
||||
</head>
|
||||
<body>
|
||||
If you are not redirected automatically, follow this <a href="blog/">link</a>.
|
||||
</body>
|
||||
</html>
|
||||
```
|
69
website/versioned_docs/version-1.2.1/guides-search.md
Normal file
69
website/versioned_docs/version-1.2.1/guides-search.md
Normal file
|
@ -0,0 +1,69 @@
|
|||
---
|
||||
id: version-1.2.1-search
|
||||
title: Enabling Search
|
||||
original_id: search
|
||||
---
|
||||
|
||||
Docusaurus supports search using [Algolia DocSearch](https://community.algolia.com/docsearch/). Once your website is online, you can [submit it to DocSearch](https://community.algolia.com/docsearch/). Algolia will then send you credentials you can add to your `siteConfig.js`.
|
||||
|
||||
DocSearch works by crawling the content of your website every 24 hours and putting all the content in an Algolia index. This content is then queried directly from your front-end using the Algolia API. Note that your website need to be publicly available for this to work (ie. not behind a firewall). This service is free.
|
||||
|
||||
## Enabling the Search Bar
|
||||
|
||||
Enter your API key and index name (sent by Algolia) into `siteConfig.js` in the `algolia` section to enable search for your site.
|
||||
|
||||
```js
|
||||
const siteConfig = {
|
||||
...
|
||||
algolia: {
|
||||
apiKey: 'my-api-key',
|
||||
indexName: 'my-index-name',
|
||||
algoliaOptions: {} // Optional, if provided by Algolia
|
||||
},
|
||||
...
|
||||
};
|
||||
```
|
||||
|
||||
## Extra Search Options
|
||||
|
||||
You can also specify extra [search options used by Algolia](https://community.algolia.com/docsearch/documentation/) by using an `algoliaOptions` field in `algolia`. This may be useful if you want to provide different search results for the different versions or languages of your docs. Any occurrences of "VERSION" or "LANGUAGE" will be replaced by the version or language of the current page, respectively. More details about search options can be [found here](https://www.algolia.com/doc/api-reference/api-parameters/#overview).
|
||||
|
||||
```js
|
||||
const siteConfig = {
|
||||
...
|
||||
algolia: {
|
||||
...
|
||||
algoliaOptions: {
|
||||
facetFilters: [ "lang:LANGUAGE", "version:VERSION" ]
|
||||
}
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
Algolia might provide you with [extra search options](https://community.algolia.com/docsearch/documentation/). If so, you should add them to the `algoliaOptions` object.
|
||||
|
||||
## Controlling the Location of the Search Bar
|
||||
|
||||
By default, the search bar will be the rightmost element in the top navigation bar.
|
||||
|
||||
If you want to change the default location, add the `searchBar` flag in the `headerLinks` field of `siteConfig.js` in your desired location. For example, you may want the search bar between your internal and external links.
|
||||
|
||||
```js
|
||||
const siteConfig = {
|
||||
...
|
||||
headerLinks: [
|
||||
{...}
|
||||
{...}
|
||||
{ search: true }
|
||||
{...}
|
||||
{...}
|
||||
],
|
||||
...
|
||||
};
|
||||
```
|
||||
|
||||
## Disabling the Search Bar
|
||||
|
||||
To disable the search bar, comment out (recommended) or delete the `algolia` section in the `siteConfig.js` file.
|
||||
|
||||
Also, if you have customized the location of the search bar in `headerLinks`, set `search: false`.
|
282
website/versioned_docs/version-1.2.1/guides-translation.md
Normal file
282
website/versioned_docs/version-1.2.1/guides-translation.md
Normal file
|
@ -0,0 +1,282 @@
|
|||
---
|
||||
id: version-1.2.1-translation
|
||||
title: Translations & Localization
|
||||
original_id: translation
|
||||
---
|
||||
|
||||
Docusaurus allows for easy translation functionality using [Crowdin](https://crowdin.com/). Documentation files written in English are uploaded to Crowdin for translation by users within a community. Top-level pages written with English strings can be translated by wrapping any strings you want to translate in a `<translate>` tag. Other titles and labels will also be found and properly translated.
|
||||
|
||||
## Docusaurus Translation Configurations
|
||||
|
||||
To generate example files for translations with Docusaurus, run the `examples` script with the command line argument `translations`:
|
||||
|
||||
```bash
|
||||
npm run examples translations
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```bash
|
||||
yarn examples translations
|
||||
```
|
||||
|
||||
This will create the following files:
|
||||
|
||||
```bash
|
||||
pages/en/help-with-translations.js
|
||||
languages.js
|
||||
../crowdin.yaml
|
||||
```
|
||||
|
||||
* The `pages/en/help-with-translations.js` file includes the same starter help page generated by the `examples` script, but now includes translation tags.
|
||||
|
||||
> Generally, you will use `help-with-translations.js` as a guide to enable translations in your other pages, but not actually commit the file to your repo (i.e., you can delete it). However, if you want a Help page, and you currently do not have one, you can rename this file to `help.js` and use it as a starting point.
|
||||
|
||||
* The `languages.js` file tells Docusaurus what languages you want to enable for your site. By default, we expect English to be enabled.
|
||||
|
||||
* The `crowdin.yaml` file is used to configure Crowdin integration, and is copied up one level into your Docusaurus project repo. If your Docusaurus project resides in `/project/website`, then `crowdin.yaml` will be copied to `/project/crowdin.yaml`.
|
||||
|
||||
## Translating Your Existing Docs
|
||||
|
||||
Your documentation files (e.g., the `.md` files that live in your `docs` directory) do not need to be changed or moved to support translations. They will be uploaded to Crowdin to be translated directly.
|
||||
|
||||
## Enabling Translations on Pages
|
||||
|
||||
Pages allow you to customize layout and specific content of pages like a custom index page or help page.
|
||||
|
||||
Pages with text that you want translated should be placed in `website/pages/en` directory.
|
||||
|
||||
Wrap strings you want translated in a `<translate>` tag, and add the following `require` statement to the top of the file:
|
||||
|
||||
```jsx
|
||||
...
|
||||
const translate = require('../../server/translate.js').translate;
|
||||
...
|
||||
<h2>
|
||||
<translate>This header will be translated</translate>
|
||||
</h2>
|
||||
...
|
||||
```
|
||||
|
||||
You can also include an optional description attribute to give more context to a translator about how to translate the string:
|
||||
|
||||
```jsx
|
||||
<p>
|
||||
<translate desc="flower, not verb">Rose</translate>
|
||||
<p>
|
||||
```
|
||||
|
||||
> The `<translate>` tag generally works well on pure strings. If you have a string like "Docusaurus currently provides support to help your website use [translations](${siteConfig.baseUrl}docs/${this.props.language}/translation.html)", wrapping the `<translation>` tag around that entire string will cause issues because of the markdown linking, etc. Your options are to not translate those strings, or spread a bunch of `<translate>` tags amongst the pure substrings of that string.
|
||||
|
||||
## Gathering Strings to Translate
|
||||
|
||||
The strings within localized Pages must be extracted and provided to Crowdin.
|
||||
|
||||
Add the following script to your `website/package.json` file, if it does not exist already:
|
||||
|
||||
```js
|
||||
{
|
||||
...
|
||||
"scripts": {
|
||||
"write-translations": "docusaurus-write-translations"
|
||||
},
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
Running the script will generate a `website/i18n/en.json` file containing all the strings that will be translated from English into other languages.
|
||||
|
||||
The script will include text from the following places:
|
||||
|
||||
* `title` and `sidebar_label` strings in document markdown headers
|
||||
* category names in `sidebars.json`
|
||||
* tagline in `siteConfig.js`
|
||||
* header link `label` strings in `siteConfig.js`
|
||||
* strings wrapped in the `<translate>` tag in any `.js` files inside `pages`
|
||||
|
||||
### Custom Translation Strings
|
||||
|
||||
If you want to add additional custom translation strings, or override any of the strings that get produced by the script that creates the `website/i18n/en.json` file, you can add a `website/data/custom-translation-strings.json` file. The file should have form of:
|
||||
|
||||
```json
|
||||
{
|
||||
"localized-strings": {
|
||||
"id": "string",
|
||||
"id2": "string2"
|
||||
},
|
||||
"pages-strings" : {
|
||||
"id3": "string3",
|
||||
"id4": "string4"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
where `localized-strings` represent strings in your documentation content and `pages-strings` represents metadata in your documentation (e.g., title, links, etc).
|
||||
|
||||
Here is an example:
|
||||
|
||||
```json
|
||||
{
|
||||
"_comment": "This file is used to provide custom strings for translations, including overriding defaults",
|
||||
"localized-strings": {
|
||||
"translation": "Translations and Localization"
|
||||
},
|
||||
"pages-strings" : {
|
||||
"Help Translate|recruit community translators for your project": "Help Us Translate"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
See the generated `website/i18n/en.json` for an example.
|
||||
|
||||
## How Strings Get Translated
|
||||
|
||||
Docusaurus itself does not do any translation from one language to another. Instead, it integrates [Crowdin](https://crowdin.com/) to upload translations and then downloads the appropriately translated files from Crowdin.
|
||||
|
||||
## How Docusaurus Uses String Translations
|
||||
|
||||
This section provides context about how translations in Docusaurus works.
|
||||
|
||||
### Strings
|
||||
|
||||
A Docusaurus site has many strings used throughout it that require localization. However, maintaining a list of strings used through out a site can be laborious. Docusaurus simplifies this by centralizing strings.
|
||||
|
||||
The header navigation, for example can have links to 'Home' or your 'Blog'. This and other strings found in the headers and sidebars of pages are extracted and placed into `i18n/en.json`. When your files are translated, say into Spanish, a `i18n/es-ES.json` file will be downloaded from Crowdin. Then, when the Spanish pages are generated, Docusaurus will replace the English version of corresponding strings with translated strings from the corresponding localized strings file (e.g. In a Spanish enabled site 'Help' will become 'Ayuda').
|
||||
|
||||
### Markdown Files
|
||||
|
||||
For documentation files themselves, translated versions of these files are downloaded and then rendered through the proper layout template.
|
||||
|
||||
### Other Pages
|
||||
|
||||
For other pages, Docusaurus will automatically transform all `<translate>` tags it finds into function calls that return the translated strings from the corresponding localized file _`locale.json`_.
|
||||
|
||||
## Crowdin
|
||||
|
||||
Crowdin is a company that provides translation services. For Open Source projects, Crowdin provides free string translations.
|
||||
|
||||
Create your translation project on [Crowdin](https://crowdin.com/). You can use [Crowdin's guides](https://support.crowdin.com/translation-process-overview/) to learn more about the translations work flow. _We suggest that you deselect and do not include "English" as a translatable language to prevent the creation of `en-US` localization files as this can lead to confusion._
|
||||
|
||||
> Ensure in your Crowdin settings, in the Translations section, that "Duplicate Strings" are set to ["Hide - all duplicates will share the same translation"](https://support.crowdin.com/api/create-project/). This setting will ensure that identical strings between versions share a single translation.
|
||||
|
||||
Your project will need a `crowdin.yaml` file generated. If you ran `yarn examples translations` or `npm run examples translations`, this file was created for you on the same level as your `website` directory.
|
||||
|
||||
> You will need to install the `crowdin` command line interface. Please follow the [installation directions](https://support.crowdin.com/cli-tool/).
|
||||
|
||||
The example below can be automatically generated by the Docusaurus cli with the `examples` script. It should be placed in the top level of your project directory to configure how and what files are uploaded/downloaded.
|
||||
|
||||
Below is an example Crowdin configuration for the respective languages: German, Spanish, French, Japanese, Korean, Bahasa Indonesia, Portuguese Brazilian, Chinese Simplified, and Chinese Traditional.
|
||||
|
||||
```yaml
|
||||
project_identifier_env: CROWDIN_DOCUSAURUS_PROJECT_ID
|
||||
api_key_env: CROWDIN_DOCUSAURUS_API_KEY
|
||||
base_path: "./"
|
||||
preserve_hierarchy: true
|
||||
|
||||
files:
|
||||
-
|
||||
source: '/docs/**/*.md'
|
||||
translation: '/website/translated_docs/%locale%/**/%original_file_name%'
|
||||
languages_mapping: &anchor
|
||||
locale:
|
||||
'de': 'de'
|
||||
'es-ES': 'es-ES'
|
||||
'fr': 'fr'
|
||||
'ja': 'ja'
|
||||
'ko': 'ko'
|
||||
'mr': 'mr-IN'
|
||||
'pt-BR': 'pt-BR'
|
||||
'zh-CN': 'zh-CN'
|
||||
'zh-TW': 'zh-TW'
|
||||
```
|
||||
|
||||
You can go [here](https://support.crowdin.com/configuration-file/) to learn more about customizing your `crowdin.yaml` file.
|
||||
|
||||
### Setup the Crowdin Scripts
|
||||
|
||||
You will want to manually sync your files to and from Crowdin. The sync process will upload any markdown files in `/docs` as well as translatable strings in `website/i18n/en.json`. (These strings can be generated by running `yarn write-translations`.)
|
||||
|
||||
You can add the following to your `package.json` to manually trigger Crowdin.
|
||||
|
||||
```js
|
||||
"scripts": {
|
||||
"crowdin-upload": "crowdin --config ../crowdin.yaml upload sources --auto-update -b master",
|
||||
"crowdin-download": "crowdin --config ../crowdin.yaml download -b master"
|
||||
},
|
||||
```
|
||||
|
||||
### Manual File Sync
|
||||
|
||||
You will always want to upload your markdown files and translatable strings first and the download the translations section. So run the commands in this order:
|
||||
|
||||
```bash
|
||||
CROWDIN_DOCUSAURUS_PROJECT_ID=YOUR_CROWDIN_PROJECT_ID CROWDIN_DOCUSAURUS_API_KEY=YOUR_CROWDIN_API_KEY yarn run crowdin-upload
|
||||
CROWDIN_DOCUSAURUS_PROJECT_ID=YOUR_CROWDIN_PROJECT_ID CROWDIN_DOCUSAURUS_API_KEY=YOUR_CROWDIN_API_KEY yarn run crowdin-download
|
||||
```
|
||||
|
||||
> `YOUR_CROWDIN_PROJECT_ID` is the name of your Crowdin project. e.g., for https://crowdin.com/project/docusaurus/, that variable would be set to `docusaurus`. `YOUR_CROWDIN_API_KEY` is a unique key that is like a password. You can find it in the `API` tab of your Crowdin project's `Settings`.
|
||||
|
||||
> These commands require having an environment variable set with your Crowdin project id and api key (`CROWDIN_PROJECT_ID`, `CROWDIN_API_KEY`). You can preface them inline as done above or add them permanently to your `.bashrc` or `.bash_profile`.
|
||||
|
||||
> If you run more than one localized Docusaurus project on your computer, you should change the name of the environment variables to something unique (`CROWDIN_PROJECTNAME_PROJECT_ID`, `CROWDIN_PROJECTNAME_API_KEY`).
|
||||
|
||||
> Since the files are generated, you do not need to have any files in your `website/i18n` or `website/translated_docs` directory as part of your repo. So you can can add `website/i18n/*` and `website/translated_docs` to your `.gitignore` file.
|
||||
|
||||
### Automated File Sync Using CircleCI
|
||||
|
||||
You can automate pulling down and uploading translations for your files using the [CircleCI](https://circleci.com) web continuous integration service.
|
||||
|
||||
First, update the `circle.yml` file in your project directory to include steps to upload English files to be translated and download translated files using the Crowdin CLI. Here is an example `circle.yml` file:
|
||||
|
||||
```yaml
|
||||
machine:
|
||||
node:
|
||||
version: 6.10.3
|
||||
npm:
|
||||
version: 3.10.10
|
||||
|
||||
test:
|
||||
override:
|
||||
- "true"
|
||||
|
||||
deployment:
|
||||
website:
|
||||
branch: master
|
||||
commands:
|
||||
# configure git user
|
||||
- git config --global user.email "test-site-bot@users.noreply.github.com"
|
||||
- git config --global user.name "Website Deployment Script"
|
||||
- echo "machine github.com login test-site-bot password $GITHUB_TOKEN" > ~/.netrc
|
||||
# install Docusaurus and generate file of English strings
|
||||
- cd website && npm install && npm run write-translations && cd ..
|
||||
# crowdin install
|
||||
- sudo apt-get install default-jre
|
||||
- wget https://artifacts.crowdin.com/repo/deb/crowdin.deb -O crowdin.deb
|
||||
- sudo dpkg -i crowdin.deb
|
||||
# translations upload/download
|
||||
- crowdin --config crowdin.yaml upload sources --auto-update -b master
|
||||
- crowdin --config crowdin.yaml download -b master
|
||||
# build and publish website
|
||||
- cd website && GIT_USER=test-site-bot npm run publish-gh-pages
|
||||
```
|
||||
|
||||
The `crowdin` command uses the `crowdin.yaml` file generated with the `examples` script. It should be placed in your project directory to configure how and what files are uploaded/downloaded.
|
||||
|
||||
Note that in the `crowdin.yaml` file, `CROWDIN_PROJECT_ID` and `CROWDIN_API_KEY` are environment variables set-up in Circle for your Crowdin project. They can be found in your Crowdin project settings.
|
||||
|
||||
Now, Circle will help you automatically get translations prior to building your website. The provided `crowdin.yaml` file will copy translated documents into `website/translated_docs/`, and translated versions of the `i18n/en.json` strings file will into `i18n/${language}.json`.
|
||||
|
||||
If you wish to use Crowdin on your machine locally, you can install the [Crowdin CLI tool](https://support.crowdin.com/cli-tool/) and run the same commands found in the `circle.yaml` file. The only difference is that you must set `project_identifier` and `api_key` values in the `crowdin.yaml` file since you will not have Circle environment variables set up.
|
||||
|
||||
## Versioned Translations
|
||||
|
||||
If you wish to have translation and versioning for your documentation, add the following section to the end of your `crowdin.yaml` file:
|
||||
|
||||
```yaml
|
||||
-
|
||||
source: '/website/versioned_docs/**/*.md'
|
||||
translation: '/website/translated_docs/%locale%/**/%original_file_name%'
|
||||
languages_mapping: *anchor
|
||||
```
|
||||
|
||||
Translated, versioned documents will be copied into `website/translated_docs/${language}/${version}/`.
|
|
@ -1,4 +1,5 @@
|
|||
[
|
||||
"1.2.1",
|
||||
"1.2.0",
|
||||
"1.1.5",
|
||||
"1.1.4",
|
||||
|
|
60
yarn.lock
60
yarn.lock
|
@ -19,8 +19,8 @@
|
|||
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d"
|
||||
|
||||
"@types/node@*":
|
||||
version "10.3.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.3.2.tgz#3840ec6c12556fdda6e0e6d036df853101d732a4"
|
||||
version "10.3.3"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.3.3.tgz#8798d9e39af2fa604f715ee6a6b19796528e46c3"
|
||||
|
||||
abab@^1.0.3:
|
||||
version "1.0.4"
|
||||
|
@ -1139,12 +1139,12 @@ caniuse-api@^1.5.2:
|
|||
lodash.uniq "^4.5.0"
|
||||
|
||||
caniuse-db@^1.0.30000529, caniuse-db@^1.0.30000634, caniuse-db@^1.0.30000639:
|
||||
version "1.0.30000851"
|
||||
resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000851.tgz#8a0d3ca4dde72068560acc98bacf75a359e8d3e3"
|
||||
version "1.0.30000856"
|
||||
resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000856.tgz#fbebb99abe15a5654fc7747ebb5315bdfde3358f"
|
||||
|
||||
caniuse-lite@^1.0.30000844:
|
||||
version "1.0.30000851"
|
||||
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000851.tgz#3b498aebf9f92cf6cff4ab54d13b557c0b590533"
|
||||
version "1.0.30000856"
|
||||
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000856.tgz#ecc16978135a6f219b138991eb62009d25ee8daa"
|
||||
|
||||
capture-exit@^1.2.0:
|
||||
version "1.2.0"
|
||||
|
@ -1307,12 +1307,16 @@ collection-visit@^1.0.0:
|
|||
object-visit "^1.0.0"
|
||||
|
||||
color-convert@^1.3.0, color-convert@^1.9.0, color-convert@^1.9.1:
|
||||
version "1.9.1"
|
||||
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.1.tgz#c1261107aeb2f294ebffec9ed9ecad529a6097ed"
|
||||
version "1.9.2"
|
||||
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.2.tgz#49881b8fba67df12a96bdf3f56c0aab9e7913147"
|
||||
dependencies:
|
||||
color-name "^1.1.1"
|
||||
color-name "1.1.1"
|
||||
|
||||
color-name@^1.0.0, color-name@^1.1.1:
|
||||
color-name@1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.1.tgz#4b1415304cf50028ea81643643bd82ea05803689"
|
||||
|
||||
color-name@^1.0.0:
|
||||
version "1.1.3"
|
||||
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25"
|
||||
|
||||
|
@ -1921,8 +1925,8 @@ escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1
|
|||
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
|
||||
|
||||
escodegen@^1.6.1:
|
||||
version "1.9.1"
|
||||
resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.9.1.tgz#dbae17ef96c8e4bedb1356f4504fa4cc2f7cb7e2"
|
||||
version "1.10.0"
|
||||
resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.10.0.tgz#f647395de22519fbd0d928ffcf1d17e0dec2603e"
|
||||
dependencies:
|
||||
esprima "^3.1.3"
|
||||
estraverse "^4.2.0"
|
||||
|
@ -2169,8 +2173,8 @@ fb-watchman@^2.0.0:
|
|||
bser "^2.0.0"
|
||||
|
||||
fbjs@^0.8.16:
|
||||
version "0.8.16"
|
||||
resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.16.tgz#5e67432f550dc41b572bf55847b8aca64e5337db"
|
||||
version "0.8.17"
|
||||
resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.17.tgz#c4d598ead6949112653d6588b01a5cdcd9f90fdd"
|
||||
dependencies:
|
||||
core-js "^1.0.0"
|
||||
isomorphic-fetch "^2.1.1"
|
||||
|
@ -2178,7 +2182,7 @@ fbjs@^0.8.16:
|
|||
object-assign "^4.1.0"
|
||||
promise "^7.1.1"
|
||||
setimmediate "^1.0.5"
|
||||
ua-parser-js "^0.7.9"
|
||||
ua-parser-js "^0.7.18"
|
||||
|
||||
fd-slicer@~1.1.0:
|
||||
version "1.1.0"
|
||||
|
@ -2605,8 +2609,8 @@ gulp-decompress@^1.2.0:
|
|||
readable-stream "^2.0.2"
|
||||
|
||||
gulp-rename@^1.2.0:
|
||||
version "1.2.3"
|
||||
resolved "https://registry.yarnpkg.com/gulp-rename/-/gulp-rename-1.2.3.tgz#37b75298e9d3e6c0fe9ac4eac13ce3be5434646b"
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/gulp-rename/-/gulp-rename-1.3.0.tgz#2e789d8f563ab0c924eeb62967576f37ff4cb826"
|
||||
|
||||
gulp-sourcemaps@1.6.0:
|
||||
version "1.6.0"
|
||||
|
@ -4793,8 +4797,8 @@ pretty-format@^21.2.1:
|
|||
ansi-styles "^3.2.0"
|
||||
|
||||
prismjs@^1.14.0:
|
||||
version "1.14.0"
|
||||
resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.14.0.tgz#bbccfdb8be5d850d26453933cb50122ca0362ae0"
|
||||
version "1.15.0"
|
||||
resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.15.0.tgz#8801d332e472091ba8def94976c8877ad60398d9"
|
||||
optionalDependencies:
|
||||
clipboard "^2.0.0"
|
||||
|
||||
|
@ -4836,8 +4840,8 @@ pseudomap@^1.0.2:
|
|||
resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3"
|
||||
|
||||
psl@^1.1.24:
|
||||
version "1.1.27"
|
||||
resolved "https://registry.yarnpkg.com/psl/-/psl-1.1.27.tgz#2b2c77019db86855170d903532400bf71ee085b6"
|
||||
version "1.1.28"
|
||||
resolved "https://registry.yarnpkg.com/psl/-/psl-1.1.28.tgz#4fb6ceb08a1e2214d4fd4de0ca22dae13740bc7b"
|
||||
|
||||
punycode@^1.4.1:
|
||||
version "1.4.1"
|
||||
|
@ -4931,8 +4935,8 @@ react-dev-utils@^5.0.1:
|
|||
text-table "0.2.0"
|
||||
|
||||
react-dom@^16.4.0:
|
||||
version "16.4.0"
|
||||
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.4.0.tgz#099f067dd5827ce36a29eaf9a6cdc7cbf6216b1e"
|
||||
version "16.4.1"
|
||||
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.4.1.tgz#7f8b0223b3a5fbe205116c56deb85de32685dad6"
|
||||
dependencies:
|
||||
fbjs "^0.8.16"
|
||||
loose-envify "^1.1.0"
|
||||
|
@ -4944,8 +4948,8 @@ react-error-overlay@^4.0.0:
|
|||
resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-4.0.0.tgz#d198408a85b4070937a98667f500c832f86bd5d4"
|
||||
|
||||
react@^16.4.0:
|
||||
version "16.4.0"
|
||||
resolved "https://registry.yarnpkg.com/react/-/react-16.4.0.tgz#402c2db83335336fba1962c08b98c6272617d585"
|
||||
version "16.4.1"
|
||||
resolved "https://registry.yarnpkg.com/react/-/react-16.4.1.tgz#de51ba5764b5dbcd1f9079037b862bd26b82fe32"
|
||||
dependencies:
|
||||
fbjs "^0.8.16"
|
||||
loose-envify "^1.1.0"
|
||||
|
@ -5189,8 +5193,8 @@ resolve@1.1.7:
|
|||
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b"
|
||||
|
||||
resolve@^1.1.6:
|
||||
version "1.7.1"
|
||||
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.7.1.tgz#aadd656374fd298aee895bc026b8297418677fd3"
|
||||
version "1.8.0"
|
||||
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.8.0.tgz#a7f2ac27b78480ecc09c83782741d9f26e4f0c3e"
|
||||
dependencies:
|
||||
path-parse "^1.0.5"
|
||||
|
||||
|
@ -5995,7 +5999,7 @@ typedarray@^0.0.6:
|
|||
version "0.0.6"
|
||||
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
|
||||
|
||||
ua-parser-js@^0.7.9:
|
||||
ua-parser-js@^0.7.18:
|
||||
version "0.7.18"
|
||||
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.18.tgz#a7bfd92f56edfb117083b69e31d2aa8882d4b1ed"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue