--- import { YouTube } from 'astro-embed'; import MainLayout from "../../layouts/MainLayout.astro"; import Header from "../../components/Header.astro"; import CarouselSection from "../../components/section/CarouselSection.astro"; import { Image } from "@unpic/astro"; import { getCollection, render } from "astro:content"; import TitleSection from "../../components/section/TitleSection.astro"; import FooterSection from '../../components/section/FooterSection.astro'; export const prerender = true; // 1. Generate a new path for every collection entry export async function getStaticPaths() { const posts = await getCollection("news"); return posts.map((post) => ({ params: { id: post.id }, props: { post }, })); } // 2. For your template, you can get the entry directly from the prop const { post } = Astro.props; const { Content } = await render(post); ---
{post.data.gallery && }
{ post.data.youtube && ( )} {post.data.gallery && ( post.data.gallery.map(galleryImage => ( {galleryImage.text} )) )}