Using Github Pages
Using Github Pages
Using Github Pages
Docusaurus was designed to work well with one of the most popular hosting solutions
for open source projects: GitHub Pages.
Deploying to GitHub Pages
1. Docusaurus supports deploying as project pages or user/organization pages, 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.
Note: When you deploy as user/organization page, 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, separate repo
(e.g. in the same as the documented source code).
2. You will need to modify the file website/siteConfig.js and add the required parameters.
Name Description
organizationNam The GitHub user or organization that owns the repository. If you are the owner, then it is your GitH
e username. In the case of Docusaurus, that would be the "facebook" GitHub organization.
The name of the GitHub repository for your project. For example, the source code for Docusaurus
projectName
hosted at https://github.com/facebook/docusaurus, so our project name, in this case, would be
"docusaurus".
url Your website's URL. For projects hosted on GitHub pages, this will be "https://username.github.io
Base URL for your project. For projects hosted on GitHub pages, it follows the format "/projectNa
baseUrl
For https://github.com/facebook/docusaurus, baseUrl is /docusaurus/.
const siteConfig = {
...
url: 'https://__userName__.github.io', // Your website URL
baseUrl: '/testProject/',
projectName: 'testProject',
organizationName: 'userName'
...
}
Copy
In case you want to deploy as a user or organization site, specify the project name
as <username>.github.io or <orgname>.github.io. E.g. If your GitHub username is "user42"
then user42.github.io, or in the case of an organization name of "org123", it will
be org123.github.io.