import { Handlers, PageProps } from "$fresh/server.ts"; import { MainLayout } from "@components/layouts/main.tsx"; import { Article, getAllArticles } from "@lib/resource/articles.ts"; import { Card } from "@components/Card.tsx"; import { KMenu } from "@islands/KMenu.tsx"; import { Grid } from "@components/Grid.tsx"; import { IconArrowLeft } from "@components/icons.tsx"; import { RedirectSearchHandler } from "@islands/Search.tsx"; import { parseResourceUrl, searchResource } from "@lib/search.ts"; import { SearchResult } from "@lib/types.ts"; export const handler: Handlers = { async GET(req, ctx) { const articles = await getAllArticles(); const searchParams = parseResourceUrl(req.url); const searchResults = searchParams && await searchResource({ ...searchParams, type: "article" }); return ctx.render({ articles, searchResults }); }, }; export default function Greet( props: PageProps<{ articles: Article[] | null; searchResults: SearchResult }>, ) { const { articles, searchResults } = props.data; return (
Back

📝 Articles

{articles?.map((doc) => { return ( ); })}
); }