This script includes:
Let's create a simple page that lists some menu items.
Create a new file under the src/pages directory, named index.astro. If an index.astro already exists, you can modify that one or create a new file like restaurant.astro for a separate page. astro public my restaurant script link
Add the following code to index.astro or your chosen file:
---
title: "My Restaurant"
description: "Welcome to my restaurant"
---
## Welcome to My Restaurant
We're serving delicious food. Here's a look at our menu:
### Menu Items
<ul>
menuItems.map(item => (
<li>
<strong>item.name</strong> - $item.price
<br />
item.description
</li>
))
</ul>
---
<script>
const menuItems = [
name: "Spaghetti Bolognese",
price: 15.99,
description: "Classic spaghetti with a rich bolognese sauce"
,
name: "Grilled Salmon",
price: 22.99,
description: "Fresh salmon grilled to perfection"
,
// Add more items here...
];
</script>
This Astro component uses a script to define a list of menu items and then maps over this list to display each item. This script includes:
import defineConfig from 'astro/config';
export default defineConfig( integrations: [], output: 'server' // or 'hybrid' if you want static + dynamic );
Cause: The script link might point to a staging (test) environment instead of the "Public" production environment.
Fix: Verify with Astro support that the restaurant_id in your script link points to your LIVE database, not your sandbox.