We use a docs-as-code approach to manage our documentation. The project relies on Git, Markdown and Docusaurus to create and maintain the site.
This repository contains a sample site built with these tools. You can view the built site at https://philstollery.github.io/github-usaurus.
Please can you do the following:
- Clone this repository to your machine, then push it to a private repository under your GitHub account.
- Complete the setup to deploy the website to GitHub Pages.
- Write a how-to tutorial using our template that:
- Explains how to deploy a Docusaurus website to GitHub Pages.
- Uses step-by-step instructions and screenshots so a non-technical user can follow along. You may use content from this
README.mdas a reference. - Follows the structure in our tutorial template: https://philstollery.github.io/github-usaurus/docs/templates/template-tutorial
- Follows the style guide: https://philstollery.github.io/github-usaurus/docs/templates/style-guide
- Please don't spend more than 45 minutes on the writing task.
- Publish your changes to your personal repository, and give PhilStollery access to your hosted GitHub Pages site and the updated repo.
Below are the steps to set up the project locally and deploy it to GitHub Pages.
Before you begin, ensure you have the following:
- Node.js (version 14 or higher)
- The Yarn package manager
- A free GitHub account
- Git configured locally, so you can pull and push to GitHub
After you clone this repository, navigate to the project directory and install dependencies:
yarnStart the local development server:
yarn startThis opens a browser window and serves the site locally. Most changes appear live, so you can preview your edits before building and deploying.
You need a GitHub personal access token. See GitHub's guide for creating one: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic
Grant the token write:packages and read:packages scopes.
-
Set the
NPM_GITHUB_AUTH_TOKENenvironment variable to your personal access token (example in zsh/bash):export NPM_GITHUB_AUTH_TOKEN="YOUR_PERSONAL_ACCESS_TOKEN"
-
Set the
GIT_USERenvironment variable to your GitHub username:export GIT_USER="your-github-username"
-
If a
gh-pagesbranch does not already exist, create it and push it to GitHub:git checkout -b gh-pages git add . git commit -m "Create gh-pages branch" git push -u origin gh-pages
-
Edit the
docusaurus.config.tsfile to seturlandbaseUrlfor your GitHub Pages site. For a repository namedgithub-usaurusunder the userphilstollery, the relevant settings are:// Set the production url of your site here url: 'https://philstollery.github.io', // Set the /<baseUrl>/ pathname under which your site is served // For GitHub Pages deployment, it is often '/<projectName>/' baseUrl: '/github-usaurus/', // GitHub Pages deployment config. If you aren't using GitHub Pages, you don't need these. organizationName: 'philstollery', // your GitHub org/user name projectName: 'github-usaurus', // your repo name
Change url, baseUrl, organizationName and projectName to match your GitHub username and repository name.
-
Run the deployment command:
yarn deploy
yarn deploybuilds the site and (when configured) pushes the built site to thegh-pagesbranch for GitHub Pages hosting. -
View your deployed site at: https://your-github-username.github.io/your-repository-name/