Campaign landing pages¶
Marketing builds temporary landing pages in Lovable / Claude Design and publishes them from a separate elome-campaigns repository. The main site serves them at elome.com/{locale}/campaigns/{slug} without being redeployed.
Previously every landing page was a hand-written .vue file in this repo (app/pages/meta0104v1.vue, start.vue, join.vue, …), so each campaign needed a developer, a PR and a full Nuxt deploy.
How a request flows¶
Visitor clicks an ad
└─ GET elome.com/da-dk/campaigns/summer-sale ← the only URL the visitor ever sees
└─ server/routes/[locale]/campaigns/[...slug].ts
1. validate locale + slug
2. look the slug up in the cached manifest
3. fetch the HTML from the campaigns origin
4. inject consent / GTM / VWO / canonical / hreflang
5. respond with s-maxage=60, stale-while-revalidate=300
└─ Browser loads assets from pages.elome.com ← never visible in the address bar
The page is returned by a Nitro route, not a Nuxt page, so it ships no Vue runtime. That is deliberate: a generated page brings its own CSS, and keeping Nuxt out of the response means it cannot collide with Tailwind or Nuxt UI. It also means none of the app's plugins run, which is why consent and analytics are re-injected server-side — see server/utils/marketing/campaignHead.ts.
The campaigns repository¶
campaigns.json # manifest — the allowlist
campaigns/ # published landing pages, one directory per slug
summer-sale/
index.html # default document
de-de.html # optional per-locale variant
assets/…
tests/ # anything that is not a landing page lives outside campaigns/
tooling/validate-manifest.mjs # CI check: manifest rules + referenced files exist
_headers # CORS for fonts and ES modules
.assetsignore # keeps tooling/README off the public host
wrangler.toml # Worker with static assets (not a Pages project)
README.md
Deploys run through Cloudflare Workers Builds, connected straight to the repository — there is no GitHub Actions workflow. A pull request produces a preview version with its own URL; merging to main publishes. tooling/validate-manifest.mjs is wired in as the build command, so a manifest that references a missing file fails the build instead of producing a campaign that is quietly absent.
Published pages are namespaced under campaigns/ so the project can hold tests, tooling, shared snippets and documentation without any of it being reachable as a landing page. That separation is structural rather than a matter of naming discipline: nothing outside campaigns/ can ever be served, no matter how the slug rules change later.
The Worker serves the repository root, which is why the asset path carries the prefix too (pages.elome.com/campaigns/summer-sale/…).
Assets are served straight from pages.elome.com (the campaigns Worker), not proxied through the main site. The campaign build must therefore set an absolute Vite base:
_headers needs Access-Control-Allow-Origin — cross-origin @font-face and <script type="module"> fail without it, and Cloudflare does not add it by default.
A self-contained single-file HTML export (e.g. from Claude Design) needs none of this and works as-is.
campaigns.json¶
{
"campaigns": {
"summer-sale": {
"locales": ["da-dk", "de-de"], // or "*" for every locale
"primaryLocale": "da-dk", // where other locales redirect to
"status": "live", // "draft" is not served
"files": { "de-de": "de-de.html" }, // optional; defaults to index.html
"noindex": true, // default true
"title": "Sommerkampagne", // fallback only
"description": "…" // fallback only
}
}
}
| Field | Required | Notes |
|---|---|---|
locales | yes | Array of locale codes, or "*". Unknown codes are dropped. |
primaryLocale | yes | Must be one of locales, otherwise the entry is rejected. |
status | yes | Anything other than "live" is treated as "draft". |
files | no | Per-locale filename override. Must be a flat *.html name. |
noindex | no | Defaults to true. Only false opts a campaign into indexing. |
title | no | Used only when the document has no <title> of its own. |
description | no | Used only when the document has no description meta. |
The manifest is fetched with a 60-second cache (swr), so a push is live within about a minute. It is also the security boundary: only slugs declared here are ever proxied. A malformed entry is dropped individually rather than taking the other campaigns offline.
title and description defer to the document, but canonical and robots do not — any the campaign declares are stripped and replaced. A generated page usually canonicalises to its own preview domain, which would tell Google the elome.com URL is a duplicate of a page it cannot reach.
Locales¶
locales decides which prefixes resolve. Requesting a locale the campaign does not cover redirects to primaryLocale — the campaign exists, so the visitor is sent to it rather than the front page.
Campaign URLs are exempt from geo-locale redirection (server/middleware/geo-locale.ts). The ad already targeted a market, so a Danish visitor clicking a German ad stays on /de-de/campaigns/… instead of being bounced to /da-dk/.
Nothing 404s¶
Every unresolvable campaign request 302-redirects to the front page, preserving the query string:
| Situation | Result |
|---|---|
| Unknown slug | /{locale}/ |
status: "draft" (deployed envs) | /{locale}/ |
| Invalid locale segment | / (geo-locale picks the market) |
| Manifest points at a missing file | /{locale}/ |
| Campaigns origin unreachable | /{locale}/ |
| Locale not covered by the campaign | /{primaryLocale}/campaigns/{slug} |
Always 302, never 301: a 301 is cached permanently by the browser and would make a campaign unreachable for visitors who arrived while it was still a draft. The query string is preserved because ad clicks carry utm_* and click ids.
Drafts are visible only when running nuxt dev locally. On dev.elome.com and elome.com they are hidden — preview a draft on the version URL the campaigns Worker publishes for the pull request instead.
Site header and footer¶
A campaign document opts into Elome chrome with two empty placeholders:
The proxy replaces them with markup rendered by app/pages/campaign-chrome.vue for the requested locale, fetched server-to-server and cached for 5 minutes per locale (server/utils/campaigns/chrome.ts). A document with no placeholders skips the fetch and the stylesheet entirely.
Why this is resolved at request time rather than snapshotted. The footer differs structurally per market, not just in wording: data/menus/legal.ts shows Impressum and Widerrufsbelehrung only for German locales, CGU only for fr-fr, and supported payment methods vary too. German law requires those links, so a stale copy in the campaigns project would be a compliance problem, not a visual one. Sourcing the chrome from the running app makes drift impossible — and every link in it already carries the right locale prefix.
app/pages/campaign-chrome.vue renders LayoutHeader in minimal mode plus the same reduced footer as app/layouts/clean.vue, with the locale switcher suppressed via the locale-switcher prop on LayoutFooterLogo (an ad already chose the market; letting the visitor switch would undo it).
It uses app/layouts/bare.vue rather than layout: false — app.vue mounts <NuxtLayout /> self-closing, so a page with no layout renders an empty document.
The chrome stylesheet¶
public/campaign-chrome.css is a generated artifact: a Tailwind build over the chrome markup, sampled across markets. The proxy links it only when it injected chrome.
It includes Tailwind's Preflight, but every base rule is scoped to [data-chrome]. Both halves of that matter. The chrome markup was authored against Preflight — links inherit their colour, headings inherit their size, images are block-level — so omitting it entirely leaves the footer rendering with browser defaults: blue underlined links and oversized headings. But emitting it globally would reset the landing page's own styles, which is the thing this whole architecture exists to avoid. Scoping it to the injected containers satisfies both.
Regenerate it when the header or footer markup changes — new utility classes will otherwise have no rules and the chrome will render subtly wrong. Render /{locale}/campaign-chrome for a few markets (at minimum da-dk, de-de, fr-fr), extract the data-chrome blocks, and run @tailwindcss/cli over them with theme.generated.css plus the px-var/py-var utilities from app/assets/css/main.css. Nothing checks this automatically today.
Two things a regeneration must preserve, because Tailwind will not produce them:
- The
@layer chrome-baseblock and the@layer properties, theme, chrome-base, utilities;declaration at the top of the file. This is the scoped Preflight. Drop it and the footer falls back to browser defaults; move it out of a layer and it overrides the utilities instead, because unlayered rules beat layered ones regardless of specificity. --color-link-hoveron[data-chrome]. Tailwind only emits theme variables that a generated utility references, and no chrome utility uses link-hover, so the token is dropped from the build and the hover state silently stops working.
The simplest safe procedure is to regenerate the Tailwind output separately and paste it in below the hand-written block, rather than overwriting the whole file.
Linking into the cart¶
Campaign pages are static and cannot create a cart: session cookies are httpOnly + sameSite=lax and are established server-side, so a cross-origin fetch would not work. Use a plain link instead:
app/pages/quick-buy.vue adds the product and forwards to checkout, reusing the same signupStarterKit mutation the normal signup flows use.
| Parameter | Default | Notes |
|---|---|---|
color | first of starterKit.colorPriority | Colour slug, e.g. peach-melba |
interval | first of starterKit.intervals (4) | Weeks. Must be one of 4, 8, 12 |
sku | starterKit.sku | Rarely needed |
Defaults live in app/app.config.ts.
Use SKU and colour slug, never numeric ids. WooCommerce databaseId values differ between cms-dev.elome.com and cms.elome.com, so an id baked into campaign markup would add a different product once the campaign is promoted to production.
If the link is malformed or the mutation fails, the visitor is sent into the normal signup flow with their colour and interval preselected — a dead buy button in a paid ad must not leave them on a blank screen. Linking directly to /checkout does not work: app/middleware/checkout-empty-cart.global.ts bounces an empty cart back to the front page.
Configuration¶
| Variable | Purpose |
|---|---|
PAGES_APP_ORIGIN | Origin of the campaigns Worker, e.g. https://pages.elome.com. Unset disables campaign routes (they fall back to the front page). |
GTM_ID | Already used by @nuxt/scripts; now also read at request time so campaign pages get GTM. |
Security¶
Campaign pages are served on the elome.com origin, so their JavaScript runs with the site's privileges. It cannot read auth tokens (all cookies are httpOnly), but the browser attaches them automatically, so campaign code could in principle call /api/graphql as the signed-in visitor.
Controls, in order of importance:
- Branch protection with required review on
elome-campaigns. This is the primary control. - Manifest allowlist — only declared,
liveslugs are proxied. - No
Set-Cookiepassthrough from the campaigns origin. - Slugs are restricted to
[a-z0-9-], and only single-segment slugs resolve.
About the asset subdomain¶
No cookie in server/utils/auth/cookies.ts sets a domain attribute, so gql-at, gql-rt and shop-session are host-only and are never sent to pages.elome.com. Consent is not split either: scripts loaded from the subdomain execute in the elome.com origin.
Two rules follow from that:
- Never set
Domain=.elome.comon a cookie. It would start leaking cookies to the asset domain. - Delete the DNS record before the Worker if the campaigns project is ever retired, otherwise the subdomain can be claimed by someone else and their JS would run in our origin.
The campaigns project needs its own hostname — static.elome.com is already the CDN in front of the WordPress uploads folder and must not be reused.
The hostname is pages.elome.com rather than anything containing campaign, promo or ads. The risk that motivated this is modest: ad-blocker rules matching those words almost all carry the $third-party modifier, and blockers judge third-party by registrable domain, so a request from elome.com to a sibling subdomain is first-party and exempt. But a blocked asset host would strip CSS and images from paid traffic without any error surfacing, and a neutral name costs nothing.
Note this only concerns subresources. The page URL itself still contains /campaigns/, which is irrelevant — blockers do not filter top-level document navigations.
Limitations¶
- Only single-segment slugs. A campaign needing a second page publishes it as its own slug.
- A campaign document must contain a
<head>. Without one the page is still served, but without consent or analytics, and the route logs an error.