Skip to content

Commit

Permalink
docs: add blog documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mickasmt committed Jun 19, 2024
1 parent bce4d53 commit c2b685d
Show file tree
Hide file tree
Showing 4 changed files with 138 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pnpm run dev
- [x] ~Change database platform for Neon (planetscale removes its free plan on April 2024)~
- [x] ~Switch subscription plan (enable on stripe dashboard)~
- [x] ~Update documentation for installation & configuration~
- [ ] Improve blog design
- [x] ~Improve blog section~
- [ ] Upgrade eslint to v9
- [ ] Add resend for success subscriptions

Expand Down
28 changes: 16 additions & 12 deletions config/docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,32 +29,36 @@ export const docsConfig: DocsConfig = {
title: "Configuration",
items: [
{
title: "Database",
href: "/docs/configuration/database",
title: "Authentification",
href: "/docs/configuration/authentification",
},
{
title: "Subscriptions",
href: "/docs/configuration/subscriptions",
title: "Blog",
href: "/docs/configuration/blog",
},
{
title: "Config files",
href: "/docs/configuration/config-files",
title: "Components",
href: "/docs/configuration/components",
},
{
title: "Markdown files",
href: "/docs/configuration/markdown-files",
title: "Config files",
href: "/docs/configuration/config-files",
},
{
title: "Authentification",
href: "/docs/configuration/authentification",
title: "Database",
href: "/docs/configuration/database",
},
{
title: "Email",
href: "/docs/configuration/email",
},
{
title: "Components",
href: "/docs/configuration/components",
title: "Markdown files",
href: "/docs/configuration/markdown-files",
},
{
title: "Subscriptions",
href: "/docs/configuration/subscriptions",
},
],
},
Expand Down
1 change: 1 addition & 0 deletions content/blog/deploying-next-apps.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ authors:
- shadcn
- mickasmt
categories:
- education
- news
related:
- server-client-components
Expand Down
120 changes: 120 additions & 0 deletions content/docs/configuration/blog.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
---
title: Blog
description: How works blog with categories and authors.
---

Blog posts can have multiple categories, authors and related posts.

## Authors

### Create one author

Blog posts can have **one or multiple authors**. <br /> Add a new object with **name, image url and twitter handle** to add a new author to your blog.

```ts title="config/blog.ts" {7-11}
export const BLOG_AUTHORS = {
mickasmt: {
name: "mickasmt",
image: "/images/avatars/mickasmt.png",
twitter: "miickasmt",
},
newauthor: {
name: "shadcn",
image: "/images/avatars/shadcn.jpeg",
twitter: "shadcn",
},
};
```

### Add in a blog post

Add your new author in your blog post like that :

```mdx {6-8}
---
title: Deploying Next.js Apps
description: How to deploy your Next.js apps on Vercel.
image: /images/blog/blog-post-3.jpg
date: "2023-01-02"
authors:
- newauthor
- mickasmt
categories:
- news
related:
- server-client-components
- preview-mode-headless-cms
---
```

## Categories

### Create one category

Add a new object and a slug to add a new category to your blog.

```ts title="config/blog.ts" {3,6-10}
export const BLOG_CATEGORIES: {
title: string;
slug: "news" | "education";
description: string;
}[] = [
{
title: "News",
slug: "news",
description: "Updates and announcements from Next SaaS Starter.",
},
{
title: "Education",
slug: "education",
description: "Educational content about SaaS management.",
},
];
```

### Add in a blog post

Add your new author in your blog post like that :

```mdx {9-10}
---
title: Deploying Next.js Apps
description: How to deploy your Next.js apps on Vercel.
image: /images/blog/blog-post-3.jpg
date: "2023-01-02"
authors:
- newauthor
- mickasmt
categories:
- news
related:
- server-client-components
- preview-mode-headless-cms
---
```

<Callout type="warning">
The blog post can belong to multiple categories, but currently, only the first
category in the list is being displayed.
</Callout>

## Related posts

Each blog post can have a list of related posts. <br/> Get the filenames of the blog posts that you want and remove the `.mdx` or `.md`. That's all!

```mdx {11-13}
---
title: Deploying Next.js Apps
description: How to deploy your Next.js apps on Vercel.
image: /images/blog/blog-post-3.jpg
date: "2023-01-02"
authors:
- newauthor
- mickasmt
categories:
- news
related:
- server-client-components
- preview-mode-headless-cms
---
```

0 comments on commit c2b685d

Please sign in to comment.