--- group: Guides title: Docusaurus weight: 80 --- This guide instructs you on how to integrate Static CMS with Docusaurus. ### Before you begin * Sign up for [GitHub](www.github.com) and [Netlify](www.netlify.com). * Download [Node.js](https://nodejs.org/en/download/) version 14 or above. * Install the [GitHub CLI](https://cli.github.com/). * Install and authenticate the [Netlify CLI](https://docs.netlify.com/cli/get-started/). ## Create a new Docusaurus project ```bash # 1. Use Docusaurus to create a site scaffold. npx create-docusaurus@latest my-website classic # 2. Run the development server. cd my-website npm run start ``` A browser window opens at `http://localhost:3000`. The development server now serves your website at `http://localhost:3000`. As you edit the source files in `/my-website/`, you can visit `http://localhost:3000` to preview your changes. ## Push your project to GitHub Static CMS requires a [backend](/docs/backends-overview/) to store content. Static CMS supports using Git hosts, like GitHub or GitLab, as backends. This guide uses GitHub. ```bash # 1. Initialize your local Git repository. git init # 2. Rename your initial branch to match GitHub. git branch -m main # 3. Stage all your local files to your repository. git add . # 4. Commit your staged changes. git commit -m 'Initial commit' # 5. Create a remote repository on GitHub using the GitHub CLI. gh repo create my-website ``` Don't add a license or a .gitignore. Do add an "origin" git remote. ![](/img/create-remote-repo.webp) ```bash # 6. Update your remote repository with your staged changes. git push -u origin main ``` ## Publish your project using Netlify CLI 1. Connect Netlify CLI to your GitHub repository. ```bash netlify init ``` 2. Choose `Create & configure a new site`. 3. Choose your team and site name. 4. Choose `yarn build` for your build command. 5. Choose `build` for your deployment directory. ![](/img/create-remote-repo.webp) Choose the default option for everything else. Your website is now deployed. Netlify provides you with a randomly generated domain name. Run `netlify open --site` to view your deployed site. ## Add Static CMS to your project ### Before you begin 1. Remove all existing posts from `/blog`. ```bash rm -rf ./blog/* ``` 2. Create a new blog post post titled `2021-11-15-first-blog-post.md`. ```bash touch ./blog/2021-11-15-first-blog-post.md ``` 3. Edit `2021-11-15-first-blog-post.md` to look like this: ```yaml --- title: First Blog Post slug: first-blog-post tags: - foo - bar authors: - title: Garrison McMullen title: Instruction Writer url: https://github.com/garrison0 image_url: https://avatars.githubusercontent.com/u/4089393?v=4 --- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. ``` ### Procedure 1. Create an `admin` directory inside `static`. ```bash cd static mkdir admin ``` 2. In the `admin` directory, create a `config.yml` file and an `index.html` file. ```bash cd admin touch config.yml touch index.html ``` 3. Edit `index.html` to look like this: ```html