Menu

How a static Astro site keeps its prices current every month
📰

How a static Astro site keeps its prices current every month

DEV Community: astro·HaulFare·4 days ago
#xx6FbPL2
#devtoastro#devto#dev#edition#price
Reading 0:00
15s threshold

HaulFare is a free US car shipping price guide. Quote requests go to one licensed auto transport broker, which confirms the actual price, so the site's job is to publish honest, current estimates. Nearly every page quotes a dollar figure, and those figures have to move when diesel or the season moves.

That is awkward for a static site: more than a hundred prerendered pages, much of them prose, must agree on what a 1,000 mile trip costs and move to new prices on the same day. Here is how we do it with Astro 7.

One pricing module, used everywhere

The model is one TypeScript file, src/lib/pricing.ts . Its core is a per-mile curve for an open trailer carrying a running sedan, linearly interpolated:

/** Base $/mile breakpoints (open, sedan), linearly interpolated.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.