Skip to content

Commit

Permalink
Merge branch 'main' into project-structure
Browse files Browse the repository at this point in the history
  • Loading branch information
sarah11918 authored Oct 7, 2024
2 parents 1ea60fa + faff5f5 commit 71b7c4d
Show file tree
Hide file tree
Showing 17 changed files with 656 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/content/docs/en/guides/markdown-content.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Steps } from '@astrojs/starlight/components';

[Markdown](https://daringfireball.net/projects/markdown/) is commonly used to author text-heavy content like blog posts and documentation. Astro includes built-in support for Markdown files that can also include [frontmatter YAML](https://dev.to/paulasantamaria/introduction-to-yaml-125f) to define custom properties such as a title, description, and tags.

In Astro, you can author content in Markdown, then render it in `.astro` components. This combines a familiar writing format designed for content with the flexibility of Astro's component syntax and architecture.
In Astro, you can author content in [GitHub Flavored Markdown](https://github.github.com/gfm/), then render it in `.astro` components. This combines a familiar writing format designed for content with the flexibility of Astro's component syntax and architecture.

:::tip
For additional functionality, such as including components and JSX expressions in Markdown, add the [`@astrojs/mdx` integration](/en/guides/integrations-guide/mdx/) to write your Markdown content using [MDX](https://mdxjs.com/).
Expand Down
17 changes: 16 additions & 1 deletion src/content/docs/en/guides/migrate-to-astro/from-wordpress.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,21 @@ To convert other types of sites, such as a portfolio or documentation site, see
## Community Resources
- Blog Post: [Why I switched from WordPress to Astro](https://dev.to/fratzinger/why-i-switched-from-wordpress-to-astro-5ge) by fratzinger
- [Why I switched from WordPress to Astro](https://dev.to/fratzinger/why-i-switched-from-wordpress-to-astro-5ge)
- [Shattering Headless WordPress Build Times with Astro’s Content Layer API](https://andrewkepson.com/blog/headless-wordpress/build-time-astro-content-layer-api/)
- [Building an Astro Website with WordPress as a Headless CMS](https://blog.openreplay.com/building-an-astro-website-with-wordpress-as-a-headless-cms/)
- [Building a Headless WordPress Site with Astro](https://wpengine.com/builders/building-headless-wordpress-site-astro/)
- [Headless WordPress with Astro – Build a Simple Blog from Scratch with Tailwind CSS](https://fullstackdigital.io/blog/headless-wordpress-with-astro-build-a-simple-blog/)
- [Leveraging WordPress as a Headless CMS for Your Astro Website: API Configuration & Data Fetching](https://medium.com/@bangemann.dev/configure-wordpress-rest-api-setup-data-fetching-4af5161095f6)
- [Build a static site with WordPress and Astro](https://kinsta.com/blog/wordpress-astro/)
- [How to Set Up a Headless WordPress Site with Astro](https://dev.to/mathiasahlgren/how-to-set-up-a-headless-wordpress-site-with-astro-3a2h)
- [Building an E-commerce Website with Headless WordPress and Astro](https://shaxadd.medium.com/building-an-e-commerce-website-with-headless-wordpress-and-astro-2712d8c8b735)
- [Astro WordPress Starter Theme](https://astro.build/themes/details/astro-wordpress-starter/)
- [Kubric Astro Theme](https://astro.build/themes/details/kubrick-astro/)
- 📺 [Make a Headless WordPress Site with Astro](https://www.youtube.com/watch?v=54U7dVmhyxE)
- 📺 [Astro Headless WordPress Starter Demo](https://www.youtube.com/watch?v=BcoxZZIfESI)
- 📺 [Astro + WPGraphQL for more secure WordPress sites](https://www.youtube.com/watch?v=fWxn-r83ygQ)
- 📺 [WordPress Headless with Astro - Installing Astro and Fetching posts with WP-GraphQL](https://www.youtube.com/watch?v=2PSqABrME28)
- 📺 [Going Headless WordPress with Astro](https://www.youtube.com/watch?v=MP2TR6Z_YTc)
- Add your own!
2 changes: 1 addition & 1 deletion src/content/docs/fr/guides/actions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ Par exemple, vous pouvez renvoyer le nom d'un produit dans une action `addToCart
import { defineAction } from 'astro:actions';
export const server = {
addToCard: defineAction({
addToCart: defineAction({
handler: async () => {
/* ... */
return product;
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/ko/guides/actions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ const result = Astro.getActionResult(actions.addToCart);
import { defineAction } from 'astro:actions';
export const server = {
addToCard: defineAction({
addToCart: defineAction({
handler: async () => {
/* ... */
return product;
Expand Down
265 changes: 265 additions & 0 deletions src/content/docs/ko/reference/components-reference.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,265 @@
---
title: 기본 제공 컴포넌트 참조
i18nReady: true
tableOfContents:
minHeadingLevel: 2
maxHeadingLevel: 2
---
import Since from '~/components/Since.astro';
import PackageManagerTabs from '~/components/tabs/PackageManagerTabs.astro';
import ReadMore from '~/components/ReadMore.astro';

Astro에는 프로젝트에 사용할 수 있는 몇 가지 기본 제공 컴포넌트가 포함되어 있습니다. 모든 기본 제공 컴포넌트는 `.astro` 파일에서 사용할 수 있으며 가져오기 구문이 필요할 수 있습니다.

이러한 컴포넌트의 `Props`[`ComponentProps` 타입](/ko/guides/typescript/#componentprops-타입) 유틸리티를 사용하여 참조할 수 있습니다.

## `<Code />`

```astro 'theme="dark-plus"' /wrap\b/ /(inline) \/>/ 'defaultColor={false}'
---
import { Code } from 'astro:components';
---
<!-- JavaScript 코드 구문 강조. -->
<Code code={`const foo = 'bar';`} lang="js" />
<!-- 선택적: 테마 사용자 정의. -->
<Code code={`const foo = 'bar';`} lang="js" theme="dark-plus" />
<!-- 선택적: 단어 줄 바꿈 사용. -->
<Code code={`const foo = 'bar';`} lang="js" wrap />
<!-- 선택적: 인라인 코드 출력. -->
<p>
<Code code={`const foo = 'bar';`} lang="js" inline />
will be rendered inline.
</p>
<!-- 선택적: defaultColor (기본 색상) -->
<Code code={`const foo = 'bar';`} lang="js" defaultColor={false} />
```

이 컴포넌트는 빌드 시 코드 블록에 구문 강조 표시를 제공합니다 (클라이언트 측 JavaScript는 포함되지 않음). 이 컴포넌트는 내부적으로 Shiki에 의해 구동되며 인기 있는 모든 [테마](https://shiki.style/themes)[언어](https://shiki.style/languages)를 지원합니다. 또한 사용자 정의 테마, 언어, [transformers](#transformers)[기본 색상](https://shiki.style/guide/dual-themes#without-default-color)을 각각 `theme`, `lang`, `transformers`, `defaultColor` 속성에 전달하여 추가할 수 있습니다.

:::note
이 컴포넌트는 [Shiki 구성](/ko/guides/markdown-content/#shiki-구성)에서 설정을 상속하지 **않습니다**. 컴포넌트 속성을 사용하여 설정해야 합니다.
:::

### Transformers

<p><Since v="4.11.0" /></p>

[Shiki transformers](https://shiki.style/packages/transformers#shikijs-transformers)는 선택적으로 `transformers` 속성에 배열을 전달하여 코드에 적용할 수 있습니다. Astro v4.14.0부터는 [Shiki의 `meta` 속성](https://shiki.style/guide/transformers#meta)에 문자열을 제공하여 transformers에 옵션을 전달할 수도 있습니다.

`transformers`는 클래스만 적용하므로 코드 블록의 요소를 타겟팅하려면 고유한 CSS 규칙을 제공해야 합니다.

```astro title="src/pages/index.astro" {12-13}
---
import { transformerNotationFocus, transformerMetaHighlight } from '@shikijs/transformers'
import { Code } from 'astro:components'
const code = `const foo = 'hello'
const bar = ' world'
console.log(foo + bar) // [!code focus]
`
---
<Code
code={code}
lang="js"
transformers={[transformerMetaHighlight()]}
meta="{1,3}"
/>
<style is:global>
pre.has-focused .line:not(.focused) {
filter: blur(1px);
}
</style>
```

## `<Fragment />`

[`set:*` 지시어](/ko/reference/directives-reference/#sethtml)와 함께 사용하여 추가 래핑 요소 없이 HTML 콘텐츠를 렌더링하는 컴포넌트입니다:

```astro title="src/components/SetHtml.astro" "Fragment"
---
const htmlString = '<p>Raw HTML content</p>';
---
<Fragment set:html={htmlString} />
```

Astro 구문에서 [프래그먼트 사용](/ko/basics/astro-syntax/#프래그먼트)에 대한 자세한 내용을 참조하세요.

## `<Prism />`

`Prism` 구문 강조 컴포넌트를 사용하려면 먼저 `@astrojs/prism` 패키지를 **설치**하세요:

<PackageManagerTabs>
<Fragment slot="npm">
```shell
npm install @astrojs/prism
```
</Fragment>
<Fragment slot="pnpm">
```shell
pnpm add @astrojs/prism
```
</Fragment>
<Fragment slot="yarn">
```shell
yarn add @astrojs/prism
```
</Fragment>
</PackageManagerTabs>

```astro
---
import { Prism } from '@astrojs/prism';
---
<Prism lang="js" code={`const foo = 'bar';`} />
```
이 컴포넌트는 Prism의 CSS 클래스를 적용하여 코드 블록에 언어별 구문 강조 표시를 제공합니다. 구문 강조 표시를 나타내기 위해 **Prism CSS 스타일시트를 제공**하거나 직접 가져와야 한다는 점에 유의하세요! 자세한 내용은 [Prism 구성 섹션](/ko/guides/markdown-content/#prism-구성)을 참조하세요.
[Prism에서 지원하는 언어 목록](https://prismjs.com/#supported-languages)에서 해당 언어의 별칭을 찾을 수 있습니다. 또한 `lang="astro"`를 사용하여 Astro 코드 블록을 표시할 수도 있습니다!
## `<Image />`
```astro title="src/components/MyComponent.astro"
---
// 이미지 컴포넌트와 이미지 가져오기
import { Image } from 'astro:assets';
import myImage from "../assets/my_image.png"; // 이미지는 1600x900
---
<!-- 이미지 컴포넌트에서 `alt`는 필수입니다. -->
<Image src={myImage} alt="A description of my image." />
```
```html
<!-- 출력 -->
<!-- 이미지가 최적화되고 적절한 속성이 적용됩니다. -->
<img
src="/_astro/my_image.hash.webp"
width="1600"
height="900"
decoding="async"
loading="lazy"
alt="A description of my image."
/>
```
### 속성
- src (필수)
- alt (필수)
- width and height (`public/` 및 원격 이미지에 대해 필수)
- format
- quality
- densities
- widths
위의 속성 외에도 `<Image />` 컴포넌트는 HTML `<img>` 태그가 허용하는 모든 속성을 허용합니다.
자세한 내용은 [이미지 가이드](/ko/guides/images/#image--astroassets)를 참조하세요.
## `<Picture />`
<p><Since v="3.3.0" /></p>
기본으로 제공되는 `<Picture />` Astro 컴포넌트를 사용하여 다양한 형식 및/또는 크기의 반응형 이미지를 표시할 수 있습니다.
```astro title="src/pages/index.astro"
---
import { Picture } from 'astro:assets';
import myImage from "../assets/my_image.png"; // 이미지는 1600x900
---
<!-- Picture 컴포넌트에서 `alt`는 필수입니다. -->
<Picture src={myImage} formats={['avif', 'webp']} alt="A description of my image." />
```
```html
<!-- 출력 -->
<picture>
<source srcset="/_astro/my_image.hash.avif" type="image/avif" />
<source srcset="/_astro/my_image.hash.webp" type="image/webp" />
<img
src="/_astro/my_image.hash.png"
width="1600"
height="900"
decoding="async"
loading="lazy"
alt="A description of my image."
/>
</picture>
```
자세한 내용은 [이미지 가이드](/ko/guides/images/#picture-)를 참조하세요.
### 속성
`<Picture />``<Image />` 컴포넌트의 모든 속성과 함께 다음을 허용합니다:
#### `formats`
`<source>` 태그에 사용할 이미지 형식의 배열입니다. 기본적으로 `['webp']`로 설정되어 있습니다.
#### `fallbackFormat`
`<img>` 태그의 대체 값으로 사용할 형식입니다. 기본값은 정적 이미지의 경우 `.png`, 애니메이션 이미지의 경우 `.gif`, SVG 파일의 경우 `.svg`입니다.
#### `pictureAttributes`
`<picture>` 태그에 추가할 속성의 객체입니다. 이 속성을 사용하여 외부 `<picture>` 요소 자체에 속성을 적용할 수 있습니다. `<Picture />` 컴포넌트에 적용된 속성은 이미지 변환에 사용된 속성을 제외하고 내부 `<img>` 요소에 직접 적용됩니다.
## `<Content />`
[콘텐츠 컬렉션 항목](/ko/guides/content-collections/#콘텐츠-컬렉션이란-무엇입니까)의 콘텐츠를 렌더링하는 데 사용되는 일반 컴포넌트입니다.
먼저 `getCollection()` 또는 `getEntry()`를 사용하여 하나 이상의 항목을 쿼리합니다. 그러면 `entry.render()` 함수는 `.astro` 파일 템플릿에서 사용할 `<Content />` 컴포넌트를 반환할 수 있습니다.
```astro title="src/pages/render-example.astro" {4, 7}
---
import { getEntry } from 'astro:content';
const entry = await getEntry('blog', 'post-1');
const { Content } = await entry.render();
---
<p>Published on: {entry.data.published.toDateString()}</p>
<Content />
```
## `<ViewTransitions />`
<p><Since v="2.9.0" /></p>
원하는 모든 페이지의 `<head>``<ViewTransitions />` 라우팅 컴포넌트를 가져와 추가하여 개별 페이지에서 view transitions를 사용하도록 설정합니다.
```astro title="src/pages/index.astro" ins={2,7}
---
import { ViewTransitions } from 'astro:transitions';
---
<html lang="en">
<head>
<title>My Homepage</title>
<ViewTransitions />
</head>
<body>
<h1>Welcome to my website!</h1>
</body>
</html>
```
페이지 요소 및 컴포넌트에 [라우터 제어](/ko/guides/view-transitions/#라우터-제어) 및 [전환 지시어를 추가](/ko/guides/view-transitions/#전환-지시어)하는 방법에 대한 자세한 내용을 참조하세요.
## `<Debug />`
```astro
---
import { Debug } from 'astro:components';
const serverObject = {
a: 0,
b: "string",
c: {
nested: "object"
}
}
---
<Debug {serverObject} />
```
이 컴포넌트는 JavaScript 없이 클라이언트 측에서 값을 검사할 수 있는 방법을 제공합니다.
1 change: 1 addition & 0 deletions src/content/docs/ko/reference/error-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ import DontEditWarning from '~/components/DontEditWarning.astro'
## 콘텐츠 컬렉션 오류

- [**UnknownContentCollectionError**](/ko/reference/errors/unknown-content-collection-error/)<br/>알 수 없는 콘텐츠 컬렉션 오류입니다.
- [**RenderUndefinedEntryError**](/ko/reference/errors/render-undefined-entry-error/)<br/>정의되지 않은 콘텐츠 컬렉션 항목을 렌더링하려고 했습니다.
- [**GetEntryDeprecationError**](/ko/reference/errors/get-entry-deprecation-error/)<br/>`getDataEntryById` 또는 `getEntryBySlug` 함수를 잘못 사용했습니다.
- [**InvalidContentEntryFrontmatterError**](/ko/reference/errors/invalid-content-entry-frontmatter-error/)<br/>콘텐츠 항목 프런트매터가 스키마와 일치하지 않습니다.
- [**InvalidContentEntrySlugError**](/ko/reference/errors/invalid-content-entry-slug-error/)<br/>잘못된 콘텐츠 항목 슬러그입니다.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: Attempted to render an undefined content collection entry.
i18nReady: true
githubURL: https://github.com/withastro/astro/blob/main/packages/astro/src/core/errors/errors-data.ts
---

## 무엇이 잘못되었나요?
Astro에서 정의되지 않은 콘텐츠 컬렉션 항목을 렌더링하려고 했습니다. 존재하지 않는 항목을 렌더링하려고 하면 이 오류가 발생할 수 있습니다.



Loading

0 comments on commit 71b7c4d

Please sign in to comment.