Frontmatter
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
You can customize individual recipes by setting values in their frontmatter which is set at the top of your files between --- separators:
---title: Non-Alcoholic Piña Coladacover: alt: A beautiful Virgin Colada image: ../../../assets/virgin-colada.png---Extend your frontmatter schema
Section titled “Extend your frontmatter schema”Starlight Recipes extends Starlight’s frontmatter schema with information about the recipe. You need to update the content config file in order for the additional recipe-specific fields to be available:
import { defineCollection } from 'astro:content';import { docsLoader } from '@astrojs/starlight/loaders';import { docsSchema } from '@astrojs/starlight/schema';import { recipesSchema } from 'starlight-recipes/schema'
export const collections = { docs: defineCollection({ loader: docsLoader(), schema: docsSchema({ extend: (context) => recipesSchema(context) }) }),};Frontmatter fields
Section titled “Frontmatter fields”All frontmatter fields of each recipe are not only used to create visual content on the overview pages and recipe pages, but also to generate Structured Data and Recipes Data. Each field specifies whether it is used for one or both of these data structures, and maps it to its corresponding properties.
The more schema fields you complete for a recipe, the better its visibility in search results.
Required
Type: CoverConfig
Image of the completed dish. — Used to generate image und cover.
Add high-quality image of the completed dish at the top of the recipe:
---cover: alt: "A beautiful Virgin Colada" image: "../../../assets/virgin-colada.png"---CoverConfig
Section titled “CoverConfig”| Field | Type | Description |
|---|---|---|
image | string | Required. Relative path to a local image (e.g., ../../assets/cover.png) or a remote URL. |
alt | string | Required. Alternative text describing the cover image for assistive technologies. |
Type: Date
The date the recipe was published. — Used to generate datePublished und createdAt.
Must be a valid YAML timestamp.
---date: 2024-03-11---category
Section titled “category”Type: string
The type of meal or course your recipe is about. — Used to generate recipeCategory.
---category: "Main Course"---Here are some recommended values for categories:
'Breakfast''Lunch''Dinner''Main Course''Side Dish''Appetizer''Snack''Dessert''Beverage''Salad''Soup''Marinade''Sauce'
cuisine
Section titled “cuisine”Type: string
The region associated with your recipe. — Used to generate recipeCuisine.
---cuisine: "Mediterranean"---If a valid ISO 3166-1 two-letter country code is provided (e.g., “AT” or “JP”), the localized country name will be displayed with the corresponding country emoji flag appended.
---cuisine: "FR"---Type: string[]
A list of tags associated with the recipe. — Used to generate keywords und tags.
Other terms for your recipe such as the season ("Summer"), the holiday ("Halloween"), or other descriptors ("Quick", "Easy", "Authentic").
Displayed at the bottom of a recipe and in the recipe list.
Don’t use a tag that’s actually a category or cuisine.
---tags: - Spring - Easter---featured
Section titled “featured”Type: boolean
Default: false
Whether the recipe is featured. — Used to generate featured.
Featured recipes are listed at the top of the sidebar in a dedicated group.
The featured group is displayed only if at least one recipe is marked as featured. If a recipe is featured and also popular, it will be displayed only in the featured group.
---featured: true---authors
Section titled “authors”Type: StarlightRecipesAuthorsConfig
The author(s) of the recipe. — Used to generate author und authors.
---authors: - Bob---Check the “Authors” guide for more information.
Type: TimeConfig
Duration-related data about the recipe. — Used to generate prepTime, cookTime, totalTime und time.
Specify the time required to prepare and cook the dish.
---time: preparation: 15 cooking: 30 total: 45---TimeConfig
Section titled “TimeConfig”| Field | Type | Description |
|---|---|---|
preparation | number | Time to prepare ingredients (in minutes). |
cooking | number | Time to cook the dish (in minutes). |
total | number | Total time until the dish is finished (in minutes). |
Type: YieldConfig
Details regarding the final output or portion size. — Used to generate recipeYield, nutrition und yield.
Defines how many servings, calories, or items the recipe produces.
---yield: servings: 4 calories: 180 additional: - amount: 12 unit: "cookies"---YieldConfig
Section titled “YieldConfig”| Field | Type | Description |
|---|---|---|
servings | number | Required. The numeric quantity produced. |
calories | number | Optional number of calories in each serving. |
additional | object[] | Optional array of alternative yields (requires both amount and unit). |
ingredients
Section titled “ingredients”Type: (string | IngredientObject)[]
List of ingredients used in the recipe. — Used to generate recipeIngredient und ingredients.
Ingredients can be provided as simple strings or structured objects for better data parsing.
---ingredients: - 2 eggs - quantity: 500 unit: "g" name: "Flour"---IngredientObject
Section titled “IngredientObject”| Field | Type | Description |
|---|---|---|
name | string | Required. The name of the ingredient (e.g., “All-purpose flour”). |
quantity | number | Optional numeric amount (e.g., 2, 1.5, 500). |
unit | string | Optional unit of measurement (e.g., “cups”, “g”, “tbsp”). |
instructions
Section titled “instructions”Type: (string | InstructionStep)[]
The steps to make the dish. — Used to generate recipeInstructions und instructions.
Instructions can be simple strings or detailed objects including images (image and alt), titles (name) and specific timing (time) for that step.
---instructions: - Preheat the oven to 180°C. - name: "Mix ingredients" text: "Combine flour and eggs in a large bowl." time: 5 image: "../../../assets/mixing.png" alt: "Mixing flour and eggs"---InstructionStep
Section titled “InstructionStep”| Field | Type | Description |
|---|---|---|
text | string | Required. The instruction text. |
name | string | Optional title for the step. |
image | string | Path to an image for this specific step. |
alt | string | Alt text for the step image. |
time | number | Time required for this specific step (in minutes). |
Type: string
A YouTube URL of a video depicting the recipe steps. — Used to generate video.
---video: https://youtube.com/shorts/jYf3nheLZfE---When you start astro dev or run astro build, this YouTube URL is resolved once into the full metadata needed to render the video on the recipe page and to generate the Structured Data for the video.
In practice, you normally only set video to a plain YouTube URL string as shown above. The following object shows the shape of the resolved data that the plugin produces; you do not need to copy or maintain this manually. The actual values (title, thumbnails, interaction count, etc.) will depend on your video and may change over time:
---video: url: "https://youtube.com/shorts/jYf3nheLZfE" name: "The Perfect Pina Colada 🌴🥥 #pinacolada #bar #bartender #cocktails #pineapple #cocktail art" thumbnailUrl: - "https://i.ytimg.com/vi/jYf3nheLZfE/maxresdefault.jpg?sqp=-oaymwEoCIAKENAF8quKqQMcGADwAQH4AbYIgAKAD4oCDAgAEAEYZSBgKFYwDw==&rs=AOn4CLB-7d9Wh2MOnwzfdr4BEnj4FX5e1w" - "https://i.ytimg.com/vi/jYf3nheLZfE/hqdefault.jpg?sqp=-oaymwE2CNACELwBSFXyq4qpAygIARUAAIhCGABwAcABBvABAfgBtgiAAoAPigIMCAAQARhlIGAoVjAP&rs=AOn4CLA3LQSFQ9OvLlFFx6DQ_tIK34p7Yg" - "https://i.ytimg.com/vi/jYf3nheLZfE/hqdefault.jpg?sqp=-oaymwE2CPYBEIoBSFXyq4qpAygIARUAAIhCGABwAcABBvABAfgBtgiAAoAPigIMCAAQARhlIGAoVjAP&rs=AOn4CLBAMQ3AQvVzR9rGNrdv4iCSWDq1bA" uploadDate: "2024-05-28T13:06:43-07:00" duration: "PT11S" embedUrl: "https://www.youtube.com/embed/jYf3nheLZfE" userInteractionCount: 1623035---Starlight’s frontmatter fields
Section titled “Starlight’s frontmatter fields”This section describes how frontmatter fields that are integrated in Starlight itself are used across the recipe website.
Required
Type: string
The name of the dish. — Used to generate name und title.
The title gets used in the recipe list, on author and tags pages, besides the top of each recipe, in browser tabs, and in recipe metadata.
description
Section titled “description”Type: string
A short summary describing the dish. — Used to generate description.
The recipe description is displayed in recipe lists when the recipe is featured and used for recipe metadata and will be picked up by search engines and in social media previews.
lastUpdated
Section titled “lastUpdated”Type: Date | boolean
The date the recipe was last updated. — Used to generate updatedAt.
If a date is specified in a recipe for this Starlight frontmatter field, such date will also be displayed next to the recipe date.
Displayed only if different from the date frontmatter field and must be a valid YAML timestamp.
---lastUpdated: 2024-07-01---Type: boolean
Default: false
Whether the recipe is a draft. — Used to generate draft.
Draft recipes are not included in production builds.
Set to true to mark a recipe as a draft and make it only visible during development.
---draft: true---