Skip to content

Commit

Permalink
[site/content][xs]: update blogs and tutorials
Browse files Browse the repository at this point in the history
  • Loading branch information
olayway committed Mar 20, 2023
1 parent d4f236b commit 3c93059
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions site/content/blog/2023-02-16-nextjs-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ my-flowershow-app

If you looked at the schema of the `Blog` type in `contentlayer.config.ts` file, you noticed that apart from shared fields like title or description, this type has the following extra fields:

- `created` (required) - date that will be displayed on the blog page and that will be used to sort your list of blogs (if you'll use our `BlogsList` component)
- `date` - date that will be displayed on the blog page and that will be used to sort your list of blogs (if you'll use our `BlogsList` component)
- `authors` (optional) - this will search for authors and display their images on the post ([Authors docs](https://flowershow.app/docs/blog#blog-authors))

We will also need to add a title and a description of each blog, which will be displayed on the blog home page that we'll create later on.
Expand All @@ -164,7 +164,7 @@ So your `my-blog-post.md` file will look like this:
---
title: Blog post title
description: This blog post is about how to write a blog
created: 2022-11-29
date: 2022-11-29
authors: [John Doe, Jane Doe]
---

Expand Down Expand Up @@ -210,7 +210,7 @@ In addition to that, you also need to create a getter function that will fetch a
import { allBlogs } from "contentlayer/generated";
export default function getBlogs() {
return allBlogs.sort((a, b) => new Date(b.created) - new Date(a.created));
return allBlogs.sort((a, b) => new Date(b.date) - new Date(a.date));
}
```

Expand Down
8 changes: 4 additions & 4 deletions site/content/docs/blog-section-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ Blog content here

## Blog post frontmatter fields

- `created` (required) - date that will be displayed on the blog page and that will be used to sort blog search results
- `date` - date that will be displayed on the blog page and that will be used to sort blog search results
- `authors` (optional) - authors of the blog that will be displayed on the blog page

```md
---
title: Blog post title
created: 2022-11-29
date: 2022-11-29
authors: [John Doe, Jan Kowalski]
---

Expand Down Expand Up @@ -84,7 +84,7 @@ In addition to that, you also need to create a getter function that will fetch a
// <your-content-folder>/getters/blogs.js
import { allBlogs } from "contentlayer/generated";
export default function getBlogs() {
return allBlogs.sort((a, b) => new Date(b.created) - new Date(a.created));
return allBlogs.sort((a, b) => new Date(b.date) - new Date(a.date));
}
```

Expand Down Expand Up @@ -126,7 +126,7 @@ Now you can reference John in one of your blog pages using e.g. the name you've
```md
---
title: Some blog page
created: 2022-12-12
date: 2022-12-12
authors: [John Doe]
---
```
Expand Down
4 changes: 2 additions & 2 deletions site/content/docs/blog-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Now, in order for Flowershow to pick this file up as one of your blog files, we
title: My blog post
description: My first Flowershow blog post!
type: Blog
created: 2022-11-29
date: 2022-11-29
authors: [John Doe]
---
Expand Down Expand Up @@ -74,7 +74,7 @@ Before we use the `BlogsList` component on this page, we also need to have a lis
import { allBlogs } from "contentlayer/generated";
export default function getBlogs() {
return allBlogs.sort((a, b) => new Date(b.created) - new Date(a.created));
return allBlogs.sort((a, b) => new Date(b.date) - new Date(a.date));
}
```

Expand Down
12 changes: 6 additions & 6 deletions site/content/docs/blog.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ type: Blog

## Blog post frontmatter fields

- `created` (required) - date that will be displayed on the blog page and that will be used to sort blog search results
- `date` - date that will be displayed on the blog page and that will be used to sort blog search results
- `authors` (optional)

```md
---
title: Blog post title
created: 2022-11-29
date: 2022-11-29
authors: [John Doe, Jan Kowalski]
---
```
Expand All @@ -61,7 +61,7 @@ In addition to that, you also need to create a getter function that will fetch a
import { allBlogs } from "contentlayer/generated";
export default function getBlogs() {
return allBlogs.sort((a, b) => new Date(b.created) - new Date(a.created));
return allBlogs.sort((a, b) => new Date(b.date) - new Date(a.date));
}
```

Expand Down Expand Up @@ -108,7 +108,7 @@ Now you can reference John in one of your blog pages using e.g. the id you've se
```md
---
title: Some blog page
created: 2022-12-12
date: 2022-12-12
authors: [john123]
---
```
Expand All @@ -118,7 +118,7 @@ authors: [john123]
```md
---
title: Some blog page
created: 2022-12-12
date: 2022-12-12
authors: [john-doe]
---
```
Expand All @@ -128,7 +128,7 @@ authors: [john-doe]
```md
---
title: Some blog page
created: 2022-12-12
date: 2022-12-12
authors: [John Doe]
---
```
Expand Down

0 comments on commit 3c93059

Please sign in to comment.