code wiki / (root) / robots_txt.nx

robots_txt.nx

buildroot/runtime/robots_txt.nx

5574 B174 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind orphan librarytopic 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

syscalls.nx robots_txt.nx

imports: syscalls.nx

imported by: nobody (leaf or entry point)

structs

none

consts

37const RT_ERR_SHORT: i64 = -1

functions

39func rt_put(out: *u8, cap: i64, off: i64, src: *u8, n: i64) -> i64 {
50func robots_comment(out: *u8, cap: i64, off: i64,
62func robots_agent(out: *u8, cap: i64, off: i64,
74func robots_disallow(out: *u8, cap: i64, off: i64,
87func robots_allow(out: *u8, cap: i64, off: i64,
99func robots_sitemap(out: *u8, cap: i64, off: i64,
112func robots_crawl_delay(out: *u8, cap: i64, off: i64,
143func robots_blank(out: *u8, cap: i64, off: i64) -> i64 {
148func main() -> i64 {