Add geo-localized pricing via bunny.net edge script - #10
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
shroud-email-website | 6c94443 | Jul 24 2026, 02:26 PM |
taobojlen
force-pushed
the
geo-localized-pricing
branch
3 times, most recently
from
July 24, 2026 15:30
45ca90f to
993473b
Compare
taobojlen
force-pushed
the
geo-localized-pricing
branch
from
July 24, 2026 15:34
993473b to
f84f9f5
Compare
Show £25/year to UK visitors and $35/year to everyone else, dynamically based on the visitor's country, rewritten at the bunny.net edge. Website changes: - Pricing.vue: hero heading + price table cell show a single £25/year default, wrapped in <span data-price=""> markers (the edge script's rewrite targets). - pricing.astro: drop client:load on the Pricing component. It is purely presentational, so static rendering avoids a hydration snap-back that would overwrite the edge-rewritten price. Also ships no JS for the page. - tsconfig.json: exclude edge-script/ from astro check (it has its own Deno type-check; the bundled output was producing spurious TS errors). Edge script (edge-script/): - Middleware using servePullZone + HTMLRewriter. Non-UK visitors get $35/year; UK/unknown visitors see the £25/year default baked into the HTML (safe degradation if the script is disabled or the country header is missing). - Sets Cache-Control: no-store on HTML responses so the per-visitor rewrite isn't cached and served to a visitor in the other region. Static assets keep their original cache headers. - Bundled to a single file via esbuild + @luca/esbuild-deno-loader (mirrors the official BunnyWay template). Deploy: handled by the combined "Deploy to staging" workflow on main (PR #14), which deploys both the site and the edge script in one run.
taobojlen
force-pushed
the
geo-localized-pricing
branch
from
July 24, 2026 16:09
768613d to
eac1437
Compare
The free-plan price was hardcoded £0 with no data-price marker, so US visitors saw '£0' in the table while the paid price localized. Now every price element (hero, free cell, paid cell) carries data-price-world with its worldwide value, and the edge script swaps in that value for non-UK visitors. - Pricing.vue: add freeWorld/paidWorld to the Price row; mark the free cell with data-price + data-price-world just like the paid cell. - edge-script/pricing.ts: select on [data-price-world] and set the content to the attribute's value, instead of hardcoding a single $35/year replacement. Now handles £0->$0 and £25/year->$35/year independently.
Extend the prod deploy workflow (deploy.yml) with a parallel deploy-edge-script job, mirroring staging. On push to main it now deploys both the site and the edge script using prod secrets (BUNNY_SCRIPT_ID / BUNNY_DEPLOY_KEY). So merging PR #10 deploys the geo-localized pricing to prod automatically, once those prod secrets + a prod edge script (attached to the production pull zone) are configured.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.