#Sanity and astro

5 messages · Page 1 of 1 (latest)

unique pier
#

I have a blog site which is builded by astro and I am using getStaticPath and for getting md folders like this: ---
import { getCollection } from "astro:content";
import BlogPost from '../../layouts/BlogPost.astro';
export async function getStaticPaths() {
let posts = await getCollection("football")
return posts.map((item) => (
{
params: {slug:item.slug},
props: item,
}
))
}
const post = Astro.props
const { Content } = await post.render();

<BlogPost>
<div class="space-y-10">
<h1 class="text-purple-600 text-center font-mono text-7xl">{post.data.title.toUpperCase()}</h1>
<img class="max-w-5xl mx-auto md:w-full md:h-96 w-full h-auto" src={post.data.heroImage} alt="post">
<div class="font-sans max-w-7xl space-y-1 tracking-wide mx-auto">
<Content/>
</div>
</div>
</BlogPost> I want to use sanity without getting like this how can I use sanity and which parts am I needing to change?

#

This is [...slug] page

vivid musk
#

I do not understand your question. Can you rephrase?

#

Oh, you are asking how to get posts from sanity?