---
import Base from "@/layouts/Base.astro";
import SearchBar from "@/layouts/SearchBar";
import { getSinglePage } from "@/lib/contentParser.astro";

// Retrieve all articles
const posts = await getSinglePage("posts");

// List of items to search in
const searchList = posts.map((item: any) => ({
  slug: item.slug,
  data: item.data,
  content: item.body,
}));
---

<Base title={`Search`}>
  <section class="section">
    <div class="container">
      <SearchBar client:load searchList={searchList} />
    </div>
  </section>
</Base>
