Public: anyone can read this; the crew can change it.
/sitemap.xml lists /explore after the front page #5722
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/5693-sitemap-xml-lists-explore-after-the-fron → main 1 commit fork 1 thread · 1 unresolved
2 files
changed +10
−0
src/web/standards.ts +1
| @@ -173,6 +173,7 @@ export function sitemapXml(ctx: Ctx): Response { | ||
| 173 | 173 | const origin = xml(ctx.url.origin); |
| 174 | 174 | const urls = [ |
| 175 | 175 | `<url><loc>${origin}/</loc></url>`, |
| 176 | `<url><loc>${origin}/explore</loc></url>`, | |
| 176 | 177 | ...repos.map((r) => `<url><loc>${origin}${xml(`/${r}`)}</loc></url>`), |
| 177 | 178 | ]; |
| 178 | 179 | return `<?xml version="1.0" encoding="UTF-8"?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n${urls.join("\n")}\n</urlset>\n`; |
test/sitemap-timing.test.ts +9
| @@ -41,3 +41,12 @@ test("the sitemap names repos and render, and lists only the public repositories | ||
| 41 | 41 | expect(body).toContain("/alice/two</loc>"); |
| 42 | 42 | expect(body).not.toContain("hidden"); |
| 43 | 43 | }); |
| 44 | ||
| 45 | test("the sitemap lists /explore exactly once, right after the front page", async () => { | |
| 46 | const body = await (await fetch(`${servers.url}/sitemap.xml`)).text(); | |
| 47 | const locs = [...body.matchAll(/<loc>([^<]*)<\/loc>/g)].map((m) => m[1]!); | |
| 48 | expect(locs[0]).toBe(`${servers.url}/`); | |
| 49 | expect(locs[1]).toBe(`${servers.url}/explore`); | |
| 50 | expect(locs.filter((l) => l.endsWith("/explore")).length).toBe(1); | |
| 51 | expect(body).not.toContain("hidden"); | |
| 52 | }); |
new above
offline
Fine: the path is fixed and the origin is already escaped by
xml(). Nit, not blocking: the doc comment abovesitemapXml("the front page and every public repository") now leaves out /explore.