Webéēŗć®äøēćÆåøøć«é²åćć¦ćććę°ćććć¼ć«ććć¬ć¼ć ćÆć¼ćÆćē»å “ćē¶ćć¦ćć¾ćććć®äøć§ćčæ幓ćē¹ć«ę³Øē®ćéćć¦ććć®ććAstroćć§ćććć®ććć°čØäŗć§ćÆćAstroćØćÆä½ćććŖćå¤ćć®éēŗč ć«éøć°ćć¦ććć®ććććć¦åŗę¬ēćŖä½æćę¹ć«ć¤ćć¦ćååæč ć®ę¹ć«ćåćććććč§£čŖ¬ćć¦ććć¾ććāØ
1. AstroćØćÆļ¼ š¤
AstroćÆćć³ć³ćć³ćé§ååć®Webćµć¤ćļ¼ććć°ććć¼ć±ćć£ć³ć°ćµć¤ććeć³ćć¼ć¹ćµć¤ććŖć©ļ¼ćé«éć«ę§ēÆććććć«čØčØććććŖć¼ć«ć¤ć³ćÆć³ć®Webćć¬ć¼ć ćÆć¼ćÆć§ćć2021幓ć«ęåć®ćć¼ćøć§ć³ććŖćŖć¼ć¹ćććęÆč¼ēę°ćććć¬ć¼ć ćÆć¼ćÆć§ććććć®é©ę°ēćŖć¢ććć¼ććØé«ćććć©ć¼ćć³ć¹ć§ę„éć«äŗŗę°ćéćć¦ćć¾ćć
Astroć®ę大ć®ē¹å¾“ćÆććć¢ć¤ć©ć³ćć¢ć¼ćććÆćć£ļ¼Islands Architectureļ¼ććØå¼ć°ććę°ććććć³ććØć³ćć¢ć¼ćććÆćć£ćę”ēØćć¦ććē¹ć§ććććć«ćććäøč¦ćŖJavaScriptćčŖåēć«åé¤ććWebćµć¤ćć®čŖćæč¾¼ćæéåŗ¦ćåēć«åäøćććććØćć§ćć¾ććä»ć®å¤ćć®ćć¬ć¼ć ćÆć¼ćÆćåęč”Øē¤ŗć«å¤§éć®JavaScriptćåæ č¦ćØććć®ć«åƾććAstroćÆććć©ć«ćć§ć¼ćJavaScriptćē®ęćć¾ććć¤ć³ćæć©ćÆćć£ćę§ćåæ č¦ćŖéØåļ¼ććććć¢ć¤ć©ć³ćććØå¼ć³ć¾ćšļøļ¼ć ććéøęēć«ćć¤ćć¬ć¼ć·ć§ć³ļ¼JavaScriptćęå¹åļ¼ććććØć§ćććć©ć¼ćć³ć¹ćØć¤ć³ćæć©ćÆćć£ćę§ćäø”ē«ććć¦ćć¾ćć
Astroć®čØčØęę³ćÆćć³ć³ćć³ćé§åćććµć¼ćć¼ćć”ć¼ć¹ćććććć©ć«ćć§é«éććē°”åć«ä½æććććéēŗč ćéč¦ććØćć5ć¤ć®ååć«åŗć„ćć¦ćć¾ććē¹ć«ććAstroć§é ćWebćµć¤ććä½ćć®ćÆäøåÆč½ć§ććć¹ćć ććØććē®ęØćę²ćć¦ććē¹ćÆćććć©ć¼ćć³ć¹ćøć®å¼·ććć ćććē¤ŗćć¦ćć¾ćć
2. AstroććÆćććęŗå š ļø
Astroćććøć§ćÆććéå§ććć®ćÆéåøøć«ē°”åć§ććNode.js (v16.12.0仄éęØå„Ø) ćć¤ć³ć¹ćć¼ć«ććć¦ććē°å¢ć§ććć°ć仄äøć®ć³ćć³ććå®č”ććć ćć§ćć
# npmćä½æćå “å
npm create astro@latest
# yarnćä½æćå “å
yarn create astro
# pnpmćä½æćå “å
pnpm create astro
ć³ćć³ććå®č”ćććØććććøć§ćÆćåćä½æēØćććć³ćć¬ć¼ććTypeScriptć®čØå®ćŖć©ćåÆ¾č©±å½¢å¼ć§éøęć§ćć¾ććååæč ć®ę¹ćÆćć¾ććÆć·ć³ćć«ćŖćć³ćć¬ć¼ćļ¼`Empty` ć `Blog` ćŖć©ļ¼ććå§ććć®ćććććć§ćć
ćććøć§ćÆććä½ęććććććć£ć¬ćÆććŖć«ē§»åćć¦ä¾åé¢äæćć¤ć³ć¹ćć¼ć«ććéēŗćµć¼ćć¼ćčµ·åćć¾ćć
# ćććøć§ćÆććć£ć¬ćÆććŖć«ē§»å
cd your-project-name
# ä¾åé¢äæćć¤ć³ć¹ćć¼ć«
npm install
# éēŗćµć¼ćć¼ćčµ·å
npm run dev
éēŗćµć¼ćć¼ćčµ·åćććØćććć©ć«ćć§ćÆ `http://localhost:4321` ć§ć¢ćÆć»ć¹ć§ććććć«ćŖćć¾ćććć©ć¦ć¶ć§éćć¦ćAstroć®ć¦ć§ć«ć«ć ćć¼ćøćč”Øē¤ŗćććć°ęåć§ćļ¼š
ćććøć§ćÆćć®ę§é
ä½ęććććććøć§ćÆććÆć仄äøć®ćććŖåŗę¬ēćŖćć£ć¬ćÆććŖę§é ćęć£ć¦ćć¾ćć
ćć£ć¬ćÆććŖ/ćć”ć¤ć« | čŖ¬ę |
---|---|
src/ | ćććøć§ćÆćć®ć½ć¼ć¹ć³ć¼ććå«ć¾ććäø»č¦ćŖćć£ć¬ćÆććŖć |
src/pages/ | ćµć¤ćć®ćć¼ćøćä½ęććå “ęćććć«ćć.astro , .md , .html ćć”ć¤ć«ćÆčŖåēć«ćć¼ćøćØćć¦ć«ć¼ćć£ć³ć°ććć¾ćććć”ć¤ć«ćć¼ć¹ć«ć¼ćć£ć³ć°ćę”ēØććć¦ćć¾ćć |
src/layouts/ | č¤ę°ć®ćć¼ćøć§å ±ęćććć¬ć¤ć¢ć¦ćć³ć³ćć¼ćć³ććé ē½®ćć¾ćććććć¼ććććæć¼ćŖć©å ±éć®UIę§é ćå®ē¾©ććć®ć«ä¾æå©ć§ćć |
src/components/ | åå©ēØåÆč½ćŖUIć³ć³ćć¼ćć³ćļ¼.astro ćć”ć¤ć«ćä»ć®UIćć¬ć¼ć ćÆć¼ćÆć®ć³ć³ćć¼ćć³ćļ¼ćé
ē½®ćć¾ćć |
src/styles/ | ć°ćć¼ćć«ćŖCSSćć”ć¤ć«ćŖć©ćé ē½®ćć¾ćć |
public/ | ē»åććć©ć³ććfaviconćŖć©ććć«ćććć»ć¹ć§å¦ēćććŖćéēć¢ć»ćććé ē½®ćć¾ććććć®ćć”ć¤ć«ćÆćć®ć¾ć¾ćµć¤ćć®ć«ć¼ćć«ć³ćć¼ććć¾ćć |
astro.config.mjs | Astroćććøć§ćÆćć®čØå®ćć”ć¤ć«ćć¤ć³ćć°ć¬ć¼ć·ć§ć³ć®čæ½å ććć«ććŖćć·ć§ć³ć®å¤ę“ćŖć©ćč”ćć¾ćć |
package.json | ćććøć§ćÆćć®ä¾åé¢äæćć¹ćÆćŖćććå®ē¾©ććć¦ćć¾ćć |
3. Astroć®ć³ć¢ć³ć³ć»ćć āØ
Astroćä½æćććŖćäøć§éč¦ćŖćććć¤ćć®ć³ć¢ć³ć³ć»ćććč¦ć¦ććć¾ćććć
Astroć³ć³ćć¼ćć³ć (.astroćć”ć¤ć«)
Astroć®åŗę¬ēćŖę§ęč¦ē“ ćÆćAstroć³ć³ćć¼ćć³ććć§ćććććÆ.astro
ćØććę”å¼µåćęć¤ćć”ć¤ć«ć§å®ē¾©ććć¾ććHTMLć«ä¼¼ćę§ęćęć”ć¾ćććććć¤ćć®ć¦ćć¼ćÆćŖē¹å¾“ćććć¾ćć
<!-- src/components/MyComponent.astro -->
---
// ć³ć³ćć¼ćć³ćć¹ćÆćŖćć (ććć³ćććæć¼)
// JavaScript/TypeScriptć³ć¼ććććć«ęøćć¾ćć
// ćććÆćµć¼ćć¼ćµć¤ćć§ć®ćæå®č”ććć¾ćć
const name = "Astro";
const items = ["Item 1", "Item 2", "Item 3"];
// PropsćåćåćććØćć§ćć¾ć
export interface Props {
greeting?: string;
}
const { greeting = "Hello" } = Astro.props;
---
<!-- HTMLćć³ćć¬ć¼ć -->
<div class="card">
<h2>{greeting}, {name}!</h2>
<p>ćććÆAstroć³ć³ćć¼ćć³ćć§ćć</p>
<ul>
{items.map((item) => (
<li>{item}</li>
))}
</ul>
<!-- ć¹ććć: ä»ć®ć³ć³ćć¼ćć³ćććć³ć³ćć³ććåćåćå “ę -->
<slot />
</div>
<!-- ć¹ćæć¤ć« (ććć©ć«ćć§ć¹ć³ć¼ćä»ć) -->
<style>
.card {
border: 1px solid #ccc;
padding: 1rem;
border-radius: 8px;
background-color: #f9f9f9;
}
h2 {
color: rebeccapurple;
}
</style>
Astroć³ć³ćć¼ćć³ććÆäø»ć«3ć¤ć®éØåć§ę§ęććć¾ćć
- ć³ć³ćć¼ćć³ćć¹ćÆćŖćć (ć³ć¼ććć§ć³ć¹
---
å ): ćµć¼ćć¼ćµć¤ćć§å®č”ćććJavaScript/TypeScriptć³ć¼ććęøćå “ęć§ćććć¼ćæć®ćć§ćććå¤ę°ć®å®ē¾©ćpropsć®åćåććŖć©ćč”ćć¾ććććć§å®ē¾©ćććå¤ę°ćÆćäøć®HTMLćć³ćć¬ć¼ćå ć§ę³¢ę¬å¼§{}
ćä½æć£ć¦åē §ć§ćć¾ćć - HTMLćć³ćć¬ć¼ć: ć³ć³ćć¼ćć³ćć®HTMLę§é ćå®ē¾©ćć¾ććéåøøć®HTMLćæć°ć«å ććä»ć®Astroć³ć³ćć¼ćć³ććUIćć¬ć¼ć ćÆć¼ćÆć³ć³ćć¼ćć³ććć¤ć³ćć¼ććć¦ä½æēØć§ćć¾ććJSXć©ć¤ćÆćŖå¼ļ¼
{variable}
,{array.map(...)}
,{condition && ...}
ćŖć©ļ¼ćä½æć£ć¦åēćŖć³ć³ćć³ććåćč¾¼ćććØćć§ćć¾ćć - ć¹ćæć¤ć« (
<style>
ćæć°å ): ć³ć³ćć¼ćć³ćć«é©ēØććCSSćęøćć¾ććććć©ć«ćć§ćÆćććć«ęøćććć¹ćæć¤ć«ćÆćć®ć³ć³ćć¼ćć³ćå ć§ć®ćæęå¹ćŖć¹ć³ć¼ćä»ćCSSćØćŖćć¾ććććć«ćććć¹ćæć¤ć«ćä»ć®ć³ć³ćć¼ćć³ćć«å½±éæćäøććć®ćé²ćć¾ććć°ćć¼ćć«ćŖć¹ćæć¤ć«ćå®ē¾©ćććå “åćÆć<style is:global>
ćä½æēØćć¾ćć
ćć¼ćø (src/pages/)
src/pages/
ćć£ć¬ćÆććŖć«é
ē½®ććć .astro
, .md
, .markdown
ćć”ć¤ć«ćÆćčŖåēć«ćµć¤ćć®ćć¼ćøć«ćŖćć¾ćććć”ć¤ć«åććć®ć¾ć¾URLć®ćć¹ć«åƾåæćć¾ćļ¼ćć”ć¤ć«ćć¼ć¹ć«ć¼ćć£ć³ć°ļ¼ć
src/pages/index.astro
ā/
src/pages/about.astro
ā/about
src/pages/blog/post-1.md
ā/blog/post-1
åēćŖć«ć¼ćļ¼ä¾: /posts/[id]
ļ¼ćä½ęåÆč½ć§ćććć”ć¤ć«åć«č§ę¬å¼§[]
ćä½æēØćć¾ćļ¼ä¾: src/pages/posts/[id].astro
ļ¼ććććć®ćć¼ćøć§ćÆćgetStaticPaths()
é¢ę°ćä½æć£ć¦ćēęćććć¼ćøć®ćć¹ćØćåćć¼ćøć«ęø”ććć¼ćæćå®ē¾©ćć¾ćć
ć¬ć¤ć¢ć¦ć (src/layouts/)
ć¬ć¤ć¢ć¦ććÆćč¤ę°ć®ćć¼ćøć§å
±éć®HTMLę§é ļ¼ćććć¼ććććæć¼ćććć²ć¼ć·ć§ć³ćŖć©ļ¼ćåå©ēØććććć®Astroć³ć³ćć¼ćć³ćć§ććéåøøćsrc/layouts/
ćć£ć¬ćÆććŖć«é
ē½®ććć¾ćć
<!-- src/layouts/BaseLayout.astro -->
---
export interface Props {
title: string;
}
const { title } = Astro.props;
---
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>{title} | ćć¤ćµć¤ć</title>
<link rel="stylesheet" href="/styles/global.css">
<!-- ććć§ViewTransitionsćć¤ć³ćć¼ć -->
<!-- import { ViewTransitions } from 'astro:transitions'; -->
<!-- <ViewTransitions /> -->
</head>
<body>
<header>
<nav>
<a href="/">ćć¼ć </a>
<a href="/about">ę¦č¦</a>
</nav>
</header>
<main>
<!-- ćć¼ćøåŗęć®ć³ć³ćć³ććććć«ęæå
„ććć -->
<slot />
</main>
<footer>
<p>Ā© 2025 ćć¤ćµć¤ć</p>
</footer>
</body>
</html>
ćć¼ćøć³ć³ćć¼ćć³ćļ¼ä¾: src/pages/index.astro
ļ¼ćććć®ć¬ć¤ć¢ć¦ććä½æēØććć«ćÆćć¬ć¤ć¢ć¦ćć³ć³ćć¼ćć³ććć¤ć³ćć¼ććć¦ććć¼ćøć®ć³ć³ćć³ćććć®äøć«čØčæ°ćć¾ćć<slot />
ćæć°ć®éØåć«ććć¼ćøć³ć³ćć¼ćć³ćć®ć³ć³ćć³ććęæå
„ććć¾ćć
<!-- src/pages/index.astro -->
---
import BaseLayout from '../layouts/BaseLayout.astro';
import MyComponent from '../components/MyComponent.astro';
---
<BaseLayout title="ćć¼ć ćć¼ćø">
<h1>ććććļ¼</h1>
<p>ćććÆćć¼ć ćć¼ćøć®ć³ć³ćć³ćć§ćć</p>
<MyComponent greeting="Hi">
<p>ćććÆMyComponentć«ęø”ćććć³ć³ćć³ćć§ćć</p>
</MyComponent>
</BaseLayout>
ć¢ć¤ć©ć³ćć¢ć¼ćććÆćć£ćØćć¤ćć¬ć¼ć·ć§ć³ šļø
åčæ°ć®éććAstroć®ććć©ć¼ćć³ć¹ć®éµćÆć¢ć¤ć©ć³ćć¢ć¼ćććÆćć£ć«ććć¾ććććć©ć«ćć§ćÆćAstroć³ć³ćć¼ćć³ććä»ć®UIćć¬ć¼ć ćÆć¼ćÆć³ć³ćć¼ćć³ććÆćµć¼ćć¼äøć§HTMLć«ć¬ć³ććŖć³ć°ććććÆć©ć¤ć¢ć³ććµć¤ćJavaScriptćÆå«ć¾ćć¾ććć
ććććććæć³ć®ćÆćŖććÆć¤ćć³ććē¶ę ē®”ēćŖć©ććÆć©ć¤ć¢ć³ććµć¤ćć§ć®ć¤ć³ćæć©ćÆćć£ćę§ćåæ č¦ćŖć³ć³ćć¼ćć³ććććć¾ćććć®ćććŖć³ć³ćć¼ćć³ćććć¢ć¤ć©ć³ćććØćć¦ęå®ććJavaScriptćčŖćæč¾¼ć¾ććļ¼ćć¤ćć¬ć¼ć·ć§ć³ććļ¼ććØćć§ćć¾ććććć«ćÆćÆć©ć¤ć¢ć³ććć£ć¬ćÆćć£ććä½æēØćć¾ćć
<!-- src/pages/interactive.astro -->
---
import BaseLayout from '../layouts/BaseLayout.astro';
// Reactć³ć³ćć¼ćć³ććć¤ć³ćć¼ć (äŗåć« `npm run astro add react` ćåæ
č¦)
import Counter from '../components/Counter.jsx';
---
<BaseLayout title="ć¤ć³ćæć©ćÆćć£ććć¼ćø">
<h1>ć¤ć³ćæć©ćÆćć£ććŖć«ć¦ć³ćæć¼</h1>
<!-- ććć©ć«ćć§ćÆJSćÆčŖćæč¾¼ć¾ććŖć (ćµć¼ćć¼ć¬ć³ććŖć³ć°ć®ćæ) -->
<Counter />
<!-- client:load ćć£ć¬ćÆćć£ć: ćć¼ćøčŖćæč¾¼ćæå¾ććć«ćć¤ćć¬ć¼ć·ć§ć³ -->
<Counter client:load />
<!-- client:idle ćć£ć¬ćÆćć£ć: ć”ć¤ć³ć¹ć¬ćććć¢ć¤ćć«ē¶ę
ć«ćŖć£ćććć¤ćć¬ć¼ć·ć§ć³ -->
<Counter client:idle />
<!-- client:visible ćć£ć¬ćÆćć£ć: č¦ē“ ććć„ć¼ćć¼ćć«å
„ć£ćććć¤ćć¬ć¼ć·ć§ć³ -->
<div style="height: 200vh;">ć¹ćÆćć¼ć«ćć¦ćć ćć</div>
<Counter client:visible />
<!-- client:media ćć£ć¬ćÆćć£ć: ē¹å®ć®ć”ćć£ć¢ćÆćØćŖć«äøč“ććććć¤ćć¬ć¼ć·ć§ć³ -->
<Counter client:media="(max-width: 800px)" />
<!-- client:only ćć£ć¬ćÆćć£ć: ćÆć©ć¤ć¢ć³ććµć¤ćć§ć®ćæć¬ć³ććŖć³ć° (SSRććŖć) -->
<!-- ē¹å®ć®ćć¬ć¼ć ćÆć¼ćÆćęå®ććåæ
č¦ććć -->
<Counter client:only="react" />
</BaseLayout>
å©ēØåÆč½ćŖćÆć©ć¤ć¢ć³ććć£ć¬ćÆćć£ććÆ仄äøć®éćć§ćć
ćć£ć¬ćÆćć£ć | ćć¤ćć¬ć¼ć·ć§ć³ć®ćæć¤ćć³ć° | ć¦ć¼ć¹ć±ć¼ć¹ |
---|---|---|
client:load | ćć¼ćøčŖćæč¾¼ćæå¾ćć | ććć«č”Øē¤ŗć»ęä½ćåæ č¦ćŖUIč¦ē“ ļ¼ćććć¼ć®ć”ćć„ć¼ćŖć©ļ¼ |
client:idle | ćć©ć¦ć¶ćć¢ć¤ćć«ē¶ę ć«ćŖć£ććØć | éč¦åŗ¦ć®ä½ćUIč¦ē“ ļ¼ćµć¤ććć¼ć®ć¦ć£ćøć§ćććŖć©ļ¼ |
client:visible | č¦ē“ ććć„ć¼ćć¼ćå ć«å „ć£ććØć | ē»é¢äøéØć«ććč¦ē“ ćé 延čŖćæč¾¼ćæćććē»åć«ć«ć¼ć»ć«ćŖć© |
client:media={query} | ęå®ććć”ćć£ć¢ćÆćØćŖćäøč“ćććØć | ć¢ćć¤ć«ć§ć®ćæč”Øē¤ŗććććµć¤ććć¼ćŖć© |
client:only={framework} | ćÆć©ć¤ć¢ć³ććµć¤ćć§ć®ćæć¬ć³ććŖć³ć°ļ¼SSRćŖćļ¼ | ćć©ć¦ć¶APIć«å¼·ćä¾åććć³ć³ćć¼ćć³ć |
ćć®ć¢ć¤ć©ć³ćć¢ć¼ćććÆćć£ć«ćććéēŗč ćÆććć©ć¼ćć³ć¹ćøć®å½±éæćęå°éć«ęććŖćććåæ č¦ćŖē®ęć«ć ćć¤ć³ćæć©ćÆćć£ćę§ćčæ½å ć§ćć¾ćć
UIćć¬ć¼ć ćÆć¼ćÆć®ēµ±å š§©
Astroć®å¤§ććŖé åć®äøć¤ćÆćReact, Vue, Svelte, Solid, Lit, AlpineJSćŖć©ćč¤ę°ć®äŗŗę°UIćć¬ć¼ć ćÆć¼ćÆćē°”åć«ēµ±åć§ććē¹ć§ćććććøć§ćÆćå ć§ćććć®ćć¬ć¼ć ćÆć¼ćÆćę··åØćććććØćåÆč½ć§ćć
ćć¬ć¼ć ćÆć¼ćÆćčæ½å ććć«ćÆćastro add
ć³ćć³ććä½æēØćć¾ćć
npm run astro add react
npm run astro add vue
npm run astro add svelte
čæ½å å¾ć.jsx
, .vue
, .svelte
ćŖć©ć®ćć”ć¤ć«ć src/components/
ćć£ć¬ćÆććŖć«é
ē½®ćć.astro
ćć”ć¤ć«å
ć§éåøøéćć¤ć³ćć¼ććć¦ä½æēØć§ćć¾ćć
<!-- src/pages/frameworks.astro -->
---
import BaseLayout from '../layouts/BaseLayout.astro';
import ReactCounter from '../components/ReactCounter.jsx';
import VueCounter from '../components/VueCounter.vue';
import SvelteCounter from '../components/SvelteCounter.svelte';
---
<BaseLayout title="Framework Mix">
<h1>č¤ę°ć®ćć¬ć¼ć ćÆć¼ćÆćę··åØļ¼</h1>
<ReactCounter client:visible />
<VueCounter client:visible />
<SvelteCounter client:visible />
</BaseLayout>
ććć«ćććę¢åć®ć³ć³ćć¼ćć³ćč³ē£ćåå©ēØćććććć¼ć ć”ć³ćć¼ćå¾ęćŖćć¬ć¼ć ćÆć¼ćÆćä½æēØćććććććØć容ęć«ćŖćć¾ćć
View Transitions š¬
Astro 3.0 (2023幓8ęćŖćŖć¼ć¹) 仄éćView Transitions API ćå©ēØćććć¼ćøé·ē§»ć¢ćć”ć¼ć·ć§ć³ćē°”åć«å®č£ ć§ććććć«ćŖćć¾ććććććÆćMPAļ¼ćć«ććć¼ćøć¢ććŖć±ć¼ć·ć§ć³ļ¼ć§ćććŖćććSPAļ¼ć·ć³ć°ć«ćć¼ćøć¢ććŖć±ć¼ć·ć§ć³ļ¼ć®ćććŖę»ćććŖé·ē§»ćå®ē¾ććę©č½ć§ćć
ęå¹ć«ććć«ćÆćć¬ć¤ć¢ć¦ććć”ć¤ć«ć® <head>
ćæć°å
ć« ViewTransitions
ć³ć³ćć¼ćć³ććć¤ć³ćć¼ććć¦čæ½å ććć ćć§ćć
<!-- src/layouts/BaseLayout.astro -->
---
import { ViewTransitions } from 'astro:transitions';
export interface Props { title: string; }
const { title } = Astro.props;
---
<html lang="ja">
<head>
<title>{title}</title>
<!-- View Transitions ćęå¹å -->
<ViewTransitions />
</head>
<body>
<slot />
</body>
</html>
ććć ćć§ććć¼ćøéć®é·ē§»ęć«ććć©ć«ćć®ćć§ć¼ćć¢ćć”ć¼ć·ć§ć³ćé©ēØććć¾ććććć«ćtransition:animate
ćć£ć¬ćÆćć£ććä½æć£ć¦ćē¹å®č¦ē“ ć®ć¢ćć”ć¼ć·ć§ć³ļ¼ć¹ć©ć¤ććŖć©ļ¼ćć«ć¹ćæćć¤ćŗććććtransition:persist
ćć£ć¬ćÆćć£ćć§č¦ē“ ć®ē¶ę
ļ¼åē»ć®åēä½ē½®ćŖć©ļ¼ććć¼ćøé·ē§»å¾ćē¶ęćććć§ćć¾ććē¹å®ć®ćŖć³ćÆć§ć®View Transitionsćē”å¹ć«ććć«ćÆć<a>
ćæć°ć« data-astro-reload
å±ę§ćčæ½å ćć¾ćć
4. ćć«ććØćććć¤ š
éēŗćå®äŗćććććµć¤ćććć«ććć¦å ¬éććęŗåććć¾ćć
npm run build
ćć®ć³ćć³ććå®č”ćććØćęé©åćććéēćć”ć¤ć«ļ¼HTML, CSS, JavaScriptļ¼ćććć©ć«ćć§ dist/
ćć£ć¬ćÆććŖć«ēęććć¾ćć
ēęććć dist/
ćć£ć¬ćÆććŖć®å
容ććNetlify, Vercel, GitHub Pages, Cloudflare PagesćŖć©ć®éēćć¹ćć£ć³ć°ćµć¼ćć¹ć«ć¢ćććć¼ćććć ćć§ććµć¤ććå
¬éć§ćć¾ććå¤ćć®ćć¹ćć£ć³ć°ćµć¼ćć¹ć§ćÆćGitćŖććøććŖćØé£ęŗćć¦čŖåćććć¤ćčØå®ććććØćåÆč½ć§ćć
AstroćÆéēćµć¤ćēęļ¼SSGļ¼ćććć©ć«ćć§ćććć¢ćććæć¼ćä½æēØććććØć§SSRļ¼ćµć¼ćć¼ćµć¤ćć¬ć³ććŖć³ć°ļ¼ćåÆč½ć§ććVercel, Netlify, CloudflarećŖć©ć®ćµć¼ćć¼ć¬ć¹ē°å¢ććNode.jsćµć¼ćć¼ć§ć®å®č”ć«åƾåæćć¦ćć¾ććSSRćęå¹ć«ććć«ćÆćčØå®ćć”ć¤ć«ļ¼astro.config.mjs
ļ¼ć§ć¢ćććæć¼ćęå®ćć¾ćć
// astro.config.mjs
import { defineConfig } from 'astro/config';
import node from '@astrojs/node'; // ä¾: Node.jsć¢ćććæć¼
export default defineConfig({
output: 'server', // ć¾ććÆ 'hybrid'
adapter: node({
mode: 'standalone'
})
});
SSRććć¤ććŖććć¬ć³ććŖć³ć°ļ¼äøéØć®ćć¼ćøćÆéēćäøéØćÆåēļ¼ćå©ēØććććØć§ćććåēćŖć¢ććŖć±ć¼ć·ć§ć³ćę§ēÆć§ćć¾ćć
5. ć¾ćØććØꬔć®ć¹ććć š
AstroćÆćććć©ć¼ćć³ć¹ćéēŗč ä½éØćęč»ę§ćéč¦ććć¢ćć³ćŖWebćć¬ć¼ć ćÆć¼ćÆć§ććē¹ć«ć³ć³ćć³ćäøåæć®Webćµć¤ćę§ēÆć«ććć¦ććć®ēä¾”ćēŗę®ćć¾ćć
- ć¢ć¤ć©ć³ćć¢ć¼ćććÆćć£ć«ććé©ē°ēćŖććć©ć¼ćć³ć¹ć
- React, Vue, SveltećŖć©ć儽ćæć®UIćć¬ć¼ć ćÆć¼ćÆćå©ēØåÆč½ć
- ćć”ć¤ć«ćć¼ć¹ć«ć¼ćć£ć³ć°ćć¹ć³ć¼ćä»ćCSSćŖć©ćē“ęēć§ć·ć³ćć«ćŖéēŗä½éØć
- View Transitionsć«ććć¹ć ć¼ćŗćŖćć¼ćøé·ē§»ć
- Markdown/MDXćµćć¼ććØć³ć³ćć³ćć³ć¬ćÆć·ć§ć³ć«ććå¹ēēćŖć³ć³ćć³ćē®”ēć
ćć®čØäŗć§ćÆAstroć®åŗę¬ēćŖéØåćē“¹ä»ćć¾ćććććć«ę·±ćå¦ć¶ććć«ćÆć仄äøć®ć¹ćććććå§ććć¾ćć
- å ¬å¼ććć„ć”ć³ććčŖć: Astroć®å ¬å¼ććć„ć”ć³ć (https://docs.astro.build/ja/) ćÆéåøøć«å å®ćć¦ćććę„ę¬čŖć«ćåƾåæćć¦ćć¾ćć
- ćć„ć¼ććŖć¢ć«ć試ć: å ¬å¼ć®ććć°ćć„ć¼ććŖć¢ć«ćŖć©ćéćć¦ćå®éć«ęćåććć¦ćæć¾ćććć
- ć¤ć³ćć°ć¬ć¼ć·ć§ć³ćę¢ć: Tailwind CSS, MDX, ē»åęé©åćŖć©ćč±åÆćŖć¤ć³ćć°ć¬ć¼ć·ć§ć³ć試ćć¦ćæć¾ćććć
- ć³ćć„ććć£ć«åå ćć: Discord (https://astro.build/chat) ćŖć©ć§ä»ć®éēŗč ćØäŗ¤ęµććč³Ŗåćććē„č¦ćå ±ęććććć¾ćććć
AstroćÆę„éć«é²åćć¦ćććWebéēŗć®ęŖę„ćå½¢ä½ćåÆč½ę§ćē§ćć¦ćć¾ćććć²ćć®ę©ä¼ć«Astroć試ćć¦ćꬔäø代ć®Webćµć¤ćę§ēÆćä½éØćć¦ćæć¦ćć ććļ¼š
ć³ć”ć³ć