@@ -51,26 +51,49 @@ if (slug && username) {
51
51
<Layout title ={ recipe ?.name ?? " No such recipe" } user ={ activeUser } >
52
52
{
53
53
recipe ? (
54
- <main class = " recipe" >
55
- <h2 >{ recipe .name } </h2 >
54
+ <main class = " recipe" itemscope itemtype = " https://schema.org/Recipe " >
55
+ <h2 itemprop = " name " >{ recipe .name } </h2 >
56
56
<p >
57
- by <a href = { ` /r/${recipe .author .username } ` } >{ recipe .author .name } </a >
57
+ by
58
+ <a href = { ` /r/${recipe .author .username } ` } itemprop = " author" >
59
+ { recipe .author .name }
60
+ </a >
58
61
{ recipe .authorId === activeUser ?.id ? (
59
62
<a href = " /account" title = " Edit your name" >
60
63
✏️
61
64
</a >
62
65
) : null }
63
66
</p >
64
- { recipe .servings ? <p >{ recipe .servings } Servings</p > : null }
67
+ { recipe .servings ? (
68
+ <p itemprop = " recipeYield" >{ recipe .servings } Servings</p >
69
+ ) : null }
65
70
<section >
66
71
<h3 >Ingredients</h3 >
67
72
<ul >
68
73
{ recipe .ingredients .map ((ingredient ) => (
69
- <li >
70
- { ingredient .amount }
71
- { ingredient .unit }
72
- { ingredient .name +
73
- (ingredient .preparation ? ` , ${ingredient .preparation } ` : " " )}
74
+ <li
75
+ itemprop = " recipeIngredient"
76
+ itemscope
77
+ itemtype = " https://schema.org/HowToSupply"
78
+ >
79
+ { ingredient .amount ? (
80
+ <span
81
+ itemprop = " requiredQuantity"
82
+ itemscope
83
+ itemtype = " https://schema.org/QuantitativeValue"
84
+ >
85
+ <span itemprop = " value" >{ ingredient .amount } </span >
86
+ { ingredient .unit ? (
87
+ <span itemprop = " unitText" >{ ingredient .unit } </span >
88
+ ) : null }
89
+ </span >
90
+ ) : null }
91
+ <span itemprop = " name" >
92
+ { ingredient .name +
93
+ (ingredient .preparation
94
+ ? ` , ${ingredient .preparation } `
95
+ : " " )}
96
+ </span >
74
97
</li >
75
98
))}
76
99
</ul >
@@ -79,11 +102,13 @@ if (slug && username) {
79
102
<section >
80
103
<h3 >Instructions</h3 >
81
104
{ recipe .steps .length === 1 ? (
82
- <Markdown source = { recipe .steps [0 ]! } />
105
+ <div itemprop = " recipeInstructions" >
106
+ <Markdown source = { recipe .steps [0 ]! } />
107
+ </div >
83
108
) : (
84
109
<ol >
85
110
{ recipe .steps .map ((step ) => (
86
- <li >
111
+ <li itemprop = " recipeInstructions " >
87
112
<Markdown source = { step } />
88
113
</li >
89
114
))}
@@ -95,7 +120,7 @@ if (slug && username) {
95
120
<h3 >Categories</h3 >
96
121
<ul >
97
122
{ recipe .categories .map ((category ) => (
98
- <li >
123
+ <li itemprop = " recipeCategory " >
99
124
<a
100
125
href = { ` /search?category=${encodeURIComponent (category .name )} ` }
101
126
>
0 commit comments