astro5-blog-best-practices

Guide Astro 5.x static blogs through Islands Architecture and Content Layer API setup.

1|Updated Nov 17, 2023
One-click install
npx skills add https://github.com/Suntory-N-Water/sui-blog --skill astro5-blog-best-practices
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: astro5-blog-best-practices
Source: https://github.com/Suntory-N-Water/sui-blog/tree/main/.claude/skills/astro5-blog-best-practices
Command: npx skills add https://github.com/Suntory-N-Water/sui-blog --skill astro5-blog-best-practices

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Astro 5.xで静的ブログを構築する際の公式推奨ベストプラクティスを提供。Islands Architecture、Content Layer API、画像最適化、ビルド最適化、SEOを組み合わせ、パフォーマンスとUXを最大化します。

Core Features & Use Cases

  • Islands Architectureで最小限のJavaScript、静的HTML中心
  • Content Layer APIによる型安全なコンテンツ管理
  • 画像最適化とビルド最適化
  • SEO対応: RSS, サイトマップ, 構造化データ

Quick Start

Set up an Astro 5.x blog following these practices: enable islands, configure Content Layer API collections, optimize images, and enable RSS and sitemap.

Frequently Asked Questions about astro5-blog-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize images in an Astro 5 blog for performance?

Astro 5 provides built-in image optimization that automatically converts, resizes, and serves responsive images at build time. Use the `Image` component from `astro:assets` to declare images with width and height, enabling lazy loading and WebP generation without manual configuration.

What is Islands Architecture and why use it for static blogs?

Islands Architecture isolates interactive components as separate JavaScript islands within static HTML. For blogs, this means most content renders as static markup while only necessary interactive features load JavaScript, dramatically reducing bundle size and improving Core Web Vitals.

How do I set up the Content Layer API for type-safe blog content in Astro 5?

Define content collections using Zod schemas in `src/content/config.ts`, specify your blog post collection with fields like title and date, then use `getCollection()` to fetch and query posts with full TypeScript support at build time.

Can I use Astro 5 to generate RSS feeds and sitemaps automatically?

Yes. Astro 5 supports RSS feed generation via the `@astrojs/rss` integration and sitemap generation via `@astrojs/sitemap`. Both integrate with your Content Layer collections to automatically include all blog posts without manual updates.

What's the best approach to implement SEO for an Astro 5 static blog?

Combine structured data using JSON-LD schemas, auto-generated RSS and sitemap feeds, semantic HTML from static rendering, and open graph meta tags. Astro 5's build-time rendering ensures search engines crawl complete, optimized HTML without JavaScript dependency.

When should I use client directives in an Astro 5 blog?

Use client directives like `client:load`, `client:idle`, or `client:visible` only for genuinely interactive elements—search, comments, or filters. Static content should never use directives; islands should load only when necessary to maintain the performance benefits of static rendering.