@@ -5,6 +5,7 @@ import RenderSource from "@components/RenderSource.astro";
55import Layout from " @layouts/Layout.astro" ;
66import { getLogin } from " @lib/login-cookie" ;
77import { prisma } from " @lib/prisma" ;
8+ import slugify from " @lib/slugify" ;
89import type {
910 Category ,
1011 Recipe ,
@@ -51,14 +52,20 @@ if (slug && username) {
5152 });
5253}
5354
54- RenderSource == RenderSource ;
55+ const ingredientNames = recipe ?.ingredients .map (
56+ (ingredient ) => ingredient .name
57+ );
5558---
5659
5760<script >
5861 import "@github/relative-time-element";
5962</script >
6063
61- <Layout title ={ recipe ?.name ?? " No such recipe" } user ={ activeUser } showScreenLock >
64+ <Layout
65+ title ={ recipe ?.name ?? " No such recipe" }
66+ user ={ activeUser }
67+ showScreenLock
68+ >
6269 {
6370 recipe ? (
6471 <div class = " recipe" itemscope itemtype = " https://schema.org/Recipe" >
@@ -88,6 +95,7 @@ RenderSource == RenderSource;
8895 itemprop = " recipeIngredient"
8996 itemscope
9097 itemtype = " https://schema.org/HowToSupply"
98+ id = { slugify (ingredient .name )}
9199 >
92100 { ingredient .amount ? (
93101 <span
@@ -118,13 +126,13 @@ RenderSource == RenderSource;
118126 <h3 >Instructions</h3 >
119127 { recipe .steps .length === 1 ? (
120128 <div itemprop = " recipeInstructions" >
121- <Markdown source = { recipe .steps [0 ]! } />
129+ <Markdown source = { recipe .steps [0 ]! } { ingredientNames } />
122130 </div >
123131 ) : (
124132 <ol >
125133 { recipe .steps .map ((step ) => (
126134 <li itemprop = " recipeInstructions" >
127- <Markdown source = { step } />
135+ <Markdown source = { step } { ingredientNames } />
128136 </li >
129137 ))}
130138 </ol >
@@ -139,7 +147,7 @@ RenderSource == RenderSource;
139147 <li itemprop = " recipeCategory" >
140148 <a
141149 href = { ` /search?category=${encodeURIComponent (
142- category .name .replaceAll (" " , " _" ),
150+ category .name .replaceAll (" " , " _" )
143151 )} ` }
144152 >
145153 { category .name }
@@ -164,7 +172,7 @@ RenderSource == RenderSource;
164172 />
165173 ) : (
166174 <RecipeNote note = { note } />
167- ),
175+ )
168176 )}
169177 </ol >
170178 { activeUser ? (
0 commit comments