Skip to content

Commit c84ba67

Browse files
i18n(ko-KR): update content-collections.mdx (#12355)
Co-authored-by: Yan <[email protected]>
1 parent 7dd8112 commit c84ba67

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

src/content/docs/ko/guides/content-collections.mdx

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,73 @@ const { Content } = await render(post);
566566
[GitHub의 블로그 튜토리얼 데모 코드](https://github.com/withastro/blog-tutorial-demo/tree/content-collections/src/pages)`src/pages/` 폴더를 살펴보면 블로그 게시물 목록, 태그 페이지 등과 같은 블로그 기능을 위해 컬렉션으로부터 페이지를 생성하는 전체 예시를 확인할 수 있습니다!
567567
:::
568568

569+
## 컬렉션 JSON 스키마
570+
571+
<p><Since v="4.13.0" /></p>
572+
573+
Astro는 컬렉션용 [JSON 스키마](https://json-schema.org/) 파일을 자동으로 생성하며, 이를 편집기에서 사용하면 데이터 파일에 대한 IntelliSense 및 타입 검사를 받을 수 있습니다.
574+
575+
프로젝트의 각 컬렉션에 대해 JSON 스키마 파일이 생성되어 `.astro/collections/` 디렉터리에 출력됩니다.
576+
예를 들어, `authors``posts`라는 두 컬렉션이 있다면, Astro는 `.astro/collections/authors.schema.json``.astro/collections/posts.schema.json`을 생성합니다.
577+
578+
### JSON 파일에서 JSON 스키마 사용하기
579+
580+
JSON 파일에서 `$schema` 필드를 설정하여 Astro가 생성한 스키마를 직접 지정할 수 있습니다.
581+
값은 데이터 파일에서 스키마까지의 상대 파일 경로여야 합니다.
582+
다음은 `src/data/authors/`에 있는 데이터 파일이 `authors` 컬렉션용으로 생성된 스키마를 사용하는 예시입니다.
583+
584+
```json title="src/data/authors/armand.json" ins={2}
585+
{
586+
"$schema": "../../../.astro/collections/authors.schema.json",
587+
"name": "Armand",
588+
"skills": ["Astro", "Starlight"]
589+
}
590+
```
591+
592+
#### VS Code에서 JSON 파일 그룹에 스키마 사용하기
593+
594+
VS Code에서 [`json.schemas` 설정](https://code.visualstudio.com/docs/languages/json#_json-schemas-and-settings)을 사용하여 컬렉션 내 모든 파일에 적용할 스키마를 구성할 수 있습니다.
595+
다음은 `src/data/authors/` 디렉터리 내 모든 파일이 `authors` 컬렉션용으로 생성된 스키마를 사용하는 예시입니다.
596+
597+
```json
598+
{
599+
"json.schemas": [
600+
{
601+
"fileMatch": ["/src/data/authors/**"],
602+
"url": "./.astro/collections/authors.schema.json"
603+
}
604+
]
605+
}
606+
```
607+
608+
### VS Code에서 YAML 파일의 스키마 사용하기
609+
610+
VS Code에서 [Red Hat YAML](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml) 확장 기능을 사용하면 YAML 파일에서 JSON 스키마를 사용할 수 있습니다.
611+
이 확장 기능을 설치하면 특수 주석 구문을 사용하여 YAML 파일에서 스키마를 참조할 수 있습니다.
612+
613+
```yaml title="src/data/authors/armand.yml" ins={1}
614+
# yaml-language-server: $schema=../../../.astro/collections/authors.schema.json
615+
name: Armand
616+
skills:
617+
- Astro
618+
- Starlight
619+
```
620+
621+
#### VS Code에서 YAML 파일 그룹에 스키마 사용하기
622+
623+
Red Hat YAML 확장 기능을 사용하면 `yaml.schemas` 설정을 통해 컬렉션 내 모든 YAML 파일에 적용할 스키마를 구성할 수 있습니다.
624+
다음은 `src/data/authors/` 디렉터리 내 모든 YAML 파일이 `authors` 컬렉션용으로 생성된 스키마를 사용하는 예시입니다.
625+
626+
```json
627+
{
628+
"yaml.schemas": {
629+
"./.astro/collections/authors.schema.json": ["/src/content/authors/*.yml"]
630+
}
631+
}
632+
```
633+
634+
자세한 내용은 Red Hat YAML 확장 기능 문서의 [“Associating schemas”](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml#associating-schemas)를 참조하세요.
635+
569636
## 컬렉션 생성이 필요한 경우
570637

571638
관련된 데이터나 콘텐츠가 공통 구조를 공유하는 그룹이 있을 때마다 [컬렉션을 생성](#컬렉션-정의)할 수 있습니다.

0 commit comments

Comments
 (0)