Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Astro v3 guide #4166

Merged
merged 141 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
f399b68
initial page
sarah11918 Aug 10, 2023
1f7eeba
a few entries to get us started
sarah11918 Aug 10, 2023
ef1325c
added some more entries
sarah11918 Aug 10, 2023
a6a08e6
document Astro.cookies, compressHTML and default port
sarah11918 Aug 10, 2023
58c0d69
updates sidebar entry and adds more items to guide
sarah11918 Aug 15, 2023
d870043
update sidebar in international versions
sarah11918 Aug 15, 2023
eee3d39
Merge branch 'main' into v3-upgrade-guide
sarah11918 Aug 15, 2023
95448d0
add more entries
sarah11918 Aug 15, 2023
61a35a5
typo: fix `astro.mjs.config` to `astro.config.mjs`
ElianCodes Aug 16, 2023
edfe8a9
refactor: endpoint methods to uppercase variants
ElianCodes Aug 16, 2023
2f4983c
chore: update DEL to DELETE
ElianCodes Aug 16, 2023
9e4f559
Merge branch 'main' into v3-upgrade-guide
sarah11918 Aug 16, 2023
e149212
Merge branch 'main' into v3-upgrade-guide
sarah11918 Aug 17, 2023
09f569f
chore: remove `<Markdown />` component
ElianCodes Aug 17, 2023
1adfb57
Merge branch 'main' into v3-upgrade-guide
sarah11918 Aug 18, 2023
6b0b53d
all beta 0 and 1 placeholders entered
sarah11918 Aug 18, 2023
5c87a8e
edit JSX entry
sarah11918 Aug 18, 2023
060607b
all placeholder entries in up to date!
sarah11918 Aug 18, 2023
33252d2
added experimental flags to remove
sarah11918 Aug 19, 2023
adc2cc4
deleted the assets page since it won't be in new docs
sarah11918 Aug 19, 2023
1f8262f
Merge branch 'main' into v3-upgrade-guide
sarah11918 Aug 19, 2023
6a32051
Update CSS Bundle Control for 3.0 (#4253)
lilnasy Aug 19, 2023
0f62bd2
Use astro: namespace modules (#4239)
matthewp Aug 19, 2023
58e22a8
feat: document astro features (#3924)
ematipico Aug 19, 2023
50a5f9e
feat: document logger for Astro integrations (#3817)
ematipico Aug 19, 2023
e76b7e6
removed Assets from sidebar since file was deleted
sarah11918 Aug 19, 2023
3210dcc
updated image links to point to page we want them to visit
sarah11918 Aug 19, 2023
fb9044b
edited removed astro image integration
sarah11918 Aug 19, 2023
d53181c
edited removed markdown component
sarah11918 Aug 19, 2023
427f073
edited build config options moved to adapters
sarah11918 Aug 19, 2023
2635170
remove extra build to adapter code samples
sarah11918 Aug 19, 2023
18c5a64
updated typescript version entry
sarah11918 Aug 19, 2023
864fc6d
kebab case, astro check entries done; end of REMOVEDs
sarah11918 Aug 19, 2023
747a91c
tralingslash default behavior entry
sarah11918 Aug 19, 2023
7cb56ee
htmlcompress entry
sarah11918 Aug 19, 2023
68f7316
scopedStyleStrategy and added links up to here
sarah11918 Aug 19, 2023
0db35b1
typo in trailingSlash
sarah11918 Aug 19, 2023
736d767
scoped style link
sarah11918 Aug 19, 2023
389d6a3
inlineStyleSheets plus code example syntax fixes up to here
sarah11918 Aug 19, 2023
a0ef058
class:list entries
sarah11918 Aug 19, 2023
aab8aaa
defalt port
sarah11918 Aug 19, 2023
1717ef3
getStaticPaths flattening entry
sarah11918 Aug 19, 2023
b5bead3
internal API endpoints entry
sarah11918 Aug 19, 2023
5117ac0
squoosh sharp
sarah11918 Aug 19, 2023
aeecbc8
HTTP request methods and more links to this point
sarah11918 Aug 19, 2023
00e6123
shortened image service title
sarah11918 Aug 19, 2023
cd4ef96
astro.cookies entry
sarah11918 Aug 19, 2023
714b5cb
final draft done!!
sarah11918 Aug 19, 2023
ea80c14
feat: document adapter features (#3917)
ematipico Aug 21, 2023
e58d9d9
Update capitalisation of GET
TheOtterlord Aug 21, 2023
873d99c
Apply suggestions from EVERYONE's code review!
sarah11918 Aug 21, 2023
4d76d73
Touche, Matthew.
sarah11918 Aug 21, 2023
09309f3
Every time someone has a good idea, we commit!
sarah11918 Aug 21, 2023
2f1fdf4
Document experimental JS API (#4234)
bluwy Aug 21, 2023
20f3664
Merge branch 'main' into v3-upgrade-guide
TheOtterlord Aug 22, 2023
41b0250
Update Firebase example to use cookies.has() (#4302)
matthewp Aug 22, 2023
c50bba3
last new entries for upgrade guide! Code freeze!
sarah11918 Aug 22, 2023
17a8228
Mostly formatting catches, also build config DEPRECATED and line high…
sarah11918 Aug 22, 2023
740d821
missed a formatting correction
sarah11918 Aug 22, 2023
98f8f99
moves build config options down to deprecated section
sarah11918 Aug 22, 2023
0412b2e
bluwy nits!
sarah11918 Aug 23, 2023
b41a7ba
earlier link to image upgrade advice
sarah11918 Aug 23, 2023
e164c37
upgrade node version to 18.14.1 in English files only
sarah11918 Aug 23, 2023
f71a939
removed examples that listed astrojs/image
sarah11918 Aug 23, 2023
733571b
Merge branch 'main' into v3-upgrade-guide
TheOtterlord Aug 23, 2023
03df3a8
Generate v3 reference docs (#4327)
TheOtterlord Aug 23, 2023
76ab7f0
deleting es/guides/assets
sarah11918 Aug 23, 2023
e7706e1
deleted guides/assets from nav.ts files that had it
sarah11918 Aug 23, 2023
dea089e
remove mention of assets folder from project structure
sarah11918 Aug 23, 2023
617eff8
Update `class:list` and astro-hash classes (#4322)
natemoo-re Aug 24, 2023
c421b01
Remove markdown draft reference (#4354)
bluwy Aug 24, 2023
f86509e
Merge branch 'main' into v3-upgrade-guide
sarah11918 Aug 24, 2023
108287a
update endpoints
ElianCodes Aug 25, 2023
88d2195
update endpoints
ElianCodes Aug 25, 2023
d3af1a3
apply Blu's suggestions
ElianCodes Aug 25, 2023
641806f
Merge branch 'main' into v3-upgrade-guide
sarah11918 Aug 25, 2023
07a353e
clearer, and scarier unexperimental image assets
sarah11918 Aug 25, 2023
0297c6c
translatable
sarah11918 Aug 25, 2023
a91adb3
View transitions 3.0 changes (#4320)
matthewp Aug 25, 2023
f14d83c
remove note to Team Docs
sarah11918 Aug 25, 2023
a944b81
remove Canadian spelling
sarah11918 Aug 25, 2023
bdb2bd8
remove advice to uninstall sharp
sarah11918 Aug 25, 2023
5ac2989
Merge branch 'main' into v3-upgrade-guide
sarah11918 Aug 25, 2023
a2901e3
Fix import
yanthomasdev Aug 27, 2023
5f74391
Merge branch 'main' into v3-upgrade-guide
yanthomasdev Aug 27, 2023
796ba50
friendly note!
sarah11918 Aug 27, 2023
65dcdea
ci: update reference docs (#4361)
astrobot-houston Aug 27, 2023
18897a4
ci: update integration docs (#4362)
astrobot-houston Aug 27, 2023
458b362
add deprication note to simple objects in endpoints
ElianCodes Aug 28, 2023
316b0e7
correct endpoints examples for ResponseWithEncoding
ElianCodes Aug 28, 2023
8190f7e
backnit
yanthomasdev Aug 29, 2023
0895eaf
put the v in the 2
yanthomasdev Aug 29, 2023
333cdd5
put the v in the 3
yanthomasdev Aug 29, 2023
7b89c40
put the v in the 3 part 2
yanthomasdev Aug 29, 2023
4bb5430
wording
yanthomasdev Aug 29, 2023
c4d2499
chore: supplement `functionPerRoute` docs (#4419)
ematipico Aug 29, 2023
355b667
Add note about passing classes to children
yanthomasdev Aug 29, 2023
9a8f0a3
Add some whitespace
yanthomasdev Aug 29, 2023
449aa61
Merge branch 'main' into v3-upgrade-guide
yanthomasdev Aug 29, 2023
2973b8e
i18n(ja): Update tutorial for v3 (#4415)
morinokami Aug 30, 2023
585d2ad
i18n(es): Update `tutorial/` `V3` (#4372)
Waxer59 Aug 30, 2023
dc1c9cf
i18n(ja): Update installation guides for v3 (#4414)
morinokami Aug 30, 2023
8153981
i18n(es): Update install/v3 (#4379)
Waxer59 Aug 30, 2023
8f2b8fe
ci: update integration docs (#4400)
astrobot-houston Aug 30, 2023
695855e
i18n(es): Update `view-transitions.mdx v3` (#4370)
Waxer59 Aug 30, 2023
9e441de
i18n(pt-BR): Update remaining `reference/` pages for 3.0 (#4407)
yanthomasdev Aug 30, 2023
027540c
i18n(ja): Update integrations-guide.mdx for v3 (#4398)
morinokami Aug 30, 2023
490e92b
i18n(ja): Update vercel.mdx for v3 (#4397)
morinokami Aug 30, 2023
55098b7
i18n(ja): Update styling.mdx for v3 (#4413)
morinokami Aug 30, 2023
9ad5898
i18n(ja): Update middleware.mdx for v3 (#4412)
morinokami Aug 30, 2023
3cd09f3
i18n(es): Update `reference/` `V3` (#4409)
Waxer59 Aug 30, 2023
4a06bb0
i18n(ja): Update content-collections.mdx for v3 (#4396)
morinokami Aug 30, 2023
3a286f5
i18n(ja): Update project-structure.mdx for v3 (#4395)
morinokami Aug 30, 2023
a1b49a5
i18n(ja): Update why-astro.mdx for v3 (#4394)
morinokami Aug 30, 2023
799eb0d
i18n(es): Update `guides/` `V3` (#4383)
Waxer59 Aug 30, 2023
33687c8
i18n(es): Update guides/integrations-guide/ V3 (#4381)
Waxer59 Aug 30, 2023
8d3db5f
i18n(es): Update guides/backend/ & guides/deploy/ V3 (#4380)
Waxer59 Aug 30, 2023
852468d
i18n(es): Update recipes/ V3 (#4373)
Waxer59 Aug 30, 2023
872dd99
i18n(es): Updated `concepts/` & `core-concepts/` `V3` (#4377)
Waxer59 Aug 30, 2023
1e7ff27
i18n(pt-BR): Update `view-transitions.mdx` for 3.0 (#4392)
yanthomasdev Aug 30, 2023
5fe70e3
i18n(pt-BR): Translate `upgrade-to/v3` and update smaller 3.0 changes…
yanthomasdev Aug 30, 2023
6429039
i18n(es): Translate `v3.mdx` `V3` (#4375)
Waxer59 Aug 30, 2023
6c1375f
i18n(es): Update vercel.mdx V3 (#4423)
Waxer59 Aug 30, 2023
197ec20
Add v3 callout to getting started page
delucis Aug 30, 2023
0ecb373
i18n(es): Update `images` `V3` (#4408)
Waxer59 Aug 30, 2023
44e1d3e
i18n(zh-cn): Upgrade to Astro v3 guide for simplified Chinese (#4353)
liruifengv Aug 30, 2023
fc1881e
i18n(ja): Update view-transitions.mdx for v3 (#4424)
morinokami Aug 30, 2023
9cb7d78
[v3 image assets] (#3739)
sarah11918 Aug 30, 2023
437cc33
fix link 1
yanthomasdev Aug 30, 2023
37ac626
fix link 2
yanthomasdev Aug 30, 2023
7e61c23
fix link 3
yanthomasdev Aug 30, 2023
09653b0
Merge branch 'main' into v3-upgrade-guide
yanthomasdev Aug 30, 2023
9b1bdb5
Remove `#draft-pages` link
yanthomasdev Aug 30, 2023
de5cb1c
i18n(zh-cn): Update getting-started.mdx (#4426)
liruifengv Aug 30, 2023
c5152b8
i18n(es): update getting started (#4427)
Waxer59 Aug 30, 2023
87f605d
Update PT-BR getting-started
yanthomasdev Aug 30, 2023
43414ca
Merge branch 'main' into v3-upgrade-guide
yanthomasdev Aug 30, 2023
6eecb05
FIX ALL THEM LINKS
yanthomasdev Aug 30, 2023
3f924b7
Merge branch 'v3-upgrade-guide' of https://github.com/withastro/docs …
yanthomasdev Aug 30, 2023
52939cd
fix link to experimental option
sarah11918 Aug 30, 2023
b8081b5
FIX LINKS PLEASE
yanthomasdev Aug 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@
from = "/:lang/guides/client-side-routing"
to = "/:lang/guides/view-transitions"

[[redirects]]
from = "/:lang/guides/assets"
to = "/:lang/guides/images"

[[redirects]]
from = "/:lang/guides/integrations-guide/image"
to = "/:lang/guides/images"

[[redirects]]
from = "/:lang/migration/0.21.0"
to = "/:lang/guides/upgrade-to/v1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Since from '~/components/Since.astro';
Astro bietet dir verschiedene Möglichkeiten, Bilder auf deiner Website zu verwenden, ganz gleich, ob sie lokal in deinem Projekt gespeichert sind, auf anderen Quellen verlinkt werden oder in einem CMS oder CDN gespeichert sind!

:::note[Assets verwenden (Experimentell)]
Die experimentelle Asset-Unterstützung wurde in `astro@2.1.0` hinzugefügt. Wenn du die Unterstützung für Assets aktiviert hast, findest du weitere Informationen in der [Asset-Anleitung (Experimentell)](/de/guides/assets/).
Die experimentelle Asset-Unterstützung wurde in `astro@2.1.0` hinzugefügt. Wenn du die Unterstützung für Assets aktiviert hast, findest du weitere Informationen in der [Asset-Anleitung (Experimentell)](/de/guides/images/).

**Einige der folgenden Ratschläge sind nicht mit der experimentellen Flag kompatibel.**
:::
Expand Down Expand Up @@ -38,7 +38,7 @@ import rocket from '../images/rocket.svg';

Du kannst die Standard Markdown `![]()` Syntax oder die Standard HTML `<img>`-Tags in deinen `.md`-Dateien für Bilder verwenden, die sich in deinem `public/`-Ordner befinden, oder für Remote-Bilder auf einem anderen Server.

Wenn du deine Bilder nicht in `public/` speichern kannst, empfehlen wir, die [experimentelle Unterstützung für Assets](/de/guides/assets/) zu aktivieren oder das Dateiformat `.mdx` zu verwenden, mit dem du importierte Komponenten mit einer Markdown-ähnlichen Syntax kombinieren kannst. Verwende die [MDX-Integration](/de/guides/integrations-guide/mdx/), um Astro-Unterstützung für MDX hinzuzufügen.
Wenn du deine Bilder nicht in `public/` speichern kannst, empfehlen wir, die [experimentelle Unterstützung für Assets](/de/guides/images/) zu aktivieren oder das Dateiformat `.mdx` zu verwenden, mit dem du importierte Komponenten mit einer Markdown-ähnlichen Syntax kombinieren kannst. Verwende die [MDX-Integration](/de/guides/integrations-guide/mdx/), um Astro-Unterstützung für MDX hinzuzufügen.

```md
<!-- src/pages/post-1.md -->
Expand Down Expand Up @@ -121,7 +121,7 @@ Das Attribut `src` ist **relativ zum öffentlichen Ordner**. In Markdown kannst

### `src/assets/` (experimentell)

In der Anleitung [Assets (Experimentell)](/de/guides/assets/) kannst du nachlesen, wie du den Ordner `/assets/` experimentell nutzen kannst.
In der Anleitung [Assets (Experimentell)](/de/guides/images/) kannst du nachlesen, wie du den Ordner `/assets/` experimentell nutzen kannst.

Dazu musst du deine bestehenden Bilder aktualisieren, die aktuelle Astro-Bildintegration entfernen und zusätzliche manuelle Änderungen vornehmen, um einige der neuen Funktionen zu nutzen.

Expand All @@ -132,7 +132,7 @@ Die offizielle Bild-Integration von Astro bietet zwei verschiedene Astro-Kompone
Nach der [Installation von `@astrojs/image`](/de/guides/integrations-guide/image/#installation) kannst du diese beiden Komponenten überall dort verwenden, wo du Astro-Komponenten verwenden kannst: in `.astro`- und `.mdx`-Dateien.

:::note[Inkompatibel mit Assets]
Wenn du die experimentelle Asset-Unterstützung aktiviert hast, musst du die offizielle Integration deinstallieren. Weitere Informationen findest du im [Assets (Experimental) Guide](/de/guides/assets/).
Wenn du die experimentelle Asset-Unterstützung aktiviert hast, musst du die offizielle Integration deinstallieren. Weitere Informationen findest du im [Assets (Experimental) Guide](/de/guides/images/).
:::

### `<Image />`
Expand Down
File renamed without changes.
373 changes: 373 additions & 0 deletions old-translations/ja/images.mdx

Large diffs are not rendered by default.

163 changes: 163 additions & 0 deletions old-translations/zh-CN/guides/images.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
---
title: 图片
description: 学习如何在 Astro 项目中包含图片。
i18nReady: true
---
import Since from '~/components/Since.astro';


在 Astro 项目中,有很多种在网站中使用图片的方式。无论是用存储在项目中的图片,还是链接外部图片,亦或从像 CMS(内容管理系统)或 CDN(内容分发网络)这样的地方加载图片,都没问题!

:::note[`astro:assets` (Experimental - coming in v3.0)]
实验性 `astro:assets` 模块将在 `astro@3.0` 中默认启用.

请按照 [资源(实验性)使用指南](/zh-cn/guides/images/) 开始使用新的图片解决方案!

**下面的一些建议可能与实验性标志不兼容。如果你正在使用 `astro:assets` 请参考资源页面。**
:::

### 在 `.astro` 文件中

你可以在 `.astro` 文件中使用标准的 HTML `<img>` 或 `<img />` 元素来展示图片,同时也支持所有 HTML 图片属性。

src 属性是必需的,其格式取决于图像的存储位置以及你是否启用了对资源的实验性支持:

```astro
---
// src/pages/index.astro
import rocket from '../images/rocket.svg';
---
<!-- 位于其它服务器上的图片 -->
<img src="https://docs.astro.build/assets/logomark-light.png" width="25" alt="Astro">

<!-- 存储在 public/assets/stars.png 的本地图片 -->
<img src="/assets/stars.png" alt="一片繁星闪烁的夜空。">

<!-- 存储在 src/images/rocket.svg 的本地图片 -->
<img src={rocket} alt="外空中的一架火箭。"/>
```

### 在 Markdown 文件中

可以在 `.md` 文件中使用 Markdown 标准语法 `![]()`,或 HTML 标准语法 `<img>` 标签,来调用位于 `public/` 文件夹下或其它服务器上的图片。

如果你无法将图片保留在 `public/` 中,我们建议启用 [资源的实验性支持](/zh-cn/guides/images/), 或使用 `.mdx` 文件格式,该格式允许你将导入的组件与类似 Markdown 的语法结合起来。使用 [MDX 集成](/zh-cn/guides/integrations-guide/mdx/) 向 Astro 添加对 MDX 的支持。
```md
<!-- src/pages/post-1.md -->

# 我的 Markdown 页面

<!-- 存储在 public/assets/stars.png 的本地图片 -->
![一片繁星闪烁的夜空。](/assets/stars.png)
<img src="/assets/stars.png" alt="一片繁星闪烁的夜空。">

<!-- 位于其它服务器上的图片 -->
![Astro](https://docs.astro.build/assets/logomark-light.png)
<img src="https://docs.astro.build/assets/logomark-light.png" width="25" alt="Astro">
```

### 在 MDX 文件中

你可以在 .mdx 文件中使用标准 Markdown `![]()` 语法或 JSX 的 `<img />` 标签来显示 `public/ ` 文件夹或远程服务器中的图片。

此外,你也可以导入和使用位于项目 `src/` 目录中的图像,就像在 Astro 组件中一样。


```mdx title="src/pages/post-1.mdx"

import rocket from '../images/rocket.svg';

# My MDX Page

// 存放在项目中 src/images/rocket.svg 路径的图片
<img src={rocket} alt="外空中的一架火箭。"/>

// 存放在项目中 public/assets/stars.png 路径的图片
![一片繁星闪烁的夜空。](/assets/stars.png)
<img src="/assets/stars.png" alt="一片繁星闪烁的夜空。" />

// 位于其它服务器上的图片
![Astro](https://docs.astro.build/assets/logomark-light.png)
<img src="https://docs.astro.build/assets/logomark-light.png" width="25" alt="Astro" />
```

### UI 框架中的组件

当在 [UI 框架组件](/zh-cn/core-concepts/framework-components/)(例如 React、Svelte)中添加图像时,请使用适合该框架的图像语法。



## 存放图片的位置

### `src/`

存储在 `src/`中的图像可以由组件(`.astro`,`.mdx`和其他 UI 框架)使用,但不能在 Markdown 文档中使用。

如果您必须使用 Markdown 文档,我们建议你将图像保存在 ['public/'](#public) 中或 [远程](#使用-cms-或-cdn-上的图片) 存储他们。

从任何组件文档中的 **相对文档路径** 或 [导入别名](/zh-cn/guides/aliases/) 导入它们,然后像使用 `src`属性一样使用。

```astro
---
// src/pages/index.astro

// Access images in `src/images/`
import logo from '../images/logo.png';
---
<img src={logo} width="40" alt="Astro 的图标" />
```

### `public/`

存储在 `public/` 中的图像可以被组件(`.astro`,`.mdx`和其他UI框架)和Markdown文档使用。

然而,位于 `/public` 目录中的文件始终按原样提供或复制,不进行任何处理。如果你在 Markdown 文件之外使用图像,我们建议尽可能将本地图像保存在 `src/` 中,以便 Astro 对其进行转换、优化和打包。

`src` 属性是 **相对于 public 文件夹的**。在 Markdown 中,你可以使用 `![]()` 表示。

```astro
---
// src/pages/index.astro

// 存取放在 `public/images/` 里的图片
---
<img src="/images/logo.png" />
```

### `src/assets/` (实验性)

请参阅 [资源(实验性)](/zh-cn/guides/images/) 指南,了解如何启用 `/assets/` 文件夹的实验性用法。

这将需要你更新现有图片,删除当前的 Astro 图片集成,并且还需要额外的手动更改以利用其某些新功能。

## Astro 的图片集成

:::note[将在 v3.0 中弃用]
Astro v3 将不再主动支持 [`@astrojs/image`](https://github.com/withastro/astro/tree/main/packages/integrations/image) 集成

我们建议你尽早删除它,并使用将内置在 `astro@3.0` 中的实验性 `astro:assets` 模块。

请按照 [资源(实验性)使用指南](/zh-cn/guides/images/) 开始使用新的图片解决方案!

**`astro:assets` 目前还不能完全替代 `@astrojs/image` ,但它正在被积极开发中。**
:::

有关在 Astro v2 中使用 `@astrojs/image` 的文档,请参阅 [`@astrojs/image` 文档](https://github.com/withastro/astro/blob/main/packages/integrations/image/README.md)

## 使用 CMS 或 CDN 上的图片

Image CDN 可与 Astro 配合使用,可将图片的完整网址作为 `<img>` 标签中的 `src` 属性或 Markdown 标记

如果 CDN 提供了 Node.js SDK ,则可以在项目中使用它。例如,[Cloudinary 的 SDK](https://cloudinary.com/documentation/node_integration) 可以生成带有相应 `src` 属性 的 ` <img>` 标签。

## Alt Text

并非所有用户都能以相同的方式查看图片,因此在使用图片时可访问性是一个特别重要的问题。使用 `alt` 属性为图片提供 [描述性替代文本](https://www.w3.org/WAI/tutorials/images/)。

此属性对于映像集成的 `<Image />` 和 `<Picture/>` 组件是必需的,如果未提供替代文本,这些组件将引发错误。

如果图像只是装饰性的(即无助于理解页面)请设置 `alt=""`,以便屏幕阅读器知道忽略该图像。

## 社区开发的集成

除了官方的 [`@astrojs/image`](/zh-cn/guides/integrations-guid/image/) 集成外,社区还开发了[社区图片集成](https://astro.build/integrations?search=images),用于处理和优化 Astro 项目中的图片。
2 changes: 1 addition & 1 deletion src/content/docs/ar/core-concepts/astro-components.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ const { title } = Astro.props

- لا يدعمون frontmatter، أو الإستيراد على جانب الخادم (Server-side imports)، أو التعابير الديناميكية.
- أي وسوم `<script>` تُركت غير مجمّعة، سيتم التعامل معها كما لو انها تحتوي على `is:inline`.
- يمكنهم فقط [إسناد الموارد الموجودة في مجلد `public/`](/ar/guides/images/#public)
- يمكنهم فقط [إسناد الموارد الموجودة في مجلد `public/`](/ar/core-concepts/project-structure/#public)

:::note
[عنصر `<slot />`](/ar/core-concepts/astro-components/#المداخل) الموجود داخل مكوّن HTML سيعمل كما يعمل في مكوّن أسترو. لإستخدام عنصر ["HTML Web Component Slot"](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/slot) بدلًا من ذلك، أضف `is:inline` إلى عنصر `<slot />` الخاص بك.
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/en/concepts/why-astro.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,6 @@ One of our favorite sayings is: **opt-in to complexity.** We designed Astro to r

**Astro is an all-in-one web framework that comes with everything you need to build a website.** Astro includes a component syntax, file-based routing, asset handling, a build process, bundling, optimizations, data-fetching, and more. You can build great websites without ever reaching outside of Astro's core feature set.

If you need more control, you can extend Astro with over [100+ integrations](https://astro.build/integrations/) like [React](https://www.npmjs.com/package/@astrojs/react), [Svelte](https://www.npmjs.com/package/@astrojs/svelte), [Vue](https://www.npmjs.com/package/@astrojs/vue), [Tailwind CSS](https://www.npmjs.com/package/@astrojs/tailwind), [MDX](https://www.npmjs.com/package/@astrojs/mdx), [image optimizations](https://www.npmjs.com/package/@astrojs/image), and more. [Connect your favorite CMS](/en/guides/cms/) or [deploy to your favorite host](/en/guides/deploy/) with just a single command.
If you need more control, you can extend Astro with over [100+ integrations](https://astro.build/integrations/) like [React](https://www.npmjs.com/package/@astrojs/react), [Svelte](https://www.npmjs.com/package/@astrojs/svelte), [Vue](https://www.npmjs.com/package/@astrojs/vue), [Tailwind CSS](https://www.npmjs.com/package/@astrojs/tailwind), [MDX](https://www.npmjs.com/package/@astrojs/mdx), and more. [Connect your favorite CMS](/en/guides/cms/) or [deploy to your favorite host](/en/guides/deploy/) with just a single command.

Astro is UI-agnostic, meaning you can **Bring Your Own UI Framework (BYOF)**. React, Preact, Solid, Svelte, Vue, and Lit are all officially supported in Astro. You can even mix and match different frameworks on the same page, making future migrations easier and preventing project lock-in to a single framework.
2 changes: 1 addition & 1 deletion src/content/docs/en/core-concepts/astro-components.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ Astro supports importing and using `.html` files as components or placing these
HTML components must contain only valid HTML, and therefore lack key Astro component features:
- They don't support frontmatter, server-side imports, or dynamic expressions.
- Any `<script>` tags are left unbundled, treated as if they had `is:inline`.
- They can only [reference assets that are in the `public/` folder](/en/guides/images/#public).
- They can only [reference assets that are in the `public/` folder](/en/core-concepts/project-structure/#public).

:::note
A [`<slot />` element](/en/core-concepts/astro-components/#slots) inside an HTML component will work as it would in an Astro component. In order to use the [HTML Web Component Slot](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/slot) element instead, add `is:inline` to your `<slot>` element.
Expand Down
Loading
Loading