Skip to content

Add sitemap endpoints for SEO crawling#725

Merged
raymondjacobson merged 1 commit intomainfrom
rj-site-maps
Mar 17, 2026
Merged

Add sitemap endpoints for SEO crawling#725
raymondjacobson merged 1 commit intomainfrom
rj-site-maps

Conversation

@raymondjacobson
Copy link
Member

Summary

  • Ports sitemap functionality from the discovery provider to serve XML sitemaps at the same paths (/sitemaps/default.xml, /sitemaps/{type}/index.xml, /sitemaps/{type}/{n}.xml)
  • Root sitemap index (default.xml) references defaults.xml (static routes), plus track/playlist/user type indexes so crawlers can discover everything from a single entry point
  • Filters match the original: only includes entities from users with >=10 followers, excludes unlisted/deleted/private content
  • Count queries use stale-while-revalidate caching (1hr TTL) — returns stale value immediately and refreshes in the background to avoid slow responses from the 4-table JOIN counts

Test plan

  • TestSitemapDefault — root index references all sub-sitemaps
  • TestSitemapDefaults — static routes urlset contains expected pages
  • TestSitemapTrackIndex — track index generates page links
  • TestSitemapTrackPage — includes listed tracks, excludes unlisted/deleted/low-follower
  • TestSitemapPlaylistPage — includes public playlists/albums, excludes private/low-follower, uses correct album/playlist prefix
  • TestSitemapUserPage — includes eligible users, excludes deactivated/low-follower
  • TestSitemapInvalidType — returns 400 for unknown type
  • TestSitemapInvalidPage — returns 400 for non-numeric page
  • TestSitemapContentType — response is valid XML

🤖 Generated with Claude Code

Port sitemap functionality from the discovery provider to serve
XML sitemaps for tracks, playlists, and users at the same paths.
Includes stale-while-revalidate caching for count queries and
filters matching the original (>=10 followers, public, non-deleted).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@raymondjacobson raymondjacobson merged commit e2cf41a into main Mar 17, 2026
5 checks passed
@raymondjacobson raymondjacobson deleted the rj-site-maps branch March 17, 2026 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant