feat(seo): add sitemap.xml and robots.txt generation (#48, #60)#76
Merged
feat(seo): add sitemap.xml and robots.txt generation (#48, #60)#76
Conversation
Add /sitemap.xml with loc+lastmod for homepage, post index, all published posts, and public pages. Add /robots.txt allowing all crawlers, disallowing admin/auth/health/webhooks paths, with Sitemap directive. Extract get_all_pages() helper in content service and refactor feed.py to use shared get_all_posts(). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds SEO support to SquishMark by introducing dynamic sitemap.xml and robots.txt endpoints backed by cached GitHub content, plus shared content helpers to reduce duplication.
Changes:
- Add new
/sitemap.xmland/robots.txtroutes with cache-backed generation logic. - Introduce
get_all_pages()content helper (mirroring existingget_all_posts()). - Refactor Atom feed route to use
get_all_posts()instead of inline post fetching.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
src/squishmark/routers/seo.py |
New SEO router implementing sitemap and robots endpoints plus builders |
src/squishmark/services/content.py |
Adds shared get_all_pages() helper |
src/squishmark/routers/feed.py |
Simplifies feed generation by reusing get_all_posts() |
src/squishmark/main.py |
Registers the new SEO router in the app |
tests/test_seo.py |
Adds unit/integration tests for sitemap + robots behavior |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ntries Pages can now have an optional date in frontmatter. When present, it appears as lastmod in the sitemap. Pages without dates simply omit lastmod, which is valid per the sitemap spec. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ap builder Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/sitemap.xmlendpoint withlocandlastmodfor homepage, post index, all published posts, and public-only pages/robots.txtendpoint allowing all crawlers, disallowing/admin/*,/auth/*,/health,/webhooks/*, withSitemap:directiveget_all_pages()helper inservices/content.py(mirrors existingget_all_posts())feed.pyto use sharedget_all_posts()instead of inline post-fetchingCloses #48, closes #60
Test plan
test_seo.py(unit + integration) — all passing🤖 Generated with Claude Code
— Claude