🚀 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
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 },
}));
}
Starwind Dependencies
Sign in to view code and copy install commands.
Sign inThis component requires Starwind Pro.
Get lifetime access to all premium components, updates, and priority support.
Upgrade to ProFailed to load code. Please try again.