feat(tags): Add tag archive route and admin interface integration

Implement Phase 3 of v1.3.0 tags feature per microformats-tags-design.md:

Routes (starpunk/routes/public.py):
- Add /tag/<tag> archive route with normalization and 404 handling
- Pre-load tags in index route for all notes
- Pre-load tags in note route for individual notes

Admin (starpunk/routes/admin.py):
- Parse comma-separated tag input in create route
- Parse tag input in update route
- Pre-load tags when displaying edit form
- Empty tag field removes all tags

Templates:
- Add tag input field to templates/admin/edit.html
- Add tag input field to templates/admin/new.html
- Use Jinja2 map filter to display existing tags

Implementation details:
- Tag URL parameter normalized to lowercase before lookup
- Tags pre-loaded using object.__setattr__ pattern (like media)
- parse_tag_input() handles trim, dedupe, normalization
- All existing tests pass (micropub categories, admin routes)

Per architect design:
- No pagination on tag archives (acceptable for v1.3.0)
- No autocomplete in admin (out of scope)
- Follows existing media loading patterns

Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-10 11:42:16 -07:00
parent 377027e79a
commit 372064b116
41 changed files with 2573 additions and 10573 deletions

View File

@@ -51,6 +51,15 @@
<!-- Preview area (filled via JavaScript after file selection) -->
<div id="media-preview" class="media-preview" style="display: none;"></div>
<div class="form-group">
<label for="tags">Tags</label>
<input type="text"
id="tags"
name="tags"
placeholder="Comma-separated tags (e.g., IndieWeb, Python, Thoughts)">
<small>Separate multiple tags with commas</small>
</div>
<div class="form-group form-checkbox">
<input type="checkbox" id="published" name="published" checked>
<label for="published">Publish immediately</label>