code wiki / (root) / sitemap.nx

sitemap.nx

buildroot/runtime/sitemap.nx

6892 B193 linesdepth 4pulls 6 transitivereach 0 importersview sourcekind orphan librarytopic sitemap
docsdependenciesstructsconstsfunctions

about

sitemap.nx -- XML Sitemap 0.9 builder. Specification: sitemaps.org (Google/Yahoo/MSN 2005 joint draft). Every search crawler uses it to discover pages it might not reach via link-following. Referenced from robots.txt and served at /sitemap.xml or /sitemap-index.xml. Skeleton: <?xml version=\"1.0\" encoding=\"utf-8\"?> <urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"> <url> <loc>https://example.com/foo</loc> <lastmod>2026-04-22</lastmod> <changefreq>weekly</changefreq> <priority>0.8</priority> </url> ... </urlset> Soft caps (per spec): 50,000 URLs per sitemap, 50 MiB uncompressed. For larger sites use a sitemap index (not implemented here yet; a future sitemap_index.nx will compose this). Invariants: S1 loc is required; lastmod/changefreq/priority optional. S2 lastmod is date-only format YYYY-MM-DD (from unix_sec via civil_date.nx). Sitemaps accept ISO 8601 but date-only is canonical and smaller. S3 changefreq values: always, hourly, daily, weekly, monthly, yearly, never. We surface them as constants; caller picks. S4 Stream builder: sitemap_begin -> sitemap_url* -> sitemap_end.

dependencies 3 imports · 0 importers

syscalls.nx html_escape.nx civil_date.nx sitemap.nx

imports: syscalls.nxhtml_escape.nxcivil_date.nx

imported by: nobody (leaf or entry point)

structs

none

consts

37const SM_ERR_SHORT: i64 = -1
39const SM_FREQ_ALWAYS: i64 = 1
40const SM_FREQ_HOURLY: i64 = 2
41const SM_FREQ_DAILY: i64 = 3
42const SM_FREQ_WEEKLY: i64 = 4
43const SM_FREQ_MONTHLY: i64 = 5
44const SM_FREQ_YEARLY: i64 = 6
45const SM_FREQ_NEVER: i64 = 7
46const SM_FREQ_NONE: i64 = 0

functions

48func sm_put(out: *u8, cap: i64, off: i64, src: *u8, n: i64) -> i64 {
58func sm_put_escaped(out: *u8, cap: i64, off: i64,
calls 1: html_escape
66func sm_put_date(out: *u8, cap: i64, off: i64, unix_sec: i64) -> i64 {
calls 1: civil_from_unix
86func sm_put_freq(out: *u8, cap: i64, off: i64, freq: i64) -> i64 {
calls 1: sm_put
104func sitemap_begin(out: *u8, cap: i64, off: i64) -> i64 {
calls 1: sm_put
118func sitemap_url(out: *u8, cap: i64, off: i64,
166func sitemap_end(out: *u8, cap: i64, off: i64) -> i64 {
171func main() -> i64 {