Migrate content from markdown to Appwrite database
Remove static markdown file dependencies and update all pages/components to fetch data directly from Appwrite collections, while maintaining existing service functions for data retrieval and adding new CRUD operations for projects.
This commit is contained in:
1 parent
7e3b5b7a55
commit
03a79e2f79
18 files changed
+1990
-5876
No files matched your search
@@ -1,18 +1,21 @@
|
||||
import type { CollectionEntry } from "astro:content"
|
||||
import type { BlogPost, Project } from "@lib/appwrite-service"
|
||||
import { createEffect, createSignal } from "solid-js"
|
||||
import Fuse from "fuse.js"
|
||||
import ArrowCard from "@components/ArrowCard"
|
||||
|
||||
// Define a unified type for search results
|
||||
type SearchEntry = BlogPost | Project
|
||||
|
||||
type Props = {
|
||||
data: CollectionEntry<"blog">[]
|
||||
data: SearchEntry[]
|
||||
}
|
||||
|
||||
export default function Search({data}: Props) {
|
||||
const [query, setQuery] = createSignal("")
|
||||
const [results, setResults] = createSignal<CollectionEntry<"blog">[]>([])
|
||||
const [results, setResults] = createSignal<SearchEntry[]>([])
|
||||
|
||||
const fuse = new Fuse(data, {
|
||||
keys: ["slug", "data.title", "data.summary", "data.tags"],
|
||||
keys: ["$id", "title", "summary", "tags"],
|
||||
includeMatches: true,
|
||||
minMatchCharLength: 2,
|
||||
threshold: 0.4,
|
||||
|
||||
Reference in new issue
Block a user