This commit is contained in:
2025-04-18 09:12:40 -03:00
parent e4fdeeee80
commit bfe3d2f0a5
7 changed files with 79 additions and 315 deletions

View File

@@ -0,0 +1,30 @@
---
import Layout from '~/layouts/Layout.astro'
import Container from '~/components/Container'
const { slug } = Astro.params
let res = await fetch(`https://betaeducacao.com.br/wp-json/wp/v2/posts?slug=${slug}&_embed`)
let [post] = await res.json()
// The getStaticPaths() is required for static Astro sites.
// If using SSR, you will not need this function.
export async function getStaticPaths() {
let data = await fetch('https://betaeducacao.com.br/wp-json/wp/v2/posts')
let posts = await data.json()
return posts.map((post) => ({
params: { slug: post.slug },
props: { post: post },
}))
}
---
<Layout title={post.title.rendered}>
<Container>
<article>
<h1 set:html={post.title.rendered} />
<Fragment set:html={post.content.rendered} />
</article>
</Container>
</Layout>