robots_txt.nx
buildroot/runtime/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: 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
| 37 | const RT_ERR_SHORT: i64 = -1 |
functions
| 39 | func rt_put(out: *u8, cap: i64, off: i64, src: *u8, n: i64) -> i64 { |
| 50 | func robots_comment(out: *u8, cap: i64, off: i64, |
| 62 | func robots_agent(out: *u8, cap: i64, off: i64, |
| 74 | func robots_disallow(out: *u8, cap: i64, off: i64, |
| 87 | func robots_allow(out: *u8, cap: i64, off: i64, |
| 99 | func robots_sitemap(out: *u8, cap: i64, off: i64, |
| 112 | func robots_crawl_delay(out: *u8, cap: i64, off: i64, |
| 143 | func robots_blank(out: *u8, cap: i64, off: i64) -> i64 { |
| 148 | func main() -> i64 { |