Skip to content

Commit

Permalink
Fix Indentation of Code Block in several pages (#4805)
Browse files Browse the repository at this point in the history
Co-authored-by: Sarah Rainsberger <[email protected]>
  • Loading branch information
VoxelMC and sarah11918 authored Oct 16, 2023
1 parent 55ee629 commit 91a669d
Show file tree
Hide file tree
Showing 16 changed files with 703 additions and 701 deletions.
56 changes: 28 additions & 28 deletions src/content/docs/en/guides/cms/buttercms.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,42 +30,42 @@ To get started, you will need to have the following:

1. Create a `.env` file in the root of your project and add your API token as an environment variable:

```ini title=".env"
BUTTER_TOKEN=YOUR_API_TOKEN_HERE
```
```ini title=".env"
BUTTER_TOKEN=YOUR_API_TOKEN_HERE
```

:::tip
Read more about [using environment variables](/en/guides/environment-variables/) and `.env` files in Astro.
:::
:::tip
Read more about [using environment variables](/en/guides/environment-variables/) and `.env` files in Astro.
:::

2. Install the ButterCMS SDK as a dependency:
<PackageManagerTabs>
<Fragment slot="npm">
```shell
npm install buttercms
```
</Fragment>
<Fragment slot="pnpm">
```shell
pnpm install buttercms
```
</Fragment>
<Fragment slot="yarn">
```shell
yarn add buttercms
```
</Fragment>
</PackageManagerTabs>
<PackageManagerTabs>
<Fragment slot="npm">
```shell
npm install buttercms
```
</Fragment>
<Fragment slot="pnpm">
```shell
pnpm install buttercms
```
</Fragment>
<Fragment slot="yarn">
```shell
yarn add buttercms
```
</Fragment>
</PackageManagerTabs>

3. Create a `buttercms.js` file in a new `src/lib/` directory in your project:

```js title="src/lib/buttercms.js"
import Butter from "buttercms";
```js title="src/lib/buttercms.js"
import Butter from "buttercms";

export const butterClient = Butter(import.meta.env.BUTTER_TOKEN);
```
export const butterClient = Butter(import.meta.env.BUTTER_TOKEN);
```

This authenticates the SDK using your API Token and exports it to be used across your project.
**This authenticates the SDK using your API Token and exports it to be used across your project.**

### Fetching Data
To fetch content, import this client and use one of its `retrieve` functions.
Expand Down
24 changes: 12 additions & 12 deletions src/content/docs/en/guides/cms/frontmatter-cms.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,25 @@ Once Front Matter CMS is installed, you will get a new icon in the Activity Bar.
- As Astro is one of the supported frameworks, you can select it from the list
- Register your content folders, in this case, the `src/content/blog` folder.

:::note
Folder registration is required to let Front Matter CMS know where it can find and create your content. You can have multiple types of folders like pages, blog, docs, and many more.
:::
:::note
Folder registration is required to let Front Matter CMS know where it can find and create your content. You can have multiple types of folders like pages, blog, docs, and many more.
:::

- You will be asked to enter the name of the folder. By default, it takes the folder name.

:::note
The name gets used during the creation process of new content. For example, having multiple folder registrations allows you to choose the type of content you want to create.
:::
:::note
The name gets used during the creation process of new content. For example, having multiple folder registrations allows you to choose the type of content you want to create.
:::

- Click on **Show the dashboard** to open the content dashboard

:::tip
Once Front Matter CMS is initialized, you can open the dashboard as follows:
:::tip
Once Front Matter CMS is initialized, you can open the dashboard as follows:

- Using the keyboard binding: <kbd>alt</kbd> + <kbd>d</kbd> (Windows & Linux) or <kbd>options</kbd> + <kbd>d</kbd> (macOS)
- Open the command palette and search for `Front Matter: Open dashboard`
- Click on the **Front Matter** icon on the panel's title bar or files.
:::
- Using the keyboard binding: <kbd>alt</kbd> + <kbd>d</kbd> (Windows & Linux) or <kbd>options</kbd> + <kbd>d</kbd> (macOS)
- Open the command palette and search for `Front Matter: Open dashboard`
- Click on the **Front Matter** icon on the panel's title bar or files.
:::

### Project configuration

Expand Down
90 changes: 45 additions & 45 deletions src/content/docs/en/guides/cms/payload.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -65,57 +65,57 @@ export default Posts;

1. Import and add both `Users` (available in all PayloadCMS projects) and any other collections (e.g. `Posts`) to the available collections in the `payload.config.ts` file.

```astro title="src/payload.config.ts" ins={4, 5, 12}
import { buildConfig } from "payload/config";
import path from "path";
import Users from "./collections/Users";
import Posts from "./collections/Posts";
export default buildConfig({
serverURL: "http://localhost:4321",
admin: {
user: Users.slug,
},
collections: [Users, Posts],
typescript: {
outputFile: path.resolve(__dirname, "payload-types.ts"),
},
graphQL: {
schemaOutputFile: path.resolve(__dirname, "generated-schema.graphql"),
},
});
```
```astro title="src/payload.config.ts" ins={4, 5, 12}
import { buildConfig } from "payload/config";
import path from "path";
import Users from "./collections/Users";
import Posts from "./collections/Posts";
export default buildConfig({
serverURL: "http://localhost:4321",
admin: {
user: Users.slug,
},
collections: [Users, Posts],
typescript: {
outputFile: path.resolve(__dirname, "payload-types.ts"),
},
graphQL: {
schemaOutputFile: path.resolve(__dirname, "generated-schema.graphql"),
},
});
```

This will make a new collection called "Posts" appear in your PayloadCMS Dashboard next to the "Users" collection.
This will make a new collection called "Posts" appear in your PayloadCMS Dashboard next to the "Users" collection.

2. Enter the "Posts" collection and create a new post. After saving it, you will notice the API URL appear in the bottom right corner.

3. With the dev server running, open `http://localhost:4321/api/posts` in your browser. You should see a JSON file containing the post you have created as an object.

```json
{
"docs":[
{
"id":"64098b16483b0f06a7e20ed4",
"title":"Astro & PayloadCMS Title 🚀",
"content":"Astro & PayloadCMS Content",
"slug":"astro-payloadcms-slug",
"createdAt":"2023-03-09T07:30:30.837Z",
"updatedAt":"2023-03-09T07:30:30.837Z"
}
],
"totalDocs":1,
"limit":10,
"totalPages":1,
"page":1,
"pagingCounter":1,
"hasPrevPage":false,
"hasNextPage":false,
"prevPage":null,
"nextPage":null
}
```
```json
{
"docs":[
{
"id":"64098b16483b0f06a7e20ed4",
"title":"Astro & PayloadCMS Title 🚀",
"content":"Astro & PayloadCMS Content",
"slug":"astro-payloadcms-slug",
"createdAt":"2023-03-09T07:30:30.837Z",
"updatedAt":"2023-03-09T07:30:30.837Z"
}
],
"totalDocs":1,
"limit":10,
"totalPages":1,
"page":1,
"pagingCounter":1,
"hasPrevPage":false,
"hasNextPage":false,
"prevPage":null,
"nextPage":null
}
```

:::tip
By default, both Astro and PayloadCMS will use port 4321. You might want to change the PayloadCMS port in the `src/server.ts` file. Don't forget to update the `serverURL` in `src/payload.config.ts` as well.
Expand Down
6 changes: 3 additions & 3 deletions src/content/docs/en/guides/deploy/space.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ The Space CLI will try to auto-detect the configuration for your app. Accept the

Make the following changes to the `Spacefile` file at the root of your project generated by the Space CLI.

1. Change the engine to `static`.
2. Add Astro's build command to the list of `commands`.
3. Serve the `dist` directory generated by Astro.
1. Change the engine to `static`.
2. Add Astro's build command to the list of `commands`.
3. Serve the `dist` directory generated by Astro.

```yaml title="Spacefile" {6,8,9}
# Spacefile Docs: https://go.deta.dev/docs/spacefile/v0
Expand Down
34 changes: 17 additions & 17 deletions src/content/docs/en/guides/integrations-guide.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -77,23 +77,23 @@ There are three common ways to import an integration into your Astro project:
2. Import your own integration from a local file inside your project.
3. Write your integration inline, directly in your config file.
```js
// astro.config.mjs
import {defineConfig} from 'astro/config';
import installedIntegration from '@astrojs/vue';
import localIntegration from './my-integration.js';
export default defineConfig({
integrations: [
// 1. Imported from an installed npm package
installedIntegration(),
// 2. Imported from a local JS file
localIntegration(),
// 3. An inline object
{name: 'namespace:id', hooks: { /* ... */ }},
]
})
```
```js
// astro.config.mjs
import {defineConfig} from 'astro/config';
import installedIntegration from '@astrojs/vue';
import localIntegration from './my-integration.js';
export default defineConfig({
integrations: [
// 1. Imported from an installed npm package
installedIntegration(),
// 2. Imported from a local JS file
localIntegration(),
// 3. An inline object
{name: 'namespace:id', hooks: { /* ... */ }},
]
})
```
Check out the [Integration API](/en/reference/integrations-reference/) reference to learn all of the different ways that you can write an integration.
Expand Down
14 changes: 7 additions & 7 deletions src/content/docs/en/guides/middleware.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ Middleware is available in both SSG and SSR Astro projects.

3. Inside any `.astro` file, access response data using `Astro.locals`.

```astro title="src/components/Component.astro"
---
const data = Astro.locals;
---
<h1>{data.title}</h1>
<p>This {data.property} is from middleware.</p>
```
```astro title="src/components/Component.astro"
---
const data = Astro.locals;
---
<h1>{data.title}</h1>
<p>This {data.property} is from middleware.</p>
```

### Middleware types

Expand Down
Loading

0 comments on commit 91a669d

Please sign in to comment.