feat(web): Go W-G7 RSS, sitemap, redirect, and SEO bags

Add paginate/meta wiring, RSS and sitemap builders, and app
redirect/error/sitemap/robots route bags so content and W7 offline
smokes pass on libweb.so.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-09-10 17:51:50 +08:00
1 parent fe18c4d1d6
commit 23e4bc406e
11 files changed
+758 -1

No files matched your search

+17
View File
@@ -22,6 +22,23 @@ func New(args map[string]any) map[string]any {
return out
}
// Paginate stamps page.paginate with offset/limit/path (Rust web_page_paginate).
func Paginate(page map[string]any, offset, limit int64, path string) map[string]any {
out := map[string]any{}
for k, v := range page {
out[k] = v
}
if path == "" {
path = "/"
}
out["paginate"] = map[string]any{
"offset": offset,
"limit": limit,
"path": path,
}
return out
}
func strOpt(args map[string]any, key, def string) string {
if s, ok := strAny(args, key); ok {
return s
+12
View File
@@ -27,3 +27,15 @@ func TestNewZhAliases(t *testing.T) {
t.Fatalf("%v", p)
}
}
func TestPaginateBag(t *testing.T) {
p := page.New(map[string]any{"title": "List"})
out := page.Paginate(p, 0, 5, "/")
pg, ok := out["paginate"].(map[string]any)
if !ok {
t.Fatalf("paginate=%v", out["paginate"])
}
if pg["offset"] != int64(0) || pg["limit"] != int64(5) || pg["path"] != "/" {
t.Fatalf("%v", pg)
}
}