nx_robots_txt.nx
buildroot/runtime/nx_robots_txt.nx
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
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
structs
| none |
consts
| 42 | const RT_MAGIC_1024: i64 = 1024 |
| 44 | const RT_ERR_SHORT: i64 = -1 |
functions
| 46 | func rt_put(out: *u8, cap: i64, off: i64, src: *u8, n: i64) -> i64 |
| 57 | func robots_comment(out: *u8, cap: i64, off: i64, |
| 69 | func robots_agent(out: *u8, cap: i64, off: i64, |
| 81 | func robots_disallow(out: *u8, cap: i64, off: i64, |
| 94 | func robots_allow(out: *u8, cap: i64, off: i64, |
| 106 | func robots_sitemap(out: *u8, cap: i64, off: i64, |
| 119 | func robots_crawl_delay(out: *u8, cap: i64, off: i64, |
| 150 | func robots_blank(out: *u8, cap: i64, off: i64) -> i64 |
| 155 | func main() -> i64 |