This commit is contained in:
2025-04-25 17:12:35 -03:00
parent cfe5cd648a
commit 7d51f0be54
4 changed files with 1 additions and 78 deletions

View File

@@ -41,7 +41,7 @@ export default function Search({ searchlist }) {
<strong>{query}</strong>'
</p>
{items.length > 1 && (
{items.length > 0 && (
<ul className="list-disc list-inside">
{items.map(({ data }, idx) => (
<li key={idx}>

View File

@@ -1,29 +0,0 @@
---
import Layout from '~/layouts/Layout.astro'
import Container from '~/components/Container.astro'
export async function getStaticPaths() {
const data = await fetch('https://betaeducacao.com.br/wp-json/wp/v2/posts')
const posts = await data.json()
return posts.map((post) => ({
params: { slug: post.slug },
props: { post },
}))
}
const { post } = Astro.props
---
<Fragment slot="head">
<title>{post.title.rendered}</title>
</Fragment>
<Layout>
<Container>
<article>
<h1 set:html={post.title.rendered} />
<Fragment set:html={post.content.rendered} />
</article>
</Container>
</Layout>

View File

@@ -1,24 +0,0 @@
---
import Layout from "~/layouts/Layout.astro";
import Container from "~/components/Container.astro";
let res = await fetch("https://betaeducacao.com.br/wp-json/wp/v2/posts");
let posts = await res.json();
---
<Layout>
<Container>
{
posts.map((post) => (
<article>
<h2>
<a
href={`/blog/${post.slug}`}
set:html={post.title.rendered}
/>
</h2>
</article>
))
}
</Container>
</Layout>

View File

@@ -7,9 +7,6 @@ import { Clients } from "~/components/Course";
import Search from "./_components/Search.astro";
import mulhercomepi from "~/assets/mulher-com-epi.png";
let res = await fetch("https://betaeducacao.com.br/wp-json/wp/v2/posts");
let posts = await res.json();
---
<Layout>
@@ -68,26 +65,5 @@ let posts = await res.json();
</Container>
<Clients />
<Container>
<section>
<h1 class="text-pretty font-semibold text-4xl">
Últimos posts
</h1>
{
posts.map((post) => (
<article>
<h2>
<a
href={`/blog/${post.slug}`}
set:html={post.title.rendered}
/>
</h2>
</article>
))
}
</section>
</Container>
</div>
</Layout>