Astro, icerik odakli web siteleri icin ideal bir framework. Zero JavaScript varsayilan yaklasimi ile kusursuz performans sunar.
Neden Astro?
Astro’yu diger frameworklerden ayiran ozellikler:
- Zero JS by default: Sayfalariniz saf HTML olarak sunulur
- Island Architecture: Sadece interaktif bolumler JS yukler
- Content Collections: Tip-guvenli icerik yonetimi
- Coklu framework desteigi: React, Vue, Svelte birlikte kullanilabilir
Proje Kurulumu
Yeni bir Astro projesi olusturmak cok basit:
npm create astro@latest my-blog
cd my-blog
npm install
npm run dev
Content Collections
Astro’nun en guclu ozelliklerinden biri Content Collections:
// content.config.ts
import { defineCollection, z } from 'astro:content';
import { glob } from 'astro/loaders';
const blog = defineCollection({
loader: glob({ pattern: '**/*.mdx', base: './src/content/blog' }),
schema: z.object({
title: z.string(),
description: z.string(),
publishDate: z.coerce.date(),
tags: z.array(z.string()),
}),
});
export const collections = { blog };
Bu yapiyla tum icerikleriniz build-time’da validate edilir.
Cloudflare Pages ile Deploy
Astro projenizi Cloudflare Pages’e deploy etmek icin:
- GitHub’a push edin
- Cloudflare Dashboard’da yeni bir Pages projesi olusturun
- Build komutunu
npm run buildolarak ayarlayin - Build cikti dizinini
distolarak belirleyin
# wrangler.toml
name = "my-blog"
pages_build_output_dir = "./dist"
SEO Optimizasyonu
Astro’da SEO icin temel adimlar:
- Meta tagleri: Her sayfada title ve description
- Open Graph: Sosyal medya paylasimlari icin
- Sitemap:
@astrojs/sitemapentegrasyonu - RSS Feed:
@astrojs/rssile otomatik - JSON-LD: Structured data ile arama motorlarini bilgilendirin
Astro, modern web gelistirmenin en iyi uygulamalarini kolayca uygulamanizi saglar. Hizli, guvenli ve SEO-uyumlu bir blog icin mukemmel bir secimdir.