code wiki / _hdl_build / nx_uigen_site.nx
nx_uigen_site.nx source
↩ module page · 595 lines · 44342 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}
154func us_req_get(req: *u8, page: *u8, key: *u8, dflt: *u8) -> *u8 {
155 if (req as i64) == 0 { return dflt }
156 var i: i64 = 0
157 var atstart: i64 = 1
158 while req[i] != (0 as u8) {
159 if atstart == 1 {
160 let j: i64 = us_match_at(req, i, page)
161 if j >= 0 {
162 if req[j] == (124 as u8) {
163 let k: i64 = us_match_at(req, j + 1, key)
164 if k >= 0 {
165 if req[k] == (124 as u8) {
166 let out: *u8 = sys_mmap(K_MAGIC_1024)
167 var v: i64 = k + 1
168 var o: i64 = 0
169 var stop: i64 = 0
170 while stop == 0 {
171 if req[v] == (0 as u8) { stop = 1 } else {
172 if req[v] == (10 as u8) { stop = 1 } else {
173 if req[v] == (13 as u8) { stop = 1 } else {
174 if o < 1000 { out[o] = req[v]; o = o + 1 }
175 v = v + 1
176 }
177 }
178 }
179 }
180 out[o] = 0 as u8
181 return out
182 }
183 }
184 }
185 }
186 }
187 if req[i] == (10 as u8) { atstart = 1 } else { atstart = 0 }
188 i = i + 1
189 }
190 return dflt
191}
192
193// R0a presence probe: does the req provide <page>|<key>|<value>? A channel or form target renders ONLY
194// when the client's req actually names it -- a fabricated default contact channel would be a fake.
195func us_req_has(req: *u8, page: *u8, key: *u8) -> i64 {
196 if (req as i64) == 0 { return 0 }
197 var i: i64 = 0
198 var atstart: i64 = 1
199 while req[i] != (0 as u8) {
200 if atstart == 1 {
201 let j: i64 = us_match_at(req, i, page)
202 if j >= 0 {
203 if req[j] == (124 as u8) {
204 let k: i64 = us_match_at(req, j + 1, key)
205 if k >= 0 {
206 if req[k] == (124 as u8) { return 1 }
207 }
208 }
209 }
210 }
211 if req[i] == (10 as u8) { atstart = 1 } else { atstart = 0 }
212 i = i + 1
213 }
214 return 0
215}
216
217// ---- shells: hero tier (index/products) and doc tier (status/docs/about/contact), both carrying the
218// shared nav + the SITE spec's palette/mods so design coheres across every page ----
219func us_shell_hero(buf: *u8, off: i64, spec: *i64, title: *u8, brand: *u8, plan: *i64, n: i64) -> i64 {
220 var o: i64 = sk_open_site(buf, off, title, brand, 1, "index.html" as *u8)
221 o = us_nav(buf, o, plan, n)
222 o = sk_header_close(buf, o)
223 o = l3_palette_style(buf, o, spec[0], spec[1])
224 o = l3_style_mods(buf, o, spec[2], spec[3])
225 o = sk_mkt_styles(buf, o)
226 return o
227}
228// fam=1 carries the Counsel family through the doc tier, so a site never ships two design languages
229// (the 07-25 render caught a serif ivory home page next to a cool-grey SaaS contact page).
230func us_shell_doc(buf: *u8, off: i64, spec: *i64, title: *u8, brand: *u8, plan: *i64, n: i64, fam: i64) -> i64 {
231 var o: i64 = sk_doc_open(buf, off, title, brand, "index.html" as *u8)
232 o = us_nav(buf, o, plan, n)
233 o = sk_header_close(buf, o)
234 o = l3_palette_style(buf, o, spec[0], spec[1])
235 if fam == 1 {
236 o = kc_styles(buf, o, spec[0])
237 o = kc_doc_styles(buf, o)
238 } else {
239 if fam == 2 {
240 o = kj_styles(buf, o, spec[0])
241 o = kj_doc_styles(buf, o)
242 } else {
243 if fam == 3 {
244 o = km_styles(buf, o, spec[0])
245 o = km_doc_styles(buf, o)
246 } else {
247 o = l3_style_mods(buf, o, spec[2], spec[3])
248 }
249 }
250 }
251 o = sk_doc_main(buf, o)
252 return o
253}
254
255// ---- per-kind pages ----
256func us_page_index(buf: *u8, off: i64, spec: *i64, title: *u8, brand: *u8, plan: *i64, n: i64, req: *u8) -> i64 {
257 var o: i64 = us_shell_hero(buf, off, spec, title, brand, plan, n)
258 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))
259 let flip: i64 = spec[0] % 2
260 var i: i64 = 0
261 while i < spec[4] {
262 o = l3_emit_section(buf, o, spec[5 + i], flip)
263 i = i + 1
264 }
265 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)
266 o = sk_close(buf, o, "Home" as *u8, brand)
267 return o
268}
269func us_page_products(buf: *u8, off: i64, spec: *i64, title: *u8, brand: *u8, plan: *i64, n: i64, req: *u8) -> i64 {
270 var o: i64 = us_shell_hero(buf, off, spec, title, brand, plan, n)
271 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))
272 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))
273 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))
274 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))
275 o = sk_section_close(buf, o)
276 o = l3_sec_pricing(buf, o)
277 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)
278 o = sk_close(buf, o, "Products" as *u8, brand)
279 return o
280}
281// R0a/R0c (debt 1785934277): metrics are CLAIMS -- they render ONLY from req-provided values
282// (status|score, status|sN.v, status|rN.s...), never from built-in numbers. A req with no
283// measurements gets an honest coming-soon, not a fabricated scorecard.
284func us_page_status(buf: *u8, off: i64, spec: *i64, title: *u8, brand: *u8, plan: *i64, n: i64, req: *u8, fam: i64) -> i64 {
285 var o: i64 = us_shell_doc(buf, off, spec, title, brand, plan, n, fam)
286 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))
287 let hsc: i64 = us_req_has(req, "status" as *u8, "score" as *u8)
288 let hrw: i64 = us_req_has(req, "status" as *u8, "r1.s" as *u8)
289 if hsc == 1 {
290 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))
291 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)) }
292 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)) }
293 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)) }
294 o = sk_score_close(buf, o)
295 }
296 if hrw == 1 {
297 o = sk_h2(buf, o, us_req_get(req, "status" as *u8, "h2" as *u8, "Services" as *u8))
298 o = sk_dtable_open(buf, o, "Service" as *u8, "Status" as *u8, "Note" as *u8)
299 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))
300 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)) }
301 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)) }
302 o = sk_dtable_close(buf, o)
303 }
304 if hsc == 0 { if hrw == 0 {
305 o = sk_callout(buf, o, "<strong>Coming soon:</strong> live measurements will appear here once monitoring is connected." as *u8)
306 } }
307 o = sk_doc_close(buf, o, us_req_get(req, "status" as *u8, "foot" as *u8, brand), brand)
308 return o
309}
310func us_page_docs(buf: *u8, off: i64, spec: *i64, title: *u8, brand: *u8, plan: *i64, n: i64, req: *u8, fam: i64) -> i64 {
311 var o: i64 = us_shell_doc(buf, off, spec, title, brand, plan, n, fam)
312 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))
313 o = sk_h2(buf, o, us_req_get(req, "docs" as *u8, "h2a" as *u8, "Getting started" as *u8))
314 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))
315 o = sk_h2(buf, o, us_req_get(req, "docs" as *u8, "h2b" as *u8, "Concepts" as *u8))
316 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))
317 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))
318 o = sk_doc_close(buf, o, us_req_get(req, "docs" as *u8, "foot" as *u8, brand), brand)
319 return o
320}
321func us_page_about(buf: *u8, off: i64, spec: *i64, title: *u8, brand: *u8, plan: *i64, n: i64, req: *u8, fam: i64) -> i64 {
322 var o: i64 = us_shell_doc(buf, off, spec, title, brand, plan, n, fam)
323 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))
324 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))
325 o = sk_h2(buf, o, us_req_get(req, "about" as *u8, "h2" as *u8, "What you can rely on" as *u8))
326 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))
327 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))
328 o = sk_doc_close(buf, o, us_req_get(req, "about" as *u8, "foot" as *u8, brand), brand)
329 return o
330}
331// R0a: a form with no handler is a FAKE (debt 1785883411). The form renders ONLY when the req names a
332// real POST target (contact|action); channels the req provides (contact|phone, contact|email) render as
333// one-tap tel:/mailto links; a page with none of the three says so honestly instead of faking a form.
334func us_page_contact(buf: *u8, off: i64, spec: *i64, title: *u8, brand: *u8, plan: *i64, n: i64, req: *u8, fam: i64) -> i64 {
335 var o: i64 = us_shell_doc(buf, off, spec, title, brand, plan, n, fam)
336 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))
337 o = he_puts(buf, o, "<style>.nx-channel{margin:14px 0}.nx-channel a.btnp{display:inline-block;text-decoration:none}</style>" as *u8)
338 let hasph: i64 = us_req_has(req, "contact" as *u8, "phone" as *u8)
339 let hasem: i64 = us_req_has(req, "contact" as *u8, "email" as *u8)
340 let hasact: i64 = us_req_has(req, "contact" as *u8, "action" as *u8)
341 if hasph == 1 {
342 o = he_puts(buf, o, "<p class=\"nx-channel\"><a class=\"btnp\" href=\"tel:" as *u8)
343 o = he_puts(buf, o, us_req_get(req, "contact" as *u8, "phone" as *u8, " " as *u8))
344 o = he_puts(buf, o, "\">Call " as *u8)
345 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)))
346 o = he_puts(buf, o, "</a></p>" as *u8)
347 }
348 if hasem == 1 {
349 o = he_puts(buf, o, "<p class=\"nx-channel\"><a href=\"mailto:" as *u8)
350 o = he_puts(buf, o, us_req_get(req, "contact" as *u8, "email" as *u8, " " as *u8))
351 o = he_puts(buf, o, "\">" as *u8)
352 o = he_puts(buf, o, us_req_get(req, "contact" as *u8, "email" as *u8, " " as *u8))
353 o = he_puts(buf, o, "</a></p>" as *u8)
354 }
355 if hasact == 1 {
356 // zero-JS confirmation: the handler 303s to ...#sent and :target reveals the block (R0e --
357 // the confirmation validates the choice; nothing renders unless the fragment is present)
358 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)
359 o = sk_form_open(buf, o, us_req_get(req, "contact" as *u8, "action" as *u8, " " as *u8))
360 // honeypot: invisible to people (display:none + tabindex -1), irresistible to form bots;
361 // the handler records nothing when it is filled and answers success anyway
362 o = he_puts(buf, o, "<input type=\"text\" name=\"website\" value=\"\" style=\"display:none\" tabindex=\"-1\" autocomplete=\"off\" aria-hidden=\"true\">" as *u8)
363 if us_req_has(req, "contact" as *u8, "back" as *u8) == 1 {
364 o = he_puts(buf, o, "<input type=\"hidden\" name=\"back\" value=\"" as *u8)
365 o = he_puts(buf, o, us_req_get(req, "contact" as *u8, "back" as *u8, " " as *u8))
366 o = he_puts(buf, o, "\">" as *u8)
367 }
368 o = sk_field(buf, o, "name" as *u8, "Full name" as *u8, "text" as *u8, "Jane Doe" as *u8)
369 o = sk_field(buf, o, "email" as *u8, "Email" as *u8, "email" as *u8, "jane@example.com" as *u8)
370 o = sk_field_area(buf, o, "message" as *u8, "Message" as *u8, "How can we help?" as *u8)
371 o = sk_form_submit(buf, o, "Send" as *u8)
372 o = sk_form_close(buf, o)
373 }
374 if hasact == 0 { if hasph == 0 { if hasem == 0 {
375 o = sk_callout(buf, o, "<strong>Coming soon:</strong> contact channels for this site are being set up." as *u8)
376 } } }
377 o = sk_doc_close(buf, o, us_req_get(req, "contact" as *u8, "foot" as *u8, brand), brand)
378 return o
379}
380
381// h2h v2 measured gap (debt 1785953261): 6/8 field law homepages carry the phone, ours carried ZERO.
382// The same kc-final band plus the one-tap tel line -- rendered ONLY when the req names a real phone
383// (presence-gated: no phone in the req, no fabricated number on the page).
384func us_kc_final_tel(buf: *u8, off: i64, h2: *u8, p: *u8, cta: *u8, href: *u8, teluri: *u8, tellabel: *u8) -> i64 {
385 var o: i64 = he_puts(buf, off, "<section class=\"kc-final\"><div class=\"wrap\"><div><h2>" as *u8)
386 o = he_puts(buf, o, h2)
387 o = he_puts(buf, o, "</h2><p>" as *u8)
388 o = he_puts(buf, o, p)
389 o = he_puts(buf, o, "</p><p style=\"margin-top:14px\"><a href=\"tel:" as *u8)
390 o = he_puts(buf, o, teluri)
391 o = he_puts(buf, o, "\" style=\"color:#fff;font-weight:640;text-decoration:none;border-bottom:2px solid var(--kc-gold)\">Call " as *u8)
392 o = he_puts(buf, o, tellabel)
393 o = he_puts(buf, o, "</a></p></div><a class=\"kc-btn\" href=\"" as *u8)
394 o = he_puts(buf, o, href)
395 o = he_puts(buf, o, "\">" as *u8)
396 o = he_puts(buf, o, cta)
397 o = he_puts(buf, o, "</a></div></section>" as *u8)
398 return o
399}
400
401// ---- the COUNSEL index (professional-services family): serif editorial grammar per the extracted
402// 30-site law-firm reference bar. Fixed dignified sequence: split hero w/ generative scene ->
403// stats-first trust -> ruled practice list -> testimonial + accreditations -> deep final CTA.
404// Deliberately NO l3 marketing bands, no pills, no card grid, no pricing. ----
405func us_page_index_counsel(buf: *u8, off: i64, spec: *i64, title: *u8, brand: *u8, plan: *i64, n: i64, req: *u8) -> i64 {
406 var o: i64 = sk_open_site(buf, off, title, brand, 1, "index.html" as *u8)
407 o = us_nav(buf, o, plan, n)
408 o = sk_header_close(buf, o)
409 o = l3_palette_style(buf, o, spec[0], spec[1])
410 o = kc_styles(buf, o, spec[0])
411 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), "Book a consultation" as *u8, "contact.html" as *u8, "Our practice" as *u8, "about.html" as *u8, spec[10])
412 // R0a (pre-live checklist item 2): numbers are CLAIMS -- the band renders ONLY from req values,
413 // never from templated defaults. A req-less Counsel index is a tighter page, not a fabricated one.
414 if us_req_has(req, "index" as *u8, "s1.n" as *u8) == 1 {
415 o = kc_sec_open(buf, o, "By the" as *u8, "numbers" as *u8)
416 o = kc_stats_open(buf, o)
417 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))
418 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)) }
419 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)) }
420 o = kc_stats_close(buf, o)
421 o = kc_sec_close(buf, o)
422 }
423 o = kc_sec_open(buf, o, "Areas of" as *u8, "practice" as *u8)
424 o = kc_list_open(buf, o)
425 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))
426 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))
427 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))
428 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))
429 o = kc_list_close(buf, o)
430 o = kc_sec_close(buf, o)
431 // testimonials and accreditations are CLAIMS too: quote gates on index|q, accred on index|a1
432 let hasq: i64 = us_req_has(req, "index" as *u8, "q" as *u8)
433 let hasacc: i64 = us_req_has(req, "index" as *u8, "a1" as *u8)
434 if hasq == 1 {
435 o = kc_sec_open(buf, o, "What clients" as *u8, "say" as *u8)
436 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))
437 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)) }
438 o = kc_sec_close(buf, o)
439 }
440 if hasq == 0 { if hasacc == 1 {
441 o = kc_sec_open(buf, o, "Our" as *u8, "standing" as *u8)
442 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))
443 o = kc_sec_close(buf, o)
444 } }
445 if us_req_has(req, "contact" as *u8, "phone" as *u8) == 1 {
446 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), "Book a consultation" 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)))
447 } else {
448 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), "Book a consultation" as *u8, "contact.html" as *u8)
449 }
450 o = sk_close(buf, o, "Home" as *u8, brand)
451 return o
452}
453// ---- the JOURNAL index (editorial family): masthead + lead article + ruled article list + subscribe.
454// No hero band, no card grid, no CTA pill -- a publication front page, not a marketing page. ----
455func us_page_index_journal(buf: *u8, off: i64, spec: *i64, title: *u8, brand: *u8, plan: *i64, n: i64, req: *u8) -> i64 {
456 var o: i64 = sk_open_site(buf, off, title, brand, 1, "index.html" as *u8)
457 o = us_nav(buf, o, plan, n)
458 o = sk_header_close(buf, o)
459 o = l3_palette_style(buf, o, spec[0], spec[1])
460 o = kj_styles(buf, o, spec[0])
461 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))
462 o = kj_more_open(buf, o, us_req_get(req, "index" as *u8, "more" as *u8, "Also in this edition" as *u8))
463 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))
464 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))
465 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))
466 o = kj_more_close(buf, o)
467 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), "Write to us" as *u8, "contact.html" as *u8)
468 o = sk_close(buf, o, "Front page" as *u8, brand)
469 return o
470}
471// ---- the MARKET index (commerce family): utility bar + shop masthead + category chips + promo strip +
472// PRODUCT GRID (generated visuals, real prices, add-to-cart) + shipping/returns/secure row.
473// Deliberately NO gradient hero, NO feature-card grid, NO pricing-TIER band. ----
474func us_page_index_market(buf: *u8, off: i64, spec: *i64, title: *u8, brand: *u8, plan: *i64, n: i64, req: *u8) -> i64 {
475 let hue: i64 = spec[0]
476 var o: i64 = sk_head(buf, off, title, 1)
477 o = l3_palette_style(buf, o, hue, spec[1])
478 o = km_styles(buf, o, hue)
479 o = km_util(buf, o, us_req_get(req, "index" as *u8, "ship" as *u8, "Free delivery over £30 · dispatched next working day" as *u8))
480 o = sk_header_open(buf, o, brand, "index.html" as *u8)
481 o = us_nav(buf, o, plan, n)
482 o = sk_header_close(buf, o)
483 o = km_chips_open(buf, o)
484 o = km_chip(buf, o, us_req_get(req, "index" as *u8, "c1" as *u8, "All" as *u8))
485 o = km_chip(buf, o, us_req_get(req, "index" as *u8, "c2" as *u8, "New in" as *u8))
486 o = km_chip(buf, o, us_req_get(req, "index" as *u8, "c3" as *u8, "Best sellers" as *u8))
487 o = km_chip(buf, o, us_req_get(req, "index" as *u8, "c4" as *u8, "Gifts" as *u8))
488 o = km_chips_close(buf, o)
489 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))
490 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))
491 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))
492 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))
493 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))
494 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))
495 o = km_shop_close(buf, o)
496 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))
497 o = sk_close(buf, o, "Shop" as *u8, brand)
498 return o
499}
500// ---- the MARKET products page: a FULL catalog. The marketing products page composed a feature-card
501// grid + a pricing-TIER band, which on a shop rendered the GENERATOR'S OWN SaaS PLANS ("$19/mo
502// Unlimited generations") inside a client's storefront -- a content leak, not a styling slip.
503// A shop's product page sells the shop's products, at the shop's prices. ----
504func us_page_products_market(buf: *u8, off: i64, spec: *i64, title: *u8, brand: *u8, plan: *i64, n: i64, req: *u8) -> i64 {
505 let hue: i64 = spec[0]
506 var o: i64 = sk_head(buf, off, title, 1)
507 o = l3_palette_style(buf, o, hue, spec[1])
508 o = km_styles(buf, o, hue)
509 o = km_util(buf, o, us_req_get(req, "index" as *u8, "ship" as *u8, "Free delivery over £30 · dispatched next working day" as *u8))
510 o = sk_header_open(buf, o, brand, "index.html" as *u8)
511 o = us_nav(buf, o, plan, n)
512 o = sk_header_close(buf, o)
513 o = km_chips_open(buf, o)
514 o = km_chip(buf, o, us_req_get(req, "index" as *u8, "c1" as *u8, "All" as *u8))
515 o = km_chip(buf, o, us_req_get(req, "index" as *u8, "c2" as *u8, "New in" as *u8))
516 o = km_chip(buf, o, us_req_get(req, "index" as *u8, "c3" as *u8, "Best sellers" as *u8))
517 o = km_chip(buf, o, us_req_get(req, "index" as *u8, "c4" as *u8, "Gifts" as *u8))
518 o = km_chips_close(buf, o)
519 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))
520 // the four from the front page, plus two the front page has no room for
521 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)))
522 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)))
523 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)))
524 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)))
525 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))
526 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))
527 o = km_shop_close(buf, o)
528 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))
529 o = sk_close(buf, o, "Catalog" as *u8, brand)
530 return o
531}
532// family router for the index page (refine + dispatcher both go through this)
533func us_page_index_routed(buf: *u8, off: i64, brief: *u8, spec: *i64, title: *u8, brand: *u8, plan: *i64, n: i64, req: *u8) -> i64 {
534 let f: i64 = us_family(brief)
535 if f == 1 { return us_page_index_counsel(buf, off, spec, title, brand, plan, n, req) }
536 if f == 2 { return us_page_index_journal(buf, off, spec, title, brand, plan, n, req) }
537 if f == 3 { return us_page_index_market(buf, off, spec, title, brand, plan, n, req) }
538 return us_page_index(buf, off, spec, title, brand, plan, n, req)
539}
540
541// ---- front door: emit page #kind of the site for this brief. The req-less entry passes req=0, so its
542// output is BYTE-IDENTICAL to the pre-R-content organ by construction (rule 19). ----
543// emit a page against a CALLER-SUPPLIED spec -- the refine path needs this, because deriving a fresh
544// spec from the brief would discard the refinement and leave subpages contradicting the refined index.
545func 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 {
546 let fam: i64 = us_family(brief)
547 if kind == 0 { return us_page_index_routed(buf, off, brief, spec, title, brand, plan, n, req) }
548 if kind == 1 {
549 if fam == 3 { return us_page_products_market(buf, off, spec, title, brand, plan, n, req) }
550 return us_page_products(buf, off, spec, title, brand, plan, n, req)
551 }
552 if kind == 2 { return us_page_status(buf, off, spec, title, brand, plan, n, req, fam) }
553 if kind == 3 { return us_page_docs(buf, off, spec, title, brand, plan, n, req, fam) }
554 if kind == 4 { return us_page_about(buf, off, spec, title, brand, plan, n, req, fam) }
555 return us_page_contact(buf, off, spec, title, brand, plan, n, req, fam)
556}
557func us_emit_page_req(buf: *u8, off: i64, brief: *u8, title: *u8, brand: *u8, plan: *i64, n: i64, kind: i64, req: *u8) -> i64 {
558 let spec: *i64 = sys_mmap(128) as *i64
559 us_spec(brief, spec)
560 let fam: i64 = us_family(brief)
561 if kind == 0 { return us_page_index_routed(buf, off, brief, spec, title, brand, plan, n, req) }
562 if kind == 1 {
563 if fam == 3 { return us_page_products_market(buf, off, spec, title, brand, plan, n, req) }
564 return us_page_products(buf, off, spec, title, brand, plan, n, req)
565 }
566 if kind == 2 { return us_page_status(buf, off, spec, title, brand, plan, n, req, fam) }
567 if kind == 3 { return us_page_docs(buf, off, spec, title, brand, plan, n, req, fam) }
568 if kind == 4 { return us_page_about(buf, off, spec, title, brand, plan, n, req, fam) }
569 return us_page_contact(buf, off, spec, title, brand, plan, n, req, fam)
570}
571func us_emit_page(buf: *u8, off: i64, brief: *u8, title: *u8, brand: *u8, plan: *i64, n: i64, kind: i64) -> i64 {
572 return us_emit_page_req(buf, off, brief, title, brand, plan, n, kind, 0 as *u8)
573}
574
575// ---- site metadata from the SAME plan (model and metadata cannot drift) ----
576func us_sitemap(buf: *u8, off: i64, domain: *u8, plan: *i64, n: i64) -> i64 {
577 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)
578 var i: i64 = 0
579 while i < n {
580 o = he_puts(buf, o, "<url><loc>https://" as *u8)
581 o = he_puts(buf, o, domain)
582 o = he_puts(buf, o, "/" as *u8)
583 o = he_puts(buf, o, us_slug(plan[i]))
584 o = he_puts(buf, o, "</loc></url>\n" as *u8)
585 i = i + 1
586 }
587 o = he_puts(buf, o, "</urlset>\n" as *u8)
588 return o
589}
590func us_robots(buf: *u8, off: i64, domain: *u8) -> i64 {
591 var o: i64 = he_puts(buf, off, "User-agent: *\nAllow: /\nSitemap: https://" as *u8)
592 o = he_puts(buf, o, domain)
593 o = he_puts(buf, o, "/sitemap.xml\n" as *u8)
594 return o
595}