Summer pricing is live: save $50 on Starwind Pro lifetime access.

Code Block 1 - Static Wrapper

Free

A lightweight syntax highlighted code block wrapper powered by Astro's built-in Code component.

Theme

Upgrade to Pro

src/pages/blog/[slug].astro

import { getCollection } from "astro:content";

export async function getStaticPaths() {
  const posts = await getCollection("blog");

  // Map each post to a path with its slug
  return posts.map((post) => ({
    params: { slug: post.slug },
    props: { post },
  }));
}
Loading code...

Starwind Dependencies

Sign in to view code and copy install commands.

Sign in

This component requires Starwind Pro.

Get lifetime access to all premium components, updates, and priority support.

Upgrade to Pro

Failed to load code. Please try again.