Skip to content

Refactor project paths and handling, preserve query params, scope download/XML routes, and adapt template for canonical URLs#462

Open
cycomachead wants to merge 1 commit into
mainfrom
cycomachead/ai/25/1
Open

Refactor project paths and handling, preserve query params, scope download/XML routes, and adapt template for canonical URLs#462
cycomachead wants to merge 1 commit into
mainfrom
cycomachead/ai/25/1

Conversation

@cycomachead
Copy link
Copy Markdown
Member

Refactor project routes to use canonical URL paths and scope API endpoints

This PR cleans up project URL handling by introducing a proper RESTful path for project pages, adding 301 redirects from legacy URLs, and emitting canonical link tags to ensure search engines always index the primary domain.

Changes

  • New project route: /project?username=...&projectname=.../users/:username/projects/:projectname as the canonical project show route
  • Legacy redirect: GET /project with query params (including old user/project aliases) now issues a 301 redirect to the new path, preserving all parameters
  • Canonical URL tag: The project page sets self.canonical_url using config.hostname (the primary domain), and views/layout/head.etlua emits a <link rel="canonical"> tag when present — ensuring secondary-domain requests still point canonically at the primary domain
  • Model URLs updated: url_for('site') now returns the new /users/{username}/projects/{projectname} path; url_for('download') now returns /api/v1/project/{id}
  • Client-side path generation: Cloud.prototype.showProjectPath updated to produce the new URL structure using encodeURIComponent
  • api.lua unchanged: The project/:id route remains accessible via api_route (both /api/v1/project/:id and /project/:id) — no breaking change to the API

Reviewer Notes

  • The api.lua route was intentionally not changed to hard-scope under /api/v1/ — that change was reverted per feedback. The model's download URL now emits the namespaced form, but the legacy short path remains supported server-side.
  • The legacy /project GET handler normalizes the old user/project param aliases and lowercases usernames to match the global before_filter behavior.

Superconductor Ticket Implementation | App Preview | Guided Review

- Change project show route to /users/:username/projects/:projectname.
- Add 301 redirects for legacy /project query parameter URLs.
- Update project models to use /api/v1/ for download and XML routes.
- Add support for canonical link tags using the primary domain.
- Update client-side path generation to match new URL structure.

Co-authored-by: Claude Code <noreply@anthropic.com>
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