Skip to content

feat(engine): add tag pages, archive, and related posts#127

Merged
x3ek merged 5 commits into
mainfrom
feat/10-nav-discovery
Jul 3, 2026
Merged

feat(engine): add tag pages, archive, and related posts#127
x3ek merged 5 commits into
mainfrom
feat/10-nav-discovery

Conversation

@x3ek

@x3ek x3ek commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Closes #10

Three discovery features, each as its own commit:

  • Tag pages: /tags (all tags with post counts, sorted count desc then name) and /tags/{tag} (case-insensitive matching, unknown tag renders an empty listing, drafts follow admin gating)
  • Archive: /archive grouping posts by year then month, newest first, compact rows; dateless posts in a trailing Undated group
  • Related posts: shared-tag ranking with date tiebreak, topped up with recent posts when overlap is thin, capped at 5; rendered via a shared _related.html partial on post pages

Shared templates live only in themes/default and inherit each theme's base via the loader fallback (no per-theme template copies needed); all three themes got matching CSS, linked tag chips, and Tags/Archive nav entries. Pure helpers (build_tag_index, posts_for_tag, build_archive, build_related_posts) in services/content.py mirror build_series_context and read the cached content layer.

Tests: 487 total (72 new) covering tag grouping/casing, draft gating, archive grouping and undated handling, related ranking/tiebreak/fallback/self-exclusion, plus cross-theme render tests.

Browser-verified on all three themes: tags index, tag listing (including case variants and unknown tags), archive, related section, nav links.

🤖 Generated with Claude Code

x3ek and others added 3 commits July 3, 2026 12:48
Add GET /tags (all tags with post counts, sorted by count then name) and
GET /tags/{tag} (case-insensitive listing; unknown tag renders empty, not
404). Drafts follow the same is_admin gating as /posts. Tag chips on post
cards and detail pages now link to their tag pages, and a Tags nav link is
added across all three bundled themes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add GET /archive rendering all posts grouped by year then month, newest
first, as a compact title plus date list with no excerpts. Dateless posts
collect into a trailing Undated group. Drafts follow is_admin gating. An
Archive nav link and matching styles are added across all three themes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Compute 3 to 5 related posts in the post detail route, ranked by shared-tag
count with date-descending tiebreaks, excluding the post itself and (for
non-admins) drafts. When tag overlap is thin the list tops up with the most
recent posts so readers always get suggestions. Rendered via a shared
_related.html partial included and styled across all three themes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@x3ek x3ek added this to the SquishMark 1.0 milestone Jul 3, 2026
@x3ek x3ek requested a review from Copilot July 3, 2026 17:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds three discovery/navigation features to SquishMark—tag browsing, a date-based archive, and “related posts” suggestions—implemented as new routes plus reusable “pure helper” functions in the content service layer, with cross-theme support via the theme loader’s default-theme fallback.

Changes:

  • Add /tags and /tags/{tag} routes, plus default templates for tag index and tag listings (styled across all bundled themes).
  • Add /archive route with default archive template, grouping posts by year/month with a trailing “Undated” group.
  • Add “related posts” computation and render it on post pages via a shared _related.html partial; plumb related_posts through ThemeEngine.render_post.

Reviewed changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
themes/terminal/static/css/style.css Adds tag/archive/related-posts styles for terminal theme.
themes/terminal/post.html Turns tags into links; includes shared related-posts partial.
themes/terminal/index.html Turns tags into links on index listing.
themes/terminal/base.html Adds Tags/Archive nav links.
themes/default/tags.html New tags index template.
themes/default/tag.html New tag listing template (compact listing).
themes/default/static/style.css Adds shared styles for tag/archive/related-posts.
themes/default/post.html Turns tags into links; includes related-posts partial.
themes/default/index.html Turns tags into links on index listing.
themes/default/base.html Adds Tags/Archive nav links.
themes/default/archive.html New archive page template.
themes/default/_related.html New shared related-posts partial.
themes/blue-tech/static/style.css Adds tag/archive/related-posts styles for blue-tech theme.
themes/blue-tech/post.html Turns tags into links; includes related-posts partial.
themes/blue-tech/index.html Turns tags into links on index listing.
themes/blue-tech/base.html Adds Tags/Archive nav links.
tests/test_tags.py Unit + cross-theme render tests for tag index/listing templates.
tests/test_routes_tags.py Integration tests for /tags and /tags/{tag} (incl. draft gating).
tests/test_routes_posts.py Integration test asserting related-posts section appears on post pages.
tests/test_routes_archive.py Integration tests for /archive (incl. undated + draft gating).
tests/test_related.py Unit + cross-theme render tests for related-posts computation/partial.
tests/test_archive.py Unit + cross-theme render tests for archive grouping/template.
src/squishmark/services/theme/engine.py Adds related_posts plumbing into render_post() context.
src/squishmark/services/content.py Adds helpers: build_tag_index, posts_for_tag, build_archive, build_related_posts.
src/squishmark/routers/tags.py New tags routes rendering tags.html / tag.html.
src/squishmark/routers/posts.py Computes related posts and passes them into render_post().
src/squishmark/routers/archive.py New archive route rendering archive.html.
src/squishmark/main.py Registers new tags and archive routers.

Comment thread src/squishmark/routers/tags.py
Comment thread tests/test_tags.py Outdated
@x3ek x3ek merged commit 09c8a1b into main Jul 3, 2026
5 checks passed
@x3ek x3ek deleted the feat/10-nav-discovery branch July 3, 2026 18:20
@x3ek x3ek mentioned this pull request Jul 3, 2026
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.

Navigation & Discovery: tag pages, archives, related posts

2 participants