Building Interactive Travel Guides with Astro Islands

Building Interactive Travel Guides with Astro Islands

Learn how Astro Islands let you combine static Markdown content with interactive maps, booking widgets, elevation profiles, and dynamic components.

Astro is often described as a static site generator, but that’s only half of the story.

One of its most powerful features is the Islands Architecture, which allows you to build pages that are mostly static HTML while adding rich interactive components only where needed.

For travel blogs, hiking guides, and tourism websites this is an ideal approach.

What is an Island?#

Think of a page like this:

------------------------------------------------
Hero Image
Article
Gallery
Route Information
Interactive Map
Booking Widget
Related Articles
------------------------------------------------

Most of the page is rendered as static HTML during build time.

Only the map and booking widget become interactive in the browser.

flowchart TD A[Markdown Content] --> B[Astro Build] B --> C[Static HTML] C --> D[Route Map Island] C --> E[Booking Island]

This means:

Mixing Markdown and Components#

A typical tour article might look like this.

---
import RouteMap from "@/components/RouteMap";
import BookingWidget from "@/components/BookingWidget";
---
<Content />
<RouteMap
gpx="/tracks/lake-tour.gpx"
client:visible
/>
<BookingWidget
eventId="lake-tour-july"
client:load
/>

The article itself comes from Markdown, while the interactive sections are React components.

Route Maps#

Interactive maps are one of the best examples of an Island.

A custom RouteMap component can display:

FeatureDescription
GPX TrackDraw hiking or walking routes
DistanceTotal route length
ElevationTotal ascent and descent
WaypointsStops and landmarks
ZoomInteractive navigation

The rest of the article remains static.

Elevation Profiles#

A GPX file contains enough information to generate an elevation chart.

Altitude
900m ────────────────╮
700m ───────╮ │
│ │
500m ───────╰────────╯────────
Distance → 12.8 km

This visualization is calculated entirely inside the browser.

Booking Widgets#

Interactive booking should never slow down the page.

Instead of rendering everything dynamically, Astro hydrates only the booking component.

sequenceDiagram participant User participant Browser participant Worker participant Database User->>Browser: Click "Book" Browser->>Worker: POST /booking Worker->>Database: Check availability Database-->>Worker: Available Worker-->>Browser: Checkout URL

Everything else on the page remains static.

Lazy Hydration#

Astro lets every Island decide when it should load.

DirectiveBehavior
client:loadLoad immediately
client:idleWait until the browser is idle
client:visibleLoad when visible on screen
client:onlyRender entirely on the client

For maps placed near the bottom of long articles, client:visible is usually the best choice.

<RouteMap
gpx="/tracks/mountain.gpx"
client:visible
/>

Travel Guides with Astro#

A complete travel guide page could combine static and interactive content seamlessly.

Hero
Overview
Gallery
Route Details
Interactive Map
Elevation Profile
Weather
Booking
FAQ
Related Articles
Mountain trail
Mountain trail

Most of these sections are generated during the build process.

Only the components that truly require JavaScript become Islands.

Final Thoughts#

Astro’s Islands Architecture encourages a simple philosophy:

Keep content static. Add JavaScript only where users actually need interaction.

For travel websites this results in pages that are:

Instead of building an entire Single Page Application, you build only the interactive pieces that improve the user experience.

License

CC BY-NC-SA 4.0 This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Related Posts