feat: the public directory site - #135
Merged
Merged
Conversation
Block 2, PR 3b of 2. Unauthenticated, read-only, GET only. No HTMX; plain GET forms. - public_dispatch: one catch-all on osds/urls_tenant that resolves home, type landing, category browse and listing detail against the tenant's live listing-type count -- the path_segment prefix appears only when there is more than one type (spec §4.5). Home is a type picker when multi-type. - PathRedirect served as a single 301 before segment resolution, browse tree only: longest old_prefix wins, "" prepends new_prefix, robots.txt / sitemap.xml skipped (they are PR 4). One redirect per request, no chains (ruling 2). - Only Listing.objects.published() anywhere public. A draft, hidden or unknown slug is a 404 (handler404 -> public/404.html); a listing reached via a category it is not in is a 404. A source-scan test guards the rule. - Canonical: directory.routing.canonical_category picks the category with the lowest (order, slug); listing detail always emits <link rel=canonical> to that category's path (ruling 3). - Category browse: page 1 indexable, page 2+ and categories with fewer than 3 published listings carry <meta name=robots content=noindex>. Search result pages are always noindex. - Templates under directory/templates/public/ with a base distinct from the admin base; a public_urls templatetag library builds the segment-aware URLs. Listing cards link through the canonical category; a listing with no category shows without a link. robots.txt and the sitemap are PR 4. 26 new tests. check and makemigrations --check clean; the public-site, admin-view and host-resolution suites pass on a real postgres:16. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L5qqrLcxpVZRis5jbN5pKD Signed-off-by: Matthew Wren <info@origindev.com>
test_page_two_is_noindex reassigned public_views.PER_PAGE and only restored it in a finally -- fragile, and test order decided what later tests saw. PER_PAGE is now OSDS_PUBLIC_PAGE_SIZE (default 20), read at request time via getattr(settings, ...), and used by both the category-browse Paginator and the search per_page. The test uses @override_settings(OSDS_PUBLIC_PAGE_SIZE=2). check, makemigrations --check and the public-site + search suites (35) pass on a real postgres:16. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L5qqrLcxpVZRis5jbN5pKD Signed-off-by: Matthew Wren <info@origindev.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.
Catch-all dispatcher resolving home, category browse and listing detail, with the path_segment present only when the tenant runs more than one listing type. PathRedirect served as a single 301 ahead of segment resolution. Every public listing read goes through Listing.objects.published(), enforced by a source-scanning guard test; a draft, hidden or unknown slug is a 404. Canonical is the category with lowest (order, slug). Category page 1 indexable, page 2+ and thin categories noindex, search always noindex.