code wiki / (root) / nx_robots_txt.nx

nx_robots_txt.nx

buildroot/runtime/nx_robots_txt.nx

5758 B181 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tooltopic robots
docsdependenciesstructsconstsfunctions

about

robots_txt.nx -- build robots.txt files. Robots Exclusion Protocol (RFC 9309 -- finally standardised 2022 after 30 years of informal use). Served at /robots.txt at the site root; crawlers fetch it before any other URL on the site. Format: # comments User-agent: * Disallow: /private Disallow: /admin Allow: /private/public-page User-agent: Googlebot Disallow: /experimental Sitemap: https://example.com/sitemap.xml Groups: lines grouped under User-agent headers apply only to that agent. "*" matches everything without a dedicated group. Sitemap lines are global and can appear anywhere. Use cases: nishi-pages emits this at /robots.txt pointing at sitemap.xml and blocking /admin. Every site that wants to appear (or NOT appear) in search results needs it. Invariants: RT1 Output is plain ASCII; no escaping (robots.txt doesn't have a concept of encoding). RT2 Path values are literals -- caller is responsible for URL-encoding special characters if needed (rare). RT3 Stream builder: robots_agent -> robots_disallow* / robots_allow*, then robots_sitemap for global links.

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_robots_txt.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap robots_comment rt_put robots_agent rt_put ↻ robots_disallow rt_put ↻ robots_allow rt_put ↻ robots_crawl_delay rt_put ↻ sys_mmap ↻ robots_blank rt_put ↻ robots_sitemap rt_put ↻

structs

none

consts

42const RT_MAGIC_1024: i64 = 1024
44const RT_ERR_SHORT: i64 = -1

functions

46func rt_put(out: *u8, cap: i64, off: i64, src: *u8, n: i64) -> i64
57func robots_comment(out: *u8, cap: i64, off: i64,
called by 1: main calls 1: rt_put
69func robots_agent(out: *u8, cap: i64, off: i64,
called by 1: main calls 1: rt_put
81func robots_disallow(out: *u8, cap: i64, off: i64,
called by 1: main calls 1: rt_put
94func robots_allow(out: *u8, cap: i64, off: i64,
called by 1: main calls 1: rt_put
106func robots_sitemap(out: *u8, cap: i64, off: i64,
called by 1: main calls 1: rt_put
119func robots_crawl_delay(out: *u8, cap: i64, off: i64,
called by 1: main calls 2: rt_putsys_mmap
150func robots_blank(out: *u8, cap: i64, off: i64) -> i64
called by 1: main calls 1: rt_put
155func main() -> i64