To build a hotel website with Astro, model rooms and amenities as content collections, add a check-in and check-out search form that hands guests to your booking engine, mark up the property with Hotel structured data, add language versions with Astro’s i18n routing, and deploy the static build to a CDN. A hotel website built with Astro loads fast for guests browsing on hotel Wi-Fi or mobile data abroad, and live availability stays in the booking engine where it belongs.
This guide covers the pages a hotel or guesthouse needs, the Astro 7 code, and the details that help direct bookings.
Key Takeaways
- Keep live rates and availability in your booking engine. Your Astro site describes rooms and hands off with dates filled in.
- Model rooms as a content collection with capacity, size, beds, amenities and a photo set.
- A plain HTML
GETform can pass check-in and check-out dates straight to most booking engines.- Add
HotelJSON-LD with address, check-in and check-out times, and amenities.- Use Astro’s built-in i18n routing for language versions; international guests book more when they can read the page.
What a hotel website needs
Guests comparing hotels want to know: what are the rooms like, what’s included, where exactly is it, and can I book directly for a fair price. Your site should answer those faster than an online travel agency listing.
| Page | What it covers |
|---|---|
| Home | Hero photo, short description, date search, highlights, location |
| Rooms | List of room types with photos, capacity and “from” prices |
| Room detail | Beds, size, view, amenities, gallery, book button |
| Dining | Restaurant, breakfast, bar, menus and hours |
| Experiences or spa | What guests can do on site and nearby |
| Location | Map, directions, airport transfer, parking |
| Offers | Packages and direct-booking perks |
| Contact | Phone, email, reception hours, address |
Direct-booking perks (free breakfast, late check-out, a better cancellation policy) are the main reason guests book on your site instead of a third party. Put them near the booking form.
Start the project
# Terminal
npm create astro@latest hotel-site
cd hotel-site
npx astro add sitemap
npm run dev
To start from a design, the Astro travel themes category includes several hotel templates. Bayan covers rooms, restaurant, spa and experiences, and Ayama Resort has room listings and a room detail page. Free general templates such as AstroWind or Astro’s official starters work too, though you’ll add the room collection and booking hand-off yourself, as shown below.
Model rooms as a content collection
// src/content.config.ts
import { defineCollection } from 'astro:content';
import { glob } from 'astro/loaders';
import { z } from 'astro/zod';
const rooms = defineCollection({
loader: glob({ pattern: '**/index.md', base: './src/content/rooms' }),
schema: ({ image }) =>
z.object({
name: z.string(),
summary: z.string().max(180),
sleeps: z.number().int().min(1),
beds: z.string(),
sizeM2: z.number().optional(),
view: z.string().optional(),
priceFrom: z.number().optional(),
amenities: z.array(z.string()),
bookingRoomCode: z.string().optional(),
photos: z.array(z.object({ src: image(), alt: z.string() })).min(1),
order: z.number().default(0),
}),
});
export const collections = { rooms };
Each room lives in its own folder with its photos:
---
# src/content/rooms/garden-double/index.md
name: "Garden double"
summary: "Ground-floor double opening onto the walled garden, with a rain shower."
sleeps: 2
beds: "1 king"
sizeM2: 24
view: "Garden"
priceFrom: 145
amenities: ["Free Wi-Fi", "Rain shower", "Nespresso machine", "Garden terrace"]
bookingRoomCode: "GDBL"
photos:
- src: "./bed.jpg"
alt: "King bed with linen throw facing glass doors to the garden"
- src: "./bathroom.jpg"
alt: "Walk-in rain shower with stone tiles"
order: 1
---
Morning light and the sound of the fountain. Steps from breakfast in the orangery.
Treat priceFrom as a guide only and label it “from” on the page. Real rates change daily and live in your booking engine. If you can’t keep it current, leave it out.
Room pages with a direct booking link
---
// src/pages/rooms/[id].astro
import { getCollection, render } from 'astro:content';
import { Image } from 'astro:assets';
import BaseLayout from '../../layouts/BaseLayout.astro';
import BookingSearch from '../../components/BookingSearch.astro';
export async function getStaticPaths() {
const rooms = await getCollection('rooms');
return rooms.map((room) => ({ params: { id: room.id }, props: { room } }));
}
const { room } = Astro.props;
const { Content } = await render(room);
const [hero, ...rest] = room.data.photos;
---
<BaseLayout title={room.data.name} description={room.data.summary}>
<Image src={hero.src} alt={hero.alt} widths={[640, 1280, 1920]} sizes="100vw" priority />
<h1>{room.data.name}</h1>
<ul class="facts">
<li>Sleeps {room.data.sleeps}</li>
<li>{room.data.beds}</li>
{room.data.sizeM2 && <li>{room.data.sizeM2} m²</li>}
{room.data.view && <li>{room.data.view} view</li>}
</ul>
{room.data.priceFrom && <p>From €{room.data.priceFrom} per night</p>}
<Content />
<h2>In the room</h2>
<ul>{room.data.amenities.map((a) => <li>{a}</li>)}</ul>
<div class="gallery">
{rest.map((p) => <Image src={p.src} alt={p.alt} width={800} quality={80} />)}
</div>
<BookingSearch roomCode={room.data.bookingRoomCode} />
</BaseLayout>
priority on the hero photo loads it with high fetch priority, which helps Largest Contentful Paint. Every other photo lazy-loads, so a room with twelve photos still opens quickly. The Astro image cheatsheet covers the image props.
Hand off to the booking engine with dates filled in
Most hotel booking engines accept check-in, check-out and guest counts as URL parameters. A plain HTML form with method="GET" builds that URL for you, with no JavaScript.
---
// src/components/BookingSearch.astro
interface Props { roomCode?: string }
const { roomCode } = Astro.props;
const engine = import.meta.env.PUBLIC_BOOKING_ENGINE_URL;
const today = new Date().toISOString().slice(0, 10);
---
<form class="booking" method="GET" action={engine}>
<label>Check-in <input type="date" name="checkin" min={today} required /></label>
<label>Check-out <input type="date" name="checkout" min={today} required /></label>
<label>Adults
<select name="adults">
<option>1</option><option selected>2</option><option>3</option><option>4</option>
</select>
</label>
{roomCode && <input type="hidden" name="room" value={roomCode} />}
<button type="submit">Check availability</button>
</form>
Parameter names differ between booking engines. Check your provider’s deep-link documentation and rename checkin, checkout, adults and room to match. The min={today} attribute is set at build time, so with a daily rebuild it stays accurate; browsers also stop people picking a check-out before check-in only if you add a few lines of script, so let the booking engine validate the final dates.
If your provider offers only an embedded widget, load its script on the booking page alone rather than every page. Third-party booking widgets are often the heaviest thing on a hotel site.
Hotel structured data
---
// src/components/HotelSchema.astro
const schema = {
'@context': 'https://schema.org',
'@type': 'Hotel',
name: 'The Orangery House',
url: Astro.site?.href,
telephone: '+351-21-555-0100',
address: {
'@type': 'PostalAddress',
streetAddress: 'Rua das Flores 12',
addressLocality: 'Lisbon',
postalCode: '1200-195',
addressCountry: 'PT',
},
checkinTime: '15:00',
checkoutTime: '11:00',
petsAllowed: false,
amenityFeature: [
{ '@type': 'LocationFeatureSpecification', name: 'Free Wi-Fi', value: true },
{ '@type': 'LocationFeatureSpecification', name: 'Breakfast included', value: true },
],
image: [new URL('/og/hotel.jpg', Astro.site).href],
};
---
<script type="application/ld+json" set:html={JSON.stringify(schema)} />
Only include a starRating if your property has an official rating, and only add review markup for reviews collected on your own site. The full property list is on schema.org’s Hotel type, and the JSON-LD guide shows how to build schema from collection data.
Language versions with i18n routing
Hotels often serve guests from several countries. Astro’s i18n routing gives each language its own URL prefix:
// astro.config.mjs
import { defineConfig } from 'astro/config';
import sitemap from '@astrojs/sitemap';
export default defineConfig({
site: 'https://www.orangeryhouse.example',
i18n: {
locales: ['en', 'pt', 'fr'],
defaultLocale: 'en',
routing: { prefixDefaultLocale: false },
},
integrations: [sitemap({ i18n: { defaultLocale: 'en', locales: { en: 'en', pt: 'pt-PT', fr: 'fr-FR' } } })],
});
English stays at /rooms/garden-double/, and Portuguese lives at /pt/rooms/garden-double/. Translate room content by adding a language folder per locale in your collection, and add hreflang links between versions. The i18n routing guide walks through the full setup, including a language switcher.
Use professional translation for room descriptions and policies. Machine translation of cancellation terms can create real disputes.
Photos, speed and the location page
Hotels sell with photos, and photos are what make hotel sites slow. A few rules:
- Keep originals in
src/and render through<Image />or<Picture />so Astro generates WebP or AVIF in several sizes. - Use one hero photo per page, not an auto-playing slider. Sliders delay the main image and most visitors never see slide three.
- Replace an embedded interactive map on every page with a static image and a “Get directions” link; load an interactive map only on the location page.
- Self-host fonts with one or two weights.
The location page deserves care. Write out the address, distance from the airport and station, transfer options, parking and nearby landmarks in plain text. That text helps guests and local search, and AI assistants answer “how do I get to X hotel” from it.
Deploy
Run npm run build and deploy dist/ to Cloudflare Pages, Netlify or Vercel by connecting your repo. The Cloudflare Pages deploy docs cover setup, and the custom domain docs cover pointing your hotel’s domain. Add a daily scheduled rebuild if you show “from” prices or date minimums, so they stay current.
FAQ
Is Astro good for hotel websites?
Yes. Astro builds fast static pages with optimized images, which suits photo-heavy hotel sites. Room types fit content collections, and live availability and payments stay in your booking engine, linked from a search form or button.
How do I add a booking engine to an Astro hotel site?
Link to your booking engine’s booking page, or use an HTML form with method="GET" that passes check-in, check-out and guest counts as URL parameters your engine accepts. If the provider only offers a widget, load its script on the booking page only.
What schema markup should a hotel website use?
Use the schema.org Hotel type, or BedAndBreakfast or Resort if they fit better, with name, address, telephone, check-in and check-out times, amenities and images. Add a star rating only if you hold an official one.
How do I make a multilingual hotel website in Astro?
Configure i18n in astro.config.mjs with your locales and default language, organize translated content by locale, and add hreflang links between versions. Astro then serves each language under its own path prefix, such as /fr/.
Can I show room prices on a static Astro site?
You can show indicative “from” prices stored in your content, but label them as starting rates and keep live rates in the booking engine. Schedule a regular rebuild, or leave prices out if you can’t keep them accurate.