code wiki / _hdl_build / nx_uigen_site.nx
nx_uigen_site.nx source
↩ module page · 607 lines · 45708 B
1// nx_uigen_site.nx -- PROMPT-TO-SITE: one natural-language BRIEF -> a LINKED MULTI-PAGE SITE. This is the
2// rung the 07-12 roadmap owed ("multi-page prompt-to-site: L2 kind-mapping x L3 grammar per page + shared
3// palette + real nav"). Composition, zero new design logic: the SITE PLAN (which pages exist) is inferred
4// from the brief by rule (word-start stem matching, the L2 idiom); the DESIGN of every page comes from ONE
5// L3 grammar spec (seed = a deterministic hash of the brief bytes; hue = the L2 topic map) so palette,
6// radius and rhythm cohere across the whole site; every page carries the SAME cross-page nav with REAL
7// hrefs (flat basenames -- publishable in the content namespace, no subdirs); index CTAs land on
8// contact.html (a real conversion path, not a dead anchor); sitemap.xml + robots.txt are emitted from the
9// same plan so the site model and its metadata cannot drift. Same brief -> same bytes (determinism moat).
10// HONEST scope: the plan vocabulary is bounded (6 page kinds) and copy is templated -- prose generation and
11// free component synthesis are L4 (learned). Pure emit like L1-L3 (sys_mmap only, no file io -- callers own
12// the write). license_tier: ORIGINAL
13import "nx_uigen_l2.nx"
14import "nx_uigen_l3.nx"
15import "nx_kit_counsel.nx"
16import "nx_kit_journal.nx"
17import "nx_kit_market.nx"
18const K_MAGIC_1469598103: i64 = 1469598103
19const K_MAGIC_2147483647: i64 = 2147483647
20const K_MAGIC_424242: i64 = 424242
21const K_MAGIC_1024: i64 = 1024
22
23// ---- deterministic site identity: brief bytes -> positive seed ----
24func us_hash(s: *u8) -> i64 {
25 var h: i64 = K_MAGIC_1469598103
26 var i: i64 = 0
27 while s[i] != (0 as u8) {
28 h = (h * 131 + (s[i] as i64)) % K_MAGIC_2147483647
29 i = i + 1
30 }
31 if h < 0 { h = 0 - h }
32 if h == 0 { h = K_MAGIC_424242 }
33 return h
34}
35
36// ---- page kinds: 0 index (grammar landing) 1 products 2 status 3 docs 4 about 5 contact ----
37func us_slug(kind: i64) -> *u8 {
38 if kind == 0 { return "index.html" as *u8 }
39 if kind == 1 { return "products.html" as *u8 }
40 if kind == 2 { return "status.html" as *u8 }
41 if kind == 3 { return "docs.html" as *u8 }
42 if kind == 4 { return "about.html" as *u8 }
43 return "contact.html" as *u8
44}
45func us_label(kind: i64) -> *u8 {
46 if kind == 0 { return "Home" as *u8 }
47 if kind == 1 { return "Products" as *u8 }
48 if kind == 2 { return "Status" as *u8 }
49 if kind == 3 { return "Docs" as *u8 }
50 if kind == 4 { return "About" as *u8 }
51 return "Contact" as *u8 }
52
53// ---- brief -> SITE PLAN (rule-based; index/about/contact always, others by intent). Returns n pages. ----
54func us_plan(brief: *u8, plan: *i64) -> i64 {
55 var n: i64 = 0
56 plan[n] = 0
57 n = n + 1
58 var prod: i64 = 0
59 if l2_has(brief, "store" as *u8) == 1 { prod = 1 }
60 if l2_has(brief, "shop" as *u8) == 1 { prod = 1 }
61 if l2_has(brief, "product" as *u8) == 1 { prod = 1 }
62 if l2_has(brief, "sell" as *u8) == 1 { prod = 1 }
63 if l2_has(brief, "buy" as *u8) == 1 { prod = 1 }
64 if l2_has(brief, "pricing" as *u8) == 1 { prod = 1 }
65 if prod == 1 { plan[n] = 1; n = n + 1 }
66 var st: i64 = 0
67 if l2_has(brief, "dashboard" as *u8) == 1 { st = 1 }
68 if l2_has(brief, "metric" as *u8) == 1 { st = 1 }
69 if l2_has(brief, "analytic" as *u8) == 1 { st = 1 }
70 if l2_has(brief, "status" as *u8) == 1 { st = 1 }
71 if l2_has(brief, "monitor" as *u8) == 1 { st = 1 }
72 if l2_has(brief, "kpi" as *u8) == 1 { st = 1 }
73 if l2_has(brief, "stats" as *u8) == 1 { st = 1 }
74 if st == 1 { plan[n] = 2; n = n + 1 }
75 var dc: i64 = 0
76 if l2_has(brief, "doc" as *u8) == 1 { dc = 1 }
77 if l2_has(brief, "guide" as *u8) == 1 { dc = 1 }
78 if l2_has(brief, "reference" as *u8) == 1 { dc = 1 }
79 if l2_has(brief, "manual" as *u8) == 1 { dc = 1 }
80 if dc == 1 { plan[n] = 3; n = n + 1 }
81 plan[n] = 4
82 n = n + 1
83 plan[n] = 5
84 n = n + 1
85 return n
86}
87
88// ---- intent -> DESIGN FAMILY (R-family-pro; the "they all look the same" root-cause fix). 1 = Counsel
89// (professional services: serif editorial grammar, no SaaS shapes); 0 = the marketing grammar. ----
90func us_family(brief: *u8) -> i64 {
91 // 2 = Journal (editorial/publication) -- checked FIRST so "a legal journal" reads as a publication
92 if l2_has(brief, "blog" as *u8) == 1 { return 2 }
93 if l2_has(brief, "magazine" as *u8) == 1 { return 2 }
94 if l2_has(brief, "journal" as *u8) == 1 { return 2 }
95 if l2_has(brief, "newsletter" as *u8) == 1 { return 2 }
96 if l2_has(brief, "editorial" as *u8) == 1 { return 2 }
97 if l2_has(brief, "essay" as *u8) == 1 { return 2 }
98 if l2_has(brief, "review" as *u8) == 1 { return 2 }
99 if l2_has(brief, "dispatch" as *u8) == 1 { return 2 }
100 if l2_has(brief, "press" as *u8) == 1 { return 2 }
101 // 3 = Market (commerce) -- after Journal so "a magazine about retail" stays a publication
102 if l2_has(brief, "store" as *u8) == 1 { return 3 }
103 if l2_has(brief, "shop" as *u8) == 1 { return 3 }
104 if l2_has(brief, "boutique" as *u8) == 1 { return 3 }
105 if l2_has(brief, "catalog" as *u8) == 1 { return 3 }
106 if l2_has(brief, "merch" as *u8) == 1 { return 3 }
107 if l2_has(brief, "ecommerce" as *u8) == 1 { return 3 }
108 if l2_has(brief, "retail" as *u8) == 1 { return 3 }
109 if l2_has(brief, "law" as *u8) == 1 { return 1 }
110 if l2_has(brief, "legal" as *u8) == 1 { return 1 }
111 if l2_has(brief, "attorney" as *u8) == 1 { return 1 }
112 if l2_has(brief, "solicitor" as *u8) == 1 { return 1 }
113 if l2_has(brief, "litig" as *u8) == 1 { return 1 }
114 if l2_has(brief, "counsel" as *u8) == 1 { return 1 }
115 if l2_has(brief, "estate" as *u8) == 1 { return 1 }
116 if l2_has(brief, "account" as *u8) == 1 { return 1 }
117 if l2_has(brief, "advisor" as *u8) == 1 { return 1 }
118 if l2_has(brief, "notary" as *u8) == 1 { return 1 }
119 return 0
120}
121
122// ---- ONE design spec for the whole site: L3 grammar from the brief hash, hue from the L2 topic map ----
123func us_spec(brief: *u8, spec: *i64) -> i64 {
124 let seed: i64 = us_hash(brief)
125 l3_spec_from_seed(spec, seed)
126 spec[0] = l2_hue(brief)
127 return 0
128}
129
130// ---- the shared cross-page nav (every page links every page; hrefs are real flat basenames) ----
131func us_nav(buf: *u8, off: i64, plan: *i64, n: i64) -> i64 {
132 var o: i64 = off
133 var i: i64 = 0
134 while i < n {
135 o = sk_nav_item(buf, o, us_label(plan[i]), us_slug(plan[i]))
136 i = i + 1
137 }
138 return o
139}
140
141// ---- requirements briefs (R-content, mirrors the factory R5b grammar): line-oriented
142// "<page>|<key>|<value>" bytes. req = 0 -> every key falls back to its default, so the no-brief
143// path emits BYTE-IDENTICAL output by construction. Values cap at 1000B per key. ----
144func us_match_at(s: *u8, at: i64, lit: *u8) -> i64 {
145 var j: i64 = at
146 var p: i64 = 0
147 while lit[p] != (0 as u8) {
148 if s[j] != lit[p] { return 0 - 1 }
149 j = j + 1
150 p = p + 1
151 }
152 return j
153}
154// THE SITE CAPABILITY PLANE: a site declares what it HAS as caps|<name>|<destination>.
155// A CAPABILITY'S DECLARATION IS ITS BACKING -- the value is the destination, not a boolean, so a
156// capability cannot be claimed without naming what serves it. Undeclared => never emitted.
157func us_cap(req: *u8, name: *u8) -> *u8 {
158 return us_req_get(req, "caps" as *u8, name, "" as *u8)
159}
160// Same plane, with a default for capabilities whose backing is a page the plan ALWAYS carries (the
161// contact tier). A default is legitimate ONLY when the destination provably exists: `cart` has none,
162// so it must be declared or omitted; `booking` resolves to the contact page every site already has.
163func us_capd(req: *u8, name: *u8, dflt: *u8) -> *u8 {
164 return us_req_get(req, "caps" as *u8, name, dflt)
165}
166func us_req_get(req: *u8, page: *u8, key: *u8, dflt: *u8) -> *u8 {
167 if (req as i64) == 0 { return dflt }
168 var i: i64 = 0
169 var atstart: i64 = 1
170 while req[i] != (0 as u8) {
171 if atstart == 1 {
172 let j: i64 = us_match_at(req, i, page)
173 if j >= 0 {
174 if req[j] == (124 as u8) {
175 let k: i64 = us_match_at(req, j + 1, key)
176 if k >= 0 {
177 if req[k] == (124 as u8) {
178 let out: *u8 = sys_mmap(K_MAGIC_1024)
179 var v: i64 = k + 1
180 var o: i64 = 0
181 var stop: i64 = 0
182 while stop == 0 {
183 if req[v] == (0 as u8) { stop = 1 } else {
184 if req[v] == (10 as u8) { stop = 1 } else {
185 if req[v] == (13 as u8) { stop = 1 } else {
186 if o < 1000 { out[o] = req[v]; o = o + 1 }
187 v = v + 1
188 }
189 }
190 }
191 }
192 out[o] = 0 as u8
193 return out
194 }
195 }
196 }
197 }
198 }
199 if req[i] == (10 as u8) { atstart = 1 } else { atstart = 0 }
200 i = i + 1
201 }
202 return dflt
203}
204
205// R0a presence probe: does the req provide <page>|<key>|<value>? A channel or form target renders ONLY
206// when the client's req actually names it -- a fabricated default contact channel would be a fake.
207func us_req_has(req: *u8, page: *u8, key: *u8) -> i64 {
208 if (req as i64) == 0 { return 0 }
209 var i: i64 = 0
210 var atstart: i64 = 1
211 while req[i] != (0 as u8) {
212 if atstart == 1 {
213 let j: i64 = us_match_at(req, i, page)
214 if j >= 0 {
215 if req[j] == (124 as u8) {
216 let k: i64 = us_match_at(req, j + 1, key)
217 if k >= 0 {
218 if req[k] == (124 as u8) { return 1 }
219 }
220 }
221 }
222 }
223 if req[i] == (10 as u8) { atstart = 1 } else { atstart = 0 }
224 i = i + 1
225 }
226 return 0
227}
228
229// ---- shells: hero tier (index/products) and doc tier (status/docs/about/contact), both carrying the
230// shared nav + the SITE spec's palette/mods so design coheres across every page ----
231func us_shell_hero(buf: *u8, off: i64, spec: *i64, title: *u8, brand: *u8, plan: *i64, n: i64) -> i64 {
232 var o: i64 = sk_open_site(buf, off, title, brand, 1, "index.html" as *u8)
233 o = us_nav(buf, o, plan, n)
234 o = sk_header_close(buf, o)
235 o = l3_palette_style(buf, o, spec[0], spec[1])
236 o = l3_style_mods(buf, o, spec[2], spec[3])
237 o = sk_mkt_styles(buf, o)
238 return o
239}
240// fam=1 carries the Counsel family through the doc tier, so a site never ships two design languages
241// (the 07-25 render caught a serif ivory home page next to a cool-grey SaaS contact page).
242func us_shell_doc(buf: *u8, off: i64, spec: *i64, title: *u8, brand: *u8, plan: *i64, n: i64, fam: i64) -> i64 {
243 var o: i64 = sk_doc_open(buf, off, title, brand, "index.html" as *u8)
244 o = us_nav(buf, o, plan, n)
245 o = sk_header_close(buf, o)
246 o = l3_palette_style(buf, o, spec[0], spec[1])
247 if fam == 1 {
248 o = kc_styles(buf, o, spec[0])
249 o = kc_doc_styles(buf, o)
250 } else {
251 if fam == 2 {
252 o = kj_styles(buf, o, spec[0])
253 o = kj_doc_styles(buf, o)
254 } else {
255 if fam == 3 {
256 o = km_styles(buf, o, spec[0])
257 o = km_doc_styles(buf, o)
258 } else {
259 o = l3_style_mods(buf, o, spec[2], spec[3])
260 }
261 }
262 }
263 o = sk_doc_main(buf, o)
264 return o
265}
266
267// ---- per-kind pages ----
268func us_page_index(buf: *u8, off: i64, spec: *i64, title: *u8, brand: *u8, plan: *i64, n: i64, req: *u8) -> i64 {
269 var o: i64 = us_shell_hero(buf, off, spec, title, brand, plan, n)
270 o = sk_hero(buf, o, us_req_get(req, "index" as *u8, "eyebrow" as *u8, "Welcome" as *u8), title, us_req_get(req, "index" as *u8, "grad" as *u8, "online" as *u8), us_req_get(req, "index" as *u8, "lede" as *u8, "A clear offer, a fast site, and one obvious next step. Everything else is detail." as *u8), "Get in touch" as *u8, "contact.html" as *u8, "Learn more" as *u8, "about.html" as *u8, us_req_get(req, "index" as *u8, "hint" as *u8, "No trackers and no third-party scripts — just a fast page." as *u8))
271 let flip: i64 = spec[0] % 2
272 var i: i64 = 0
273 while i < spec[4] {
274 o = l3_emit_section(buf, o, spec[5 + i], flip)
275 i = i + 1
276 }
277 o = sk_cta(buf, o, "Ready" as *u8, "Talk to us" as *u8, "The contact page is one click away — a real page, not an anchor." as *u8, "Contact us" as *u8, "contact.html" as *u8, "About us" as *u8, "about.html" as *u8)
278 o = sk_close(buf, o, "Home" as *u8, brand)
279 return o
280}
281func us_page_products(buf: *u8, off: i64, spec: *i64, title: *u8, brand: *u8, plan: *i64, n: i64, req: *u8) -> i64 {
282 var o: i64 = us_shell_hero(buf, off, spec, title, brand, plan, n)
283 o = sk_section_open(buf, o, "catalog" as *u8, "Catalog" as *u8, us_req_get(req, "products" as *u8, "h2" as *u8, "What we offer" as *u8), us_req_get(req, "products" as *u8, "sub" as *u8, "Structure and design are generated; real item copy arrives via a requirements brief." as *u8))
284 o = sk_card(buf, o, "<svg viewBox=\"0 0 24 24\" width=\"22\" height=\"22\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M6 6h15l-2 9H8L6 3H3\"/><circle cx=\"9\" cy=\"20\" r=\"1.5\"/><circle cx=\"18\" cy=\"20\" r=\"1.5\"/></svg>" as *u8, us_req_get(req, "products" as *u8, "1.t" as *u8, "The flagship" as *u8), us_req_get(req, "products" as *u8, "1.b" as *u8, "The thing people come for, described in one honest sentence." as *u8))
285 o = sk_card(buf, o, "<svg viewBox=\"0 0 24 24\" width=\"22\" height=\"22\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M20 12v8H4v-8M2 7h20v5H2zM12 7v13M12 7c2.5 0 4-1.5 4-3.5C16 2 14 2 12 4c-2-2-4-2-4-.5C8 5.5 9.5 7 12 7z\"/></svg>" as *u8, us_req_get(req, "products" as *u8, "2.t" as *u8, "The favorite" as *u8), us_req_get(req, "products" as *u8, "2.b" as *u8, "A close second, the one regulars quietly prefer." as *u8))
286 o = sk_card(buf, o, "<svg viewBox=\"0 0 24 24\" width=\"22\" height=\"22\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M12 2l2.9 6.3 6.6.6-5 4.5 1.5 6.6-6-3.5-6 3.5L7.5 13l-5-4.5 6.6-.6z\"/></svg>" as *u8, us_req_get(req, "products" as *u8, "3.t" as *u8, "The newcomer" as *u8), us_req_get(req, "products" as *u8, "3.b" as *u8, "Fresh on the shelf and finding its audience." as *u8))
287 o = sk_section_close(buf, o)
288 o = l3_sec_pricing(buf, o)
289 o = sk_cta(buf, o, "Questions" as *u8, "Not sure which fits?" as *u8, "Tell us what you need and we’ll point you right." as *u8, "Contact us" as *u8, "contact.html" as *u8, "About us" as *u8, "about.html" as *u8)
290 o = sk_close(buf, o, "Products" as *u8, brand)
291 return o
292}
293// R0a/R0c (debt 1785934277): metrics are CLAIMS -- they render ONLY from req-provided values
294// (status|score, status|sN.v, status|rN.s...), never from built-in numbers. A req with no
295// measurements gets an honest coming-soon, not a fabricated scorecard.
296func us_page_status(buf: *u8, off: i64, spec: *i64, title: *u8, brand: *u8, plan: *i64, n: i64, req: *u8, fam: i64) -> i64 {
297 var o: i64 = us_shell_doc(buf, off, spec, title, brand, plan, n, fam)
298 o = sk_doc_h1(buf, o, "Status" as *u8, us_req_get(req, "status" as *u8, "lede" as *u8, "Current status of this service." as *u8))
299 let hsc: i64 = us_req_has(req, "status" as *u8, "score" as *u8)
300 let hrw: i64 = us_req_has(req, "status" as *u8, "r1.s" as *u8)
301 if hsc == 1 {
302 o = sk_score_open(buf, o, us_req_get(req, "status" as *u8, "score" as *u8, " " as *u8), us_req_get(req, "status" as *u8, "score.l" as *u8, " " as *u8))
303 if us_req_has(req, "status" as *u8, "s1.v" as *u8) == 1 { o = sk_stat(buf, o, us_req_get(req, "status" as *u8, "s1.v" as *u8, " " as *u8), us_req_get(req, "status" as *u8, "s1.l" as *u8, " " as *u8)) }
304 if us_req_has(req, "status" as *u8, "s2.v" as *u8) == 1 { o = sk_stat(buf, o, us_req_get(req, "status" as *u8, "s2.v" as *u8, " " as *u8), us_req_get(req, "status" as *u8, "s2.l" as *u8, " " as *u8)) }
305 if us_req_has(req, "status" as *u8, "s3.v" as *u8) == 1 { o = sk_stat(buf, o, us_req_get(req, "status" as *u8, "s3.v" as *u8, " " as *u8), us_req_get(req, "status" as *u8, "s3.l" as *u8, " " as *u8)) }
306 o = sk_score_close(buf, o)
307 }
308 if hrw == 1 {
309 o = sk_h2(buf, o, us_req_get(req, "status" as *u8, "h2" as *u8, "Services" as *u8))
310 o = sk_dtable_open(buf, o, "Service" as *u8, "Status" as *u8, "Note" as *u8)
311 o = sk_drow(buf, o, us_req_get(req, "status" as *u8, "r1.s" as *u8, " " as *u8), us_req_get(req, "status" as *u8, "r1.c" as *u8, "have" as *u8), us_req_get(req, "status" as *u8, "r1.st" as *u8, " " as *u8), us_req_get(req, "status" as *u8, "r1.n" as *u8, " " as *u8))
312 if us_req_has(req, "status" as *u8, "r2.s" as *u8) == 1 { o = sk_drow(buf, o, us_req_get(req, "status" as *u8, "r2.s" as *u8, " " as *u8), us_req_get(req, "status" as *u8, "r2.c" as *u8, "have" as *u8), us_req_get(req, "status" as *u8, "r2.st" as *u8, " " as *u8), us_req_get(req, "status" as *u8, "r2.n" as *u8, " " as *u8)) }
313 if us_req_has(req, "status" as *u8, "r3.s" as *u8) == 1 { o = sk_drow(buf, o, us_req_get(req, "status" as *u8, "r3.s" as *u8, " " as *u8), us_req_get(req, "status" as *u8, "r3.c" as *u8, "have" as *u8), us_req_get(req, "status" as *u8, "r3.st" as *u8, " " as *u8), us_req_get(req, "status" as *u8, "r3.n" as *u8, " " as *u8)) }
314 o = sk_dtable_close(buf, o)
315 }
316 if hsc == 0 { if hrw == 0 {
317 o = sk_callout(buf, o, "<strong>Coming soon:</strong> live measurements will appear here once monitoring is connected." as *u8)
318 } }
319 o = sk_doc_close(buf, o, us_req_get(req, "status" as *u8, "foot" as *u8, brand), brand)
320 return o
321}
322func us_page_docs(buf: *u8, off: i64, spec: *i64, title: *u8, brand: *u8, plan: *i64, n: i64, req: *u8, fam: i64) -> i64 {
323 var o: i64 = us_shell_doc(buf, off, spec, title, brand, plan, n, fam)
324 o = sk_doc_h1(buf, o, "Documentation" as *u8, us_req_get(req, "docs" as *u8, "lede" as *u8, "Guides and reference for this product." as *u8))
325 o = sk_h2(buf, o, us_req_get(req, "docs" as *u8, "h2a" as *u8, "Getting started" as *u8))
326 o = sk_lede(buf, o, us_req_get(req, "docs" as *u8, "p1" as *u8, "Start here for the essentials; each section goes one level deeper." as *u8))
327 o = sk_h2(buf, o, us_req_get(req, "docs" as *u8, "h2b" as *u8, "Concepts" as *u8))
328 o = sk_lede(buf, o, us_req_get(req, "docs" as *u8, "p2" as *u8, "The ideas behind the product, explained in plain language." as *u8))
329 o = sk_callout(buf, o, us_req_get(req, "docs" as *u8, "note" as *u8, "<strong>Looking for something specific?</strong> The Contact page is the fastest way to ask." as *u8))
330 o = sk_doc_close(buf, o, us_req_get(req, "docs" as *u8, "foot" as *u8, brand), brand)
331 return o
332}
333func us_page_about(buf: *u8, off: i64, spec: *i64, title: *u8, brand: *u8, plan: *i64, n: i64, req: *u8, fam: i64) -> i64 {
334 var o: i64 = us_shell_doc(buf, off, spec, title, brand, plan, n, fam)
335 o = sk_doc_h1(buf, o, "About" as *u8, us_req_get(req, "about" as *u8, "lede" as *u8, "Who we are, and why this site looks the way it does." as *u8))
336 o = sk_lede(buf, o, us_req_get(req, "about" as *u8, "p1" as *u8, "We keep this page simple: who we are, what we value, and how we work." as *u8))
337 o = sk_h2(buf, o, us_req_get(req, "about" as *u8, "h2" as *u8, "What you can rely on" as *u8))
338 o = sk_lede(buf, o, us_req_get(req, "about" as *u8, "p2" as *u8, "Fast, accessible pages with nothing loaded from third parties — in light and dark alike." as *u8))
339 o = sk_callout(buf, o, us_req_get(req, "about" as *u8, "note" as *u8, "<strong>Privacy:</strong> this site sets no cookies and loads nothing from third parties." as *u8))
340 o = sk_doc_close(buf, o, us_req_get(req, "about" as *u8, "foot" as *u8, brand), brand)
341 return o
342}
343// R0a: a form with no handler is a FAKE (debt 1785883411). The form renders ONLY when the req names a
344// real POST target (contact|action); channels the req provides (contact|phone, contact|email) render as
345// one-tap tel:/mailto links; a page with none of the three says so honestly instead of faking a form.
346func us_page_contact(buf: *u8, off: i64, spec: *i64, title: *u8, brand: *u8, plan: *i64, n: i64, req: *u8, fam: i64) -> i64 {
347 var o: i64 = us_shell_doc(buf, off, spec, title, brand, plan, n, fam)
348 o = sk_doc_h1(buf, o, "Contact" as *u8, us_req_get(req, "contact" as *u8, "lede" as *u8, "How to reach us." as *u8))
349 o = he_puts(buf, o, "<style>.nx-channel{margin:14px 0}.nx-channel a.btnp{display:inline-block;text-decoration:none}</style>" as *u8)
350 let hasph: i64 = us_req_has(req, "contact" as *u8, "phone" as *u8)
351 let hasem: i64 = us_req_has(req, "contact" as *u8, "email" as *u8)
352 let hasact: i64 = us_req_has(req, "contact" as *u8, "action" as *u8)
353 if hasph == 1 {
354 o = he_puts(buf, o, "<p class=\"nx-channel\"><a class=\"btnp\" href=\"tel:" as *u8)
355 o = he_puts(buf, o, us_req_get(req, "contact" as *u8, "phone" as *u8, " " as *u8))
356 o = he_puts(buf, o, "\">Call " as *u8)
357 o = he_puts(buf, o, us_req_get(req, "contact" as *u8, "phone_label" as *u8, us_req_get(req, "contact" as *u8, "phone" as *u8, " " as *u8)))
358 o = he_puts(buf, o, "</a></p>" as *u8)
359 }
360 if hasem == 1 {
361 o = he_puts(buf, o, "<p class=\"nx-channel\"><a href=\"mailto:" as *u8)
362 o = he_puts(buf, o, us_req_get(req, "contact" as *u8, "email" as *u8, " " as *u8))
363 o = he_puts(buf, o, "\">" as *u8)
364 o = he_puts(buf, o, us_req_get(req, "contact" as *u8, "email" as *u8, " " as *u8))
365 o = he_puts(buf, o, "</a></p>" as *u8)
366 }
367 if hasact == 1 {
368 // zero-JS confirmation: the handler 303s to ...#sent and :target reveals the block (R0e --
369 // the confirmation validates the choice; nothing renders unless the fragment is present)
370 o = he_puts(buf, o, "<style>#sent{display:none}#sent:target{display:block}</style><div class=\"callout\" id=\"sent\"><strong>Message sent.</strong> A person reads every message; you will hear back at the address you gave.</div>" as *u8)
371 o = sk_form_open(buf, o, us_req_get(req, "contact" as *u8, "action" as *u8, " " as *u8))
372 // honeypot: invisible to people (display:none + tabindex -1), irresistible to form bots;
373 // the handler records nothing when it is filled and answers success anyway
374 o = he_puts(buf, o, "<input type=\"text\" name=\"website\" value=\"\" style=\"display:none\" tabindex=\"-1\" autocomplete=\"off\" aria-hidden=\"true\">" as *u8)
375 if us_req_has(req, "contact" as *u8, "back" as *u8) == 1 {
376 o = he_puts(buf, o, "<input type=\"hidden\" name=\"back\" value=\"" as *u8)
377 o = he_puts(buf, o, us_req_get(req, "contact" as *u8, "back" as *u8, " " as *u8))
378 o = he_puts(buf, o, "\">" as *u8)
379 }
380 o = sk_field(buf, o, "name" as *u8, "Full name" as *u8, "text" as *u8, "Jane Doe" as *u8)
381 o = sk_field(buf, o, "email" as *u8, "Email" as *u8, "email" as *u8, "jane@example.com" as *u8)
382 o = sk_field_area(buf, o, "message" as *u8, "Message" as *u8, "How can we help?" as *u8)
383 o = sk_form_submit(buf, o, "Send" as *u8)
384 o = sk_form_close(buf, o)
385 }
386 if hasact == 0 { if hasph == 0 { if hasem == 0 {
387 o = sk_callout(buf, o, "<strong>Coming soon:</strong> contact channels for this site are being set up." as *u8)
388 } } }
389 o = sk_doc_close(buf, o, us_req_get(req, "contact" as *u8, "foot" as *u8, brand), brand)
390 return o
391}
392
393// h2h v2 measured gap (debt 1785953261): 6/8 field law homepages carry the phone, ours carried ZERO.
394// The same kc-final band plus the one-tap tel line -- rendered ONLY when the req names a real phone
395// (presence-gated: no phone in the req, no fabricated number on the page).
396func us_kc_final_tel(buf: *u8, off: i64, h2: *u8, p: *u8, cta: *u8, href: *u8, teluri: *u8, tellabel: *u8) -> i64 {
397 var o: i64 = he_puts(buf, off, "<section class=\"kc-final\"><div class=\"wrap\"><div><h2>" as *u8)
398 o = he_puts(buf, o, h2)
399 o = he_puts(buf, o, "</h2><p>" as *u8)
400 o = he_puts(buf, o, p)
401 o = he_puts(buf, o, "</p><p style=\"margin-top:14px\"><a href=\"tel:" as *u8)
402 o = he_puts(buf, o, teluri)
403 o = he_puts(buf, o, "\" style=\"color:#fff;font-weight:640;text-decoration:none;border-bottom:2px solid var(--kc-gold)\">Call " as *u8)
404 o = he_puts(buf, o, tellabel)
405 o = he_puts(buf, o, "</a></p></div><a class=\"kc-btn\" href=\"" as *u8)
406 o = he_puts(buf, o, href)
407 o = he_puts(buf, o, "\">" as *u8)
408 o = he_puts(buf, o, cta)
409 o = he_puts(buf, o, "</a></div></section>" as *u8)
410 return o
411}
412
413// ---- the COUNSEL index (professional-services family): serif editorial grammar per the extracted
414// 30-site law-firm reference bar. Fixed dignified sequence: split hero w/ generative scene ->
415// stats-first trust -> ruled practice list -> testimonial + accreditations -> deep final CTA.
416// Deliberately NO l3 marketing bands, no pills, no card grid, no pricing. ----
417func us_page_index_counsel(buf: *u8, off: i64, spec: *i64, title: *u8, brand: *u8, plan: *i64, n: i64, req: *u8) -> i64 {
418 var o: i64 = sk_open_site(buf, off, title, brand, 1, "index.html" as *u8)
419 o = us_nav(buf, o, plan, n)
420 o = sk_header_close(buf, o)
421 o = l3_palette_style(buf, o, spec[0], spec[1])
422 o = kc_styles(buf, o, spec[0])
423 o = kc_hero(buf, o, us_req_get(req, "index" as *u8, "eyebrow" as *u8, "Counsel you can sit across from" as *u8), us_req_get(req, "index" as *u8, "h1" as *u8, title), us_req_get(req, "index" as *u8, "lede" as *u8, "Serious matters deserve unhurried attention. We take fewer clients, return every call, and tell you plainly where you stand before a single fee is discussed." as *u8), us_req_get(req, "index" as *u8, "cta" as *u8, "Book a consultation" as *u8), us_capd(req, "booking" as *u8, "contact.html" as *u8), "Our practice" as *u8, "about.html" as *u8, spec[10])
424 // R0a (pre-live checklist item 2): numbers are CLAIMS -- the band renders ONLY from req values,
425 // never from templated defaults. A req-less Counsel index is a tighter page, not a fabricated one.
426 if us_req_has(req, "index" as *u8, "s1.n" as *u8) == 1 {
427 o = kc_sec_open(buf, o, "By the" as *u8, "numbers" as *u8)
428 o = kc_stats_open(buf, o)
429 o = kc_stat(buf, o, us_req_get(req, "index" as *u8, "s1.n" as *u8, " " as *u8), us_req_get(req, "index" as *u8, "s1.l" as *u8, " " as *u8))
430 if us_req_has(req, "index" as *u8, "s2.n" as *u8) == 1 { o = kc_stat(buf, o, us_req_get(req, "index" as *u8, "s2.n" as *u8, " " as *u8), us_req_get(req, "index" as *u8, "s2.l" as *u8, " " as *u8)) }
431 if us_req_has(req, "index" as *u8, "s3.n" as *u8) == 1 { o = kc_stat(buf, o, us_req_get(req, "index" as *u8, "s3.n" as *u8, " " as *u8), us_req_get(req, "index" as *u8, "s3.l" as *u8, " " as *u8)) }
432 o = kc_stats_close(buf, o)
433 o = kc_sec_close(buf, o)
434 }
435 o = kc_sec_open(buf, o, "Areas of" as *u8, "practice" as *u8)
436 o = kc_list_open(buf, o)
437 o = kc_item(buf, o, us_req_get(req, "index" as *u8, "p1.t" as *u8, "Family law" as *u8), us_req_get(req, "index" as *u8, "p1.b" as *u8, "Divorce, custody and support, handled with steadiness when it matters most." as *u8))
438 o = kc_item(buf, o, us_req_get(req, "index" as *u8, "p2.t" as *u8, "Estate planning" as *u8), us_req_get(req, "index" as *u8, "p2.b" as *u8, "Wills, trusts and succession that hold up — and that your family can actually follow." as *u8))
439 o = kc_item(buf, o, us_req_get(req, "index" as *u8, "p3.t" as *u8, "Business counsel" as *u8), us_req_get(req, "index" as *u8, "p3.b" as *u8, "Formation, contracts and disputes for owners who want a lawyer who answers." as *u8))
440 o = kc_item(buf, o, us_req_get(req, "index" as *u8, "p4.t" as *u8, "Civil litigation" as *u8), us_req_get(req, "index" as *u8, "p4.b" as *u8, "When settlement fails, a trial practice that has been there before." as *u8))
441 o = kc_list_close(buf, o)
442 o = kc_sec_close(buf, o)
443 // testimonials and accreditations are CLAIMS too: quote gates on index|q, accred on index|a1
444 let hasq: i64 = us_req_has(req, "index" as *u8, "q" as *u8)
445 let hasacc: i64 = us_req_has(req, "index" as *u8, "a1" as *u8)
446 if hasq == 1 {
447 o = kc_sec_open(buf, o, "What clients" as *u8, "say" as *u8)
448 o = kc_quote(buf, o, us_req_get(req, "index" as *u8, "q" as *u8, " " as *u8), us_req_get(req, "index" as *u8, "qn" as *u8, " " as *u8), us_req_get(req, "index" as *u8, "qr" as *u8, " " as *u8))
449 if hasacc == 1 { o = kc_accred(buf, o, us_req_get(req, "index" as *u8, "a1" as *u8, " " as *u8), us_req_get(req, "index" as *u8, "a2" as *u8, " " as *u8), us_req_get(req, "index" as *u8, "a3" as *u8, " " as *u8)) }
450 o = kc_sec_close(buf, o)
451 }
452 if hasq == 0 { if hasacc == 1 {
453 o = kc_sec_open(buf, o, "Our" as *u8, "standing" as *u8)
454 o = kc_accred(buf, o, us_req_get(req, "index" as *u8, "a1" as *u8, " " as *u8), us_req_get(req, "index" as *u8, "a2" as *u8, " " as *u8), us_req_get(req, "index" as *u8, "a3" as *u8, " " as *u8))
455 o = kc_sec_close(buf, o)
456 } }
457 if us_req_has(req, "contact" as *u8, "phone" as *u8) == 1 {
458 o = us_kc_final_tel(buf, o, us_req_get(req, "index" as *u8, "f.h" as *u8, "Speak with counsel this week" as *u8), us_req_get(req, "index" as *u8, "f.p" as *u8, "A thirty-minute conversation about where you stand. No pressure, no obligation." as *u8), us_req_get(req, "index" as *u8, "cta" as *u8, "Book a consultation" as *u8), us_capd(req, "booking" as *u8, "contact.html" as *u8), us_req_get(req, "contact" as *u8, "phone" as *u8, " " as *u8), us_req_get(req, "contact" as *u8, "phone_label" as *u8, us_req_get(req, "contact" as *u8, "phone" as *u8, " " as *u8)))
459 } else {
460 o = kc_final(buf, o, us_req_get(req, "index" as *u8, "f.h" as *u8, "Speak with counsel this week" as *u8), us_req_get(req, "index" as *u8, "f.p" as *u8, "A thirty-minute conversation about where you stand. No pressure, no obligation." as *u8), us_req_get(req, "index" as *u8, "cta" as *u8, "Book a consultation" as *u8), us_capd(req, "booking" as *u8, "contact.html" as *u8))
461 }
462 o = sk_close(buf, o, "Home" as *u8, brand)
463 return o
464}
465// ---- the JOURNAL index (editorial family): masthead + lead article + ruled article list + subscribe.
466// No hero band, no card grid, no CTA pill -- a publication front page, not a marketing page. ----
467func us_page_index_journal(buf: *u8, off: i64, spec: *i64, title: *u8, brand: *u8, plan: *i64, n: i64, req: *u8) -> i64 {
468 var o: i64 = sk_open_site(buf, off, title, brand, 1, "index.html" as *u8)
469 o = us_nav(buf, o, plan, n)
470 o = sk_header_close(buf, o)
471 o = l3_palette_style(buf, o, spec[0], spec[1])
472 o = kj_styles(buf, o, spec[0])
473 o = kj_lead(buf, o, us_req_get(req, "index" as *u8, "kicker" as *u8, "This week" as *u8), us_req_get(req, "index" as *u8, "h1" as *u8, title), us_req_get(req, "index" as *u8, "deck" as *u8, "The week’s lead story, the columns beside it, and the edition’s archive — all on one front page." as *u8), us_req_get(req, "index" as *u8, "byline" as *u8, "By the editors" as *u8), us_req_get(req, "index" as *u8, "p1" as *u8, "The lead column opens with a drop cap and runs justified across two columns, the way a printed page has set type for four centuries. Nothing here is a card." as *u8), us_req_get(req, "index" as *u8, "p2" as *u8, "Each edition keeps the same measured typography — rules, small caps, a steady measure — so the words carry the week, not the furniture." as *u8), us_req_get(req, "index" as *u8, "p3" as *u8, "The masthead is the whole map: every section of this publication is one step from here." as *u8))
474 o = kj_more_open(buf, o, us_req_get(req, "index" as *u8, "more" as *u8, "Also in this edition" as *u8))
475 o = kj_art(buf, o, us_req_get(req, "index" as *u8, "a1.t" as *u8, "The second story" as *u8), us_req_get(req, "index" as *u8, "a1.d" as *u8, "A short deck explaining why a reader should stop here." as *u8), us_req_get(req, "index" as *u8, "a1.m" as *u8, "Feature" as *u8))
476 o = kj_art(buf, o, us_req_get(req, "index" as *u8, "a2.t" as *u8, "A column" as *u8), us_req_get(req, "index" as *u8, "a2.d" as *u8, "Opinion runs beside reporting, marked as such." as *u8), us_req_get(req, "index" as *u8, "a2.m" as *u8, "Column" as *u8))
477 o = kj_art(buf, o, us_req_get(req, "index" as *u8, "a3.t" as *u8, "From the archive" as *u8), us_req_get(req, "index" as *u8, "a3.d" as *u8, "Older editions stay readable; nothing is retired to make room." as *u8), us_req_get(req, "index" as *u8, "a3.m" as *u8, "Archive" as *u8))
478 o = kj_more_close(buf, o)
479 o = kj_sub(buf, o, us_req_get(req, "index" as *u8, "sub.h" as *u8, "Read the next edition" as *u8), us_req_get(req, "index" as *u8, "sub.p" as *u8, "No third-party trackers, no client scripts, no paywall script. Write to the editors and we will add you." as *u8), us_req_get(req, "index" as *u8, "cta" as *u8, "Write to us" as *u8), us_capd(req, "subscribe" as *u8, "contact.html" as *u8))
480 o = sk_close(buf, o, "Front page" as *u8, brand)
481 return o
482}
483// ---- the MARKET index (commerce family): utility bar + shop masthead + category chips + promo strip +
484// PRODUCT GRID (generated visuals, real prices, add-to-cart) + shipping/returns/secure row.
485// Deliberately NO gradient hero, NO feature-card grid, NO pricing-TIER band. ----
486func us_page_index_market(buf: *u8, off: i64, spec: *i64, title: *u8, brand: *u8, plan: *i64, n: i64, req: *u8) -> i64 {
487 let hue: i64 = spec[0]
488 var o: i64 = sk_head(buf, off, title, 1)
489 o = l3_palette_style(buf, o, hue, spec[1])
490 o = km_styles(buf, o, hue)
491 o = km_util2(buf, o, us_req_get(req, "index" as *u8, "ship" as *u8, "Free delivery over £30 · dispatched next working day" as *u8), us_cap(req, "search" as *u8), us_cap(req, "cart" as *u8), us_req_get(req, "index" as *u8, "cartlabel" as *u8, "Cart" as *u8))
492 o = sk_header_open(buf, o, brand, "index.html" as *u8)
493 o = us_nav(buf, o, plan, n)
494 o = sk_header_close(buf, o)
495 o = km_chips_open(buf, o)
496 o = km_chip(buf, o, us_req_get(req, "index" as *u8, "c1" as *u8, "All" as *u8))
497 o = km_chip(buf, o, us_req_get(req, "index" as *u8, "c2" as *u8, "New in" as *u8))
498 o = km_chip(buf, o, us_req_get(req, "index" as *u8, "c3" as *u8, "Best sellers" as *u8))
499 o = km_chip(buf, o, us_req_get(req, "index" as *u8, "c4" as *u8, "Gifts" as *u8))
500 o = km_chips_close(buf, o)
501 o = km_promo(buf, o, us_req_get(req, "index" as *u8, "promo" as *u8, "Everything made in small batches" as *u8), us_req_get(req, "index" as *u8, "promosub" as *u8, "Ordered today, packed tomorrow, by the people who made it." as *u8))
502 o = km_shop_open(buf, o, us_req_get(req, "index" as *u8, "shoph" as *u8, "Shop everything" as *u8), us_req_get(req, "index" as *u8, "shopsub" as *u8, "Prices include VAT. Returns accepted for 30 days, opened or not." as *u8))
503 o = km_item(buf, o, hue, 0, us_req_get(req, "index" as *u8, "1.t" as *u8, "The flagship" as *u8), us_req_get(req, "index" as *u8, "1.b" as *u8, "The one people come back for." as *u8), us_req_get(req, "index" as *u8, "1.p" as *u8, "£18.00" as *u8))
504 o = km_item(buf, o, hue, 1, us_req_get(req, "index" as *u8, "2.t" as *u8, "The favourite" as *u8), us_req_get(req, "index" as *u8, "2.b" as *u8, "A close second, quietly preferred by regulars." as *u8), us_req_get(req, "index" as *u8, "2.p" as *u8, "£14.50" as *u8))
505 o = km_item(buf, o, hue, 2, us_req_get(req, "index" as *u8, "3.t" as *u8, "The newcomer" as *u8), us_req_get(req, "index" as *u8, "3.b" as *u8, "Fresh on the shelf and finding its audience." as *u8), us_req_get(req, "index" as *u8, "3.p" as *u8, "£16.00" as *u8))
506 o = km_item(buf, o, hue, 3, us_req_get(req, "index" as *u8, "4.t" as *u8, "The gift box" as *u8), us_req_get(req, "index" as *u8, "4.b" as *u8, "Three of the above, wrapped and ready to send." as *u8), us_req_get(req, "index" as *u8, "4.p" as *u8, "£42.00" as *u8))
507 o = km_shop_close(buf, o)
508 o = km_trust(buf, o, us_req_get(req, "index" as *u8, "t1" as *u8, "Free delivery over £30" as *u8), us_req_get(req, "index" as *u8, "t1b" as *u8, "Tracked, and it actually arrives when we say." as *u8), us_req_get(req, "index" as *u8, "t2" as *u8, "30-day returns" as *u8), us_req_get(req, "index" as *u8, "t2b" as *u8, "Opened or not. No restocking fee, no argument." as *u8), us_req_get(req, "index" as *u8, "t3" as *u8, "Secure checkout" as *u8), us_req_get(req, "index" as *u8, "t3b" as *u8, "No third-party trackers on any page of this shop." as *u8))
509 o = sk_close(buf, o, "Shop" as *u8, brand)
510 return o
511}
512// ---- the MARKET products page: a FULL catalog. The marketing products page composed a feature-card
513// grid + a pricing-TIER band, which on a shop rendered the GENERATOR'S OWN SaaS PLANS ("$19/mo
514// Unlimited generations") inside a client's storefront -- a content leak, not a styling slip.
515// A shop's product page sells the shop's products, at the shop's prices. ----
516func us_page_products_market(buf: *u8, off: i64, spec: *i64, title: *u8, brand: *u8, plan: *i64, n: i64, req: *u8) -> i64 {
517 let hue: i64 = spec[0]
518 var o: i64 = sk_head(buf, off, title, 1)
519 o = l3_palette_style(buf, o, hue, spec[1])
520 o = km_styles(buf, o, hue)
521 o = km_util2(buf, o, us_req_get(req, "index" as *u8, "ship" as *u8, "Free delivery over £30 · dispatched next working day" as *u8), us_cap(req, "search" as *u8), us_cap(req, "cart" as *u8), us_req_get(req, "index" as *u8, "cartlabel" as *u8, "Cart" as *u8))
522 o = sk_header_open(buf, o, brand, "index.html" as *u8)
523 o = us_nav(buf, o, plan, n)
524 o = sk_header_close(buf, o)
525 o = km_chips_open(buf, o)
526 o = km_chip(buf, o, us_req_get(req, "index" as *u8, "c1" as *u8, "All" as *u8))
527 o = km_chip(buf, o, us_req_get(req, "index" as *u8, "c2" as *u8, "New in" as *u8))
528 o = km_chip(buf, o, us_req_get(req, "index" as *u8, "c3" as *u8, "Best sellers" as *u8))
529 o = km_chip(buf, o, us_req_get(req, "index" as *u8, "c4" as *u8, "Gifts" as *u8))
530 o = km_chips_close(buf, o)
531 o = km_shop_open(buf, o, us_req_get(req, "products" as *u8, "h2" as *u8, "Everything we sell" as *u8), us_req_get(req, "products" as *u8, "sub" as *u8, "The full catalog. Prices include VAT; returns accepted for 30 days." as *u8))
532 // the four from the front page, plus two the front page has no room for
533 o = km_item(buf, o, hue, 0, us_req_get(req, "products" as *u8, "1.t" as *u8, us_req_get(req, "index" as *u8, "1.t" as *u8, "The flagship" as *u8)), us_req_get(req, "products" as *u8, "1.b" as *u8, us_req_get(req, "index" as *u8, "1.b" as *u8, "The one people come back for." as *u8)), us_req_get(req, "products" as *u8, "1.p" as *u8, us_req_get(req, "index" as *u8, "1.p" as *u8, "£18.00" as *u8)))
534 o = km_item(buf, o, hue, 1, us_req_get(req, "products" as *u8, "2.t" as *u8, us_req_get(req, "index" as *u8, "2.t" as *u8, "The favourite" as *u8)), us_req_get(req, "products" as *u8, "2.b" as *u8, us_req_get(req, "index" as *u8, "2.b" as *u8, "A close second, quietly preferred by regulars." as *u8)), us_req_get(req, "products" as *u8, "2.p" as *u8, us_req_get(req, "index" as *u8, "2.p" as *u8, "£14.50" as *u8)))
535 o = km_item(buf, o, hue, 2, us_req_get(req, "products" as *u8, "3.t" as *u8, us_req_get(req, "index" as *u8, "3.t" as *u8, "The newcomer" as *u8)), us_req_get(req, "products" as *u8, "3.b" as *u8, us_req_get(req, "index" as *u8, "3.b" as *u8, "Fresh on the shelf and finding its audience." as *u8)), us_req_get(req, "products" as *u8, "3.p" as *u8, us_req_get(req, "index" as *u8, "3.p" as *u8, "£16.00" as *u8)))
536 o = km_item(buf, o, hue, 3, us_req_get(req, "products" as *u8, "4.t" as *u8, us_req_get(req, "index" as *u8, "4.t" as *u8, "The gift box" as *u8)), us_req_get(req, "products" as *u8, "4.b" as *u8, us_req_get(req, "index" as *u8, "4.b" as *u8, "Three of the above, wrapped and ready to send." as *u8)), us_req_get(req, "products" as *u8, "4.p" as *u8, us_req_get(req, "index" as *u8, "4.p" as *u8, "£42.00" as *u8)))
537 o = km_item(buf, o, hue, 4, us_req_get(req, "products" as *u8, "5.t" as *u8, "The subscription" as *u8), us_req_get(req, "products" as *u8, "5.b" as *u8, "A bag a fortnight, cancel whenever, no lock-in." as *u8), us_req_get(req, "products" as *u8, "5.p" as *u8, "£15.00" as *u8))
538 o = km_item(buf, o, hue, 5, us_req_get(req, "products" as *u8, "6.t" as *u8, "The kit" as *u8), us_req_get(req, "products" as *u8, "6.b" as *u8, "Everything a beginner needs, chosen so nothing is wasted." as *u8), us_req_get(req, "products" as *u8, "6.p" as *u8, "£58.00" as *u8))
539 o = km_shop_close(buf, o)
540 o = km_trust(buf, o, us_req_get(req, "index" as *u8, "t1" as *u8, "Free delivery over £30" as *u8), us_req_get(req, "index" as *u8, "t1b" as *u8, "Tracked, and it actually arrives when we say." as *u8), us_req_get(req, "index" as *u8, "t2" as *u8, "30-day returns" as *u8), us_req_get(req, "index" as *u8, "t2b" as *u8, "Opened or not. No restocking fee, no argument." as *u8), us_req_get(req, "index" as *u8, "t3" as *u8, "Secure checkout" as *u8), us_req_get(req, "index" as *u8, "t3b" as *u8, "No third-party trackers on any page of this shop." as *u8))
541 o = sk_close(buf, o, "Catalog" as *u8, brand)
542 return o
543}
544// family router for the index page (refine + dispatcher both go through this)
545func us_page_index_routed(buf: *u8, off: i64, brief: *u8, spec: *i64, title: *u8, brand: *u8, plan: *i64, n: i64, req: *u8) -> i64 {
546 let f: i64 = us_family(brief)
547 if f == 1 { return us_page_index_counsel(buf, off, spec, title, brand, plan, n, req) }
548 if f == 2 { return us_page_index_journal(buf, off, spec, title, brand, plan, n, req) }
549 if f == 3 { return us_page_index_market(buf, off, spec, title, brand, plan, n, req) }
550 return us_page_index(buf, off, spec, title, brand, plan, n, req)
551}
552
553// ---- front door: emit page #kind of the site for this brief. The req-less entry passes req=0, so its
554// output is BYTE-IDENTICAL to the pre-R-content organ by construction (rule 19). ----
555// emit a page against a CALLER-SUPPLIED spec -- the refine path needs this, because deriving a fresh
556// spec from the brief would discard the refinement and leave subpages contradicting the refined index.
557func us_emit_page_req_spec(buf: *u8, off: i64, brief: *u8, spec: *i64, title: *u8, brand: *u8, plan: *i64, n: i64, kind: i64, req: *u8) -> i64 {
558 let fam: i64 = us_family(brief)
559 if kind == 0 { return us_page_index_routed(buf, off, brief, spec, title, brand, plan, n, req) }
560 if kind == 1 {
561 if fam == 3 { return us_page_products_market(buf, off, spec, title, brand, plan, n, req) }
562 return us_page_products(buf, off, spec, title, brand, plan, n, req)
563 }
564 if kind == 2 { return us_page_status(buf, off, spec, title, brand, plan, n, req, fam) }
565 if kind == 3 { return us_page_docs(buf, off, spec, title, brand, plan, n, req, fam) }
566 if kind == 4 { return us_page_about(buf, off, spec, title, brand, plan, n, req, fam) }
567 return us_page_contact(buf, off, spec, title, brand, plan, n, req, fam)
568}
569func us_emit_page_req(buf: *u8, off: i64, brief: *u8, title: *u8, brand: *u8, plan: *i64, n: i64, kind: i64, req: *u8) -> i64 {
570 let spec: *i64 = sys_mmap(128) as *i64
571 us_spec(brief, spec)
572 let fam: i64 = us_family(brief)
573 if kind == 0 { return us_page_index_routed(buf, off, brief, spec, title, brand, plan, n, req) }
574 if kind == 1 {
575 if fam == 3 { return us_page_products_market(buf, off, spec, title, brand, plan, n, req) }
576 return us_page_products(buf, off, spec, title, brand, plan, n, req)
577 }
578 if kind == 2 { return us_page_status(buf, off, spec, title, brand, plan, n, req, fam) }
579 if kind == 3 { return us_page_docs(buf, off, spec, title, brand, plan, n, req, fam) }
580 if kind == 4 { return us_page_about(buf, off, spec, title, brand, plan, n, req, fam) }
581 return us_page_contact(buf, off, spec, title, brand, plan, n, req, fam)
582}
583func us_emit_page(buf: *u8, off: i64, brief: *u8, title: *u8, brand: *u8, plan: *i64, n: i64, kind: i64) -> i64 {
584 return us_emit_page_req(buf, off, brief, title, brand, plan, n, kind, 0 as *u8)
585}
586
587// ---- site metadata from the SAME plan (model and metadata cannot drift) ----
588func us_sitemap(buf: *u8, off: i64, domain: *u8, plan: *i64, n: i64) -> i64 {
589 var o: i64 = he_puts(buf, off, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n" as *u8)
590 var i: i64 = 0
591 while i < n {
592 o = he_puts(buf, o, "<url><loc>https://" as *u8)
593 o = he_puts(buf, o, domain)
594 o = he_puts(buf, o, "/" as *u8)
595 o = he_puts(buf, o, us_slug(plan[i]))
596 o = he_puts(buf, o, "</loc></url>\n" as *u8)
597 i = i + 1
598 }
599 o = he_puts(buf, o, "</urlset>\n" as *u8)
600 return o
601}
602func us_robots(buf: *u8, off: i64, domain: *u8) -> i64 {
603 var o: i64 = he_puts(buf, off, "User-agent: *\nAllow: /\nSitemap: https://" as *u8)
604 o = he_puts(buf, o, domain)
605 o = he_puts(buf, o, "/sitemap.xml\n" as *u8)
606 return o
607}