From e327fa03240b33750b0fa502f844ed790737a508 Mon Sep 17 00:00:00 2001 From: Junseong Park Date: Thu, 17 Jul 2025 16:21:47 +0900 Subject: i18n(ko-KR): update `manual-setup.mdx`, `configuration.mdx` (#3322) Co-authored-by: HiDeoo <494699+HiDeoo@users.noreply.github.com>--- docs/src/content/docs/ko/manual-setup.mdx | 2 +- .../content/docs/ko/reference/configuration.mdx | 120 ++++++++++++++++++++- 2 files changed, 120 insertions(+), 2 deletions(-) diff --git a/docs/src/content/docs/ko/manual-setup.mdx b/docs/src/content/docs/ko/manual-setup.mdx index 280090d0..bebae1ba 100644 --- a/docs/src/content/docs/ko/manual-setup.mdx +++ b/docs/src/content/docs/ko/manual-setup.mdx @@ -63,7 +63,7 @@ export default defineConfig({ Starlight는 `src/content.config.ts` 파일에 구성된 Astro의 [콘텐츠 컬렉션](https://docs.astro.build/ko/guides/content-collections/) 위에 구축되었습니다. -Starlight의 `docsLoader` 및 `docsSchema`를 사용하는 `docs` 컬렉션을 추가하여 콘텐츠 구성 파일을 생성하거나 업데이트하세요. +Starlight의 [`docsLoader`](/ko/reference/configuration/#docsloader) 및 [`docsSchema`](/ko/reference/configuration/#docsschema)를 사용하는 `docs` 컬렉션을 추가하여 콘텐츠 구성 파일을 생성하거나 업데이트하세요. ```js ins={3-4,7} // src/content.config.ts diff --git a/docs/src/content/docs/ko/reference/configuration.mdx b/docs/src/content/docs/ko/reference/configuration.mdx index df71387d..50ab2715 100644 --- a/docs/src/content/docs/ko/reference/configuration.mdx +++ b/docs/src/content/docs/ko/reference/configuration.mdx @@ -223,7 +223,11 @@ type SidebarItem = | { // 자동으로 생성된 링크 그룹 label: string; - autogenerate: { directory: string; collapsed?: boolean }; + autogenerate: { + directory: string; + collapsed?: boolean; + attrs?: Record; + }; collapsed?: boolean; } )); @@ -677,3 +681,117 @@ starlight({ credits: true, }); ``` + +## 콘텐츠 컬렉션 구성 + +Starlight는 Astro의 [콘텐츠 컬렉션](https://docs.astro.build/ko/guides/content-collections/)을 사용하여 콘텐츠를 로드합니다. +Starlight의 콘텐츠 로더 및 스키마는 필요에 따라 컬렉션을 구성하는 데 도움이 됩니다. + +```js +// src/content.config.ts +import { defineCollection } from 'astro:content'; +import { docsLoader, i18nLoader } from '@astrojs/starlight/loaders'; +import { docsSchema, i18nSchema } from '@astrojs/starlight/schema'; + +export const collections = { + docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }), + // 선택 사항: i18n 컬렉션은 다국어 사이트의 UI 번역에 사용됩니다. + i18n: defineCollection({ loader: i18nLoader(), schema: i18nSchema() }), +}; +``` + +### 로더 + +Starlight는 콘텐츠 컬렉션 구성을 간소화하기 위해 `@astrojs/starlight/loaders` 모듈에서 다음과 같은 [Astro 로더](https://docs.astro.build/ko/reference/content-loader-reference/)를 내보냅니다. + +#### `docsLoader()` + +`docsLoader()`는 `src/content/docs/` 디렉터리에서 로컬 Markdown, MDX 및 Markdoc 파일을 로드합니다. +밑줄 (`_`)로 시작하는 파일 이름은 무시됩니다. + +##### 가져오기 + +```js +import { docsLoader } from '@astrojs/starlight/loaders'; +``` + +##### 옵션 + +###### `generateId()` + +**타입:** `({ entry: string; base: URL; data: Record }) => string` + +기본적으로 `docsLoader()`를 사용하여 생성된 페이지는 특수 문자를 제거하고 파일 이름을 소문자로 처리하는 sluggifier를 사용하여 파일 이름을 처리합니다. 이 기본 동작을 재정의하려면 사용자 정의 `generateId()` 함수를 제공하세요. + +예를 들어, 이는 제거될 특수 문자를 보존하는 데 유용할 수 있습니다. +기본적으로 `Example.File.md`는 `/examplefile`에서 제공됩니다. +이를 `/Example.File`에서 제공하려면 사용자 정의 `generateId()` 함수를 정의하면 됩니다. + +```js +docsLoader({ + // `.md` 또는 `.mdx` 확장자를 제거하되, 파일 이름은 그대로 유지합니다. + generateId: ({ entry }) => entry.split('.').slice(0, -1).join('.'), +}), +``` + +자세한 내용은 [Astro 문서에서 `generateId()`](https://docs.astro.build/ko/reference/content-loader-reference/#generateid)를 참조하세요. + +#### `i18nLoader()` + +`i18nLoader()`는 `src/content/i18n/` 디렉터리에서 로컬 JSON 및 YAML 파일을 로드합니다. +밑줄 (`_`)로 시작하는 파일 이름은 무시됩니다. + +##### 가져오기 + +```js +import { i18nLoader } from '@astrojs/starlight/loaders'; +``` + +##### 옵션 + +현재 `i18nLoader()`를 구성하는 옵션은 없습니다. + +### 스키마 + +Starlight는 `@astrojs/starlight/schema` 모듈에서 다음과 같은 [콘텐츠 컬렉션 스키마](https://docs.astro.build/ko/guides/content-collections/#컬렉션-스키마-정의)를 제공합니다. +이러한 스키마는 Starlight가 의존하는 `docs` 및 `i18n` 컬렉션에 사용해야 합니다. + +#### `docsSchema()` + +`docsSchema()`는 `docs` 컬렉션의 모든 콘텐츠에 대한 프런트매터를 구문 분석합니다. + +##### 가져오기 + +```js +import { docsSchema } from '@astrojs/starlight/schema'; +``` + +##### 옵션 + +###### `extend` + +**타입:** Zod 스키마 또는 Zod 스키마를 반환하는 함수 +**기본값:** `z.object({})` + +추가 필드를 사용하여 Starlight의 프런트매터 스키마를 확장합니다. +`extend` 옵션 사용에 대한 자세한 내용은 ["프런트매터 스키마 사용자 정의"](/ko/reference/frontmatter/#프런트매터-스키마-사용자-정의)를 참조하세요. + +#### `i18nSchema()` + +`i18nSchema()`는 `i18n` 컬렉션의 모든 데이터 파일을 구문 분석합니다. + +##### 가져오기 + +```js +import { i18nSchema } from '@astrojs/starlight/schema'; +``` + +##### 옵션 + +###### `extend` + +**타입:** Zod 객체 +**기본값:** `z.object({})` + +추가 필드를 사용하여 Starlight의 i18n 스키마를 확장합니다. +`extend` 옵션 사용에 대한 자세한 내용은 ["번역 스키마 확장하기"](/ko/guides/i18n/#번역-스키마-확장)를 참조하세요. -- cgit