🚀 Get 50% off lifetime access with code STAR50 at checkout

Code Block 1 - Static Wrapper

Free

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

Theme

Sign in to install

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.