Skip to content

Commit

Permalink
#16 Данные перенесены в content
Browse files Browse the repository at this point in the history
  • Loading branch information
khusamov committed Aug 20, 2023
1 parent 3c4b773 commit 178b37d
Show file tree
Hide file tree
Showing 12 changed files with 99 additions and 1 deletion.
12 changes: 12 additions & 0 deletions content/articles/_index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: Корневой раздел
---

Это первая страница сайта.


<Picture src='./sample.jpg' title='fdsfsdf'/>

[article1.mdx](article1)

![](./sample.jpg)
42 changes: 42 additions & 0 deletions content/articles/article1.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
title: Тестовая статья 1 с кодом
---

Тестовый нормальный длинный текст типа параграф.

```tsx
import {readdir} from 'fs/promises'
import Link from 'next/link'
import {basename, extname, join} from 'path'

const isMardownFilename = (filename: string): boolean => {
return ['.md', '.mdx'].includes(extname(filename).toLowerCase())
}

const articleListDirectory = join(process.cwd(), 'articles')

export default async function Home() {
const fileList = await readdir(articleListDirectory)
const mardownList = fileList.filter(isMardownFilename)

const articleInfoList = await Promise.all(mardownList.map(async (filename) => (
{
article: await import(`../../articles/${filename}`),
id: basename(filename, extname(filename))
}
)))

return (
<main>
{articleInfoList.map(({article, id}) => (
<div>
<Link href={`/article/${id}`}>
{article.meta.title}
</Link>
</div>
))}
</main>
)
}

```
9 changes: 9 additions & 0 deletions content/articles/article2.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: Тестовая статья 2
---

Тестовый нормальный длинный текст типа параграф.

<Picture src='./sample.jpg' title='fdsfsdf'/>

[article1.mdx](article1)
Binary file added content/articles/sample.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions content/articles/section1/_index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Раздел 1
---

Тестовый нормальный длинный текст типа параграф.

6 changes: 6 additions & 0 deletions content/articles/section1/article1.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Тестовая статья 1-1
---

Тестовый нормальный длинный текст типа параграф.

6 changes: 6 additions & 0 deletions content/articles/section1/article2.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Тестовая статья 1-2
---

Тестовый нормальный длинный текст типа параграф.

5 changes: 5 additions & 0 deletions content/articles/section2/_index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Раздел 2
---

Тестовый нормальный длинный текст типа параграф.
5 changes: 5 additions & 0 deletions content/articles/section2/article1.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Тестовая статья 2-1
---

Тестовый нормальный длинный текст типа параграф.
5 changes: 5 additions & 0 deletions content/articles/section2/article2.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Тестовая статья 2-2
---

Тестовый нормальный длинный текст типа параграф.
2 changes: 2 additions & 0 deletions content/site.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
title: khusamov.ru
description: Личный сайт веб-разработчика
2 changes: 1 addition & 1 deletion contentlayer.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const mdx: MDXOptions = {
export default makeSource(
{
mdx,
contentDirPath: 'data2',
contentDirPath: 'content',
documentTypes: [Post, SiteConfig]
}
)

0 comments on commit 178b37d

Please sign in to comment.