你好,世界:我的第一篇文章
为什么是 Astro?
Astro 是一个现代静态站点生成器,能用更少的 JavaScript 构建更快的网站。它很适合像博客这样以内容为主的站点。
我喜欢它的几个地方:
- Content Collections 让 markdown 文章管理起来非常顺手
- 默认零 JS 带来很快的页面加载速度
- Island Architecture 让你只在需要时添加交互
一个简单的代码例子
Astro 组件可以非常简洁:
---
const greeting = 'Hello, World!';
---
<h1>{greeting}</h1>
再看一段 JavaScript:
const posts = await getCollection('zhBlog');
const sorted = posts.sort((a, b) => b.data.date - a.data.date);
for (const post of sorted) {
console.log(post.data.title);
}
接下来写什么
之后我会写一些和技术、工具、以及思考有关的内容。先这样,慢慢来。