diff --git a/website/content/docs/docusaurus.md b/website/content/docs/docusaurus.md new file mode 100644 index 00000000..63b70231 --- /dev/null +++ b/website/content/docs/docusaurus.md @@ -0,0 +1,256 @@ +--- +group: Guides +weight: 80 +title: Docusaurus +--- +This guide instructs you on how to integrate Netlify 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 + +Netlify CMS requires a [backend](https://www.netlifycms.org/docs/backends-overview/) to store content. Netlify 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/screen-shot-2021-11-15-at-4.16.53-pm.png) + +```bash +# 6. Update your remote repository with your staged changes. +git push -u origin main +``` + +## Publish your project using Netlify CLI + +
Create & configure a new site
. yarn build
for your build command. build
for your deployment directory. /blog
.
+
+```bash
+rm -rf ./blog/*
+```
+
+2021-11-15-first-blog-post.md
.
+
+```bash
+touch ./blog/2021-11-15-first-blog-post.md
+```
+
+2021-11-15-first-blog-post.md
to look like this:
+
+```yaml
+---
+title: First Blog Post
+slug: first-blog-post
+tags:
+ - foo
+ - bar
+authors:
+ - name: 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.
+```
+
+admin
directory inside static
.
+
+```bash
+cd static
+mkdir admin
+```
+
+admin
directory, create a config.yml
file and an index.html
file.
+
+```bash
+cd admin
+touch config.yml
+touch index.html
+```
+
+index.html
to look like this:
+
+```html
+
+
+
+
+
+ config.yml
to look like this:
+
+```yaml
+backend:
+ name: github
+ branch: main
+ repo: localhost:3000/admin
+
+You can now view and edit `2021-11-15-first-blog-post.md` through the admin interface. You can also create new blog posts.
+
+**Warning:** Any changes you publish through the admin interface will only effect your *remote GitHub repository*. To retrieve these changes locally, `git pull` from your local repository.
+https://api.netlify.com/auth/done
as the **Authorization callback URL**.
+4. Click **Register application.**
+5. Click **Generate a new client secret.**
+6. Copy the provided client secret and client ID.
+
+### Configure Netlify
+
+1. On Netlify, under `Site Settings > Access control > OAuth > Authentication Providers`, click **Install provider**.
+2. Enter your client secret and client ID from GitHub.
+3. Click **Install**.
+
+🎉 All done! Now you can access the admin interface through your Netlify URL.
\ No newline at end of file
diff --git a/website/static/img/screen-shot-2021-11-15-at-4.16.53-pm.png b/website/static/img/screen-shot-2021-11-15-at-4.16.53-pm.png
new file mode 100644
index 00000000..a0f07001
Binary files /dev/null and b/website/static/img/screen-shot-2021-11-15-at-4.16.53-pm.png differ
diff --git a/website/static/img/screen-shot-2021-11-16-at-1.34.18-PM.png b/website/static/img/screen-shot-2021-11-16-at-1.34.18-PM.png
new file mode 100644
index 00000000..49d8280a
Binary files /dev/null and b/website/static/img/screen-shot-2021-11-16-at-1.34.18-PM.png differ