-
- {content||""}
+ {content || ""}
-
Review
: <>>},
) {
- const allMovies = await getAllMovies();
+ const { content: allMovies } = await fetchResource("movies");
const searchParams = parseResourceUrl(props.url);
const searchResults = searchParams &&
await searchResource({ ...searchParams, types: ["movie"] });
const movies = allMovies.sort((a, b) =>
- a?.meta?.rating > b?.meta?.rating ? -1 : 1
+ a?.content?.reviewRating?.ratingValue > b?.content?.reviewRating?.ratingValue ? -1 : 1
);
return (
diff --git a/routes/recipes/[name].tsx b/routes/recipes/[name].tsx
index 23d04e1..4125be5 100644
--- a/routes/recipes/[name].tsx
+++ b/routes/recipes/[name].tsx
@@ -3,7 +3,7 @@ import { IngredientsList } from "@islands/IngredientsList.tsx";
import { MainLayout } from "@components/layouts/main.tsx";
import Counter from "@islands/Counter.tsx";
import { Signal, useSignal } from "@preact/signals";
-import { getRecipe, Recipe } from "@lib/resource/recipes.ts";
+import { Recipe } from "@lib/recipeSchema.ts";
import { RedirectSearchHandler } from "@islands/Search.tsx";
import { KMenu } from "@islands/KMenu.tsx";
import PageHero from "@components/PageHero.tsx";
@@ -11,11 +11,12 @@ import { Star } from "@components/Stars.tsx";
import { renderMarkdown } from "@lib/documents.ts";
import { isValidRecipe } from "@lib/recipeSchema.ts";
import { MetaTags } from "@components/MetaTags.tsx";
+import { fetchResource } from "@lib/resources.ts";
export const handler: Handlers<{ recipe: Recipe; session: unknown } | null> = {
async GET(_, ctx) {
try {
- const recipe = await getRecipe(ctx.params.name);
+ const recipe = await fetchResource(`recipes/${ctx.params.name}.md`);
if (!recipe) {
return ctx.renderNotFound();
}
@@ -38,22 +39,24 @@ function ValidRecipe({
{portion && }
Preparation
-
- {recipe.instructions && (recipe.instructions.map((instruction) => {
- return (
-
- );
- }))}
+ {recipe.content.recipeInstructions &&
+ (recipe.content.recipeInstructions.filter((inst) => !!inst?.length)
+ .map((instruction) => {
+ return (
+
+ );
+ }))}
🍽️ Recipes
-
Review
: <>>} = {
async GET(req, ctx) {
- const series = await getAllSeries();
+ const { content: series } = await fetchResource("series");
const searchParams = parseResourceUrl(req.url);
const searchResults = searchParams &&
await searchResource({ ...searchParams, types: ["series"] });