Skip to content

Conversation

@carlosabadia
Copy link
Collaborator

No description provided.

@linear
Copy link

linear bot commented Jan 26, 2026

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 26, 2026

Greptile Overview

Greptile Summary

This PR fixes broken links on the hosting page by ensuring URL generation correctly handles template titles containing underscores. The fix adds .replace('_', '-') to match the slug generation logic in apps.py:266, which uses re.sub(r"[\s_]+", "-", ...) to convert both spaces and underscores to hyphens.

Impact:

  • Fixes broken links for templates like api_admin_panel, customer_data_app, ci_template, and ai_image_gen
  • Users can now successfully navigate from the hosting page to these template detail pages
  • The URL generation is now consistent between the hosting page card links and the actual route definitions

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • The change is a simple, well-targeted fix that adds underscore replacement to match existing slug generation logic. The fix is minimal (single character addition), addresses a clear bug (broken links), and aligns with the established pattern in apps.py. No custom rules are violated, and the change has no side effects.
  • No files require special attention

Important Files Changed

Filename Overview
pcweb/pages/hosting/views/templates.py Added underscore-to-hyphen replacement to fix broken links for templates with underscores in their titles (e.g., api_admin_panel, customer_data_app). Change aligns URL generation with the slug generation logic in apps.py.

Sequence Diagram

sequenceDiagram
    participant User
    participant HostingPage as Hosting Page (templates.py)
    participant GalleryApp as Gallery App (apps.py)
    participant TemplateDoc as Template Document
    
    User->>HostingPage: Visit hosting page
    HostingPage->>TemplateDoc: Load template metadata
    Note over TemplateDoc: title: "api_admin_panel"
    HostingPage->>HostingPage: Set url = title
    Note over HostingPage: url: "api_admin_panel"
    HostingPage->>HostingPage: Generate href for link
    Note over HostingPage: Before: replace(' ', '-')<br/>Result: "api_admin_panel" ❌<br/><br/>After: replace(' ', '-').replace('_', '-')<br/>Result: "api-admin-panel" ✓
    HostingPage->>User: Render link with href
    User->>GalleryApp: Click link to template
    GalleryApp->>GalleryApp: Generate route slug
    Note over GalleryApp: re.sub(r"[\s_]+", "-", title)<br/>Result: "api-admin-panel"
    GalleryApp->>User: Display template page (route matches!)
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

No files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@Kastier1 Kastier1 merged commit a1f0aaf into main Jan 28, 2026
10 checks passed
@Kastier1 Kastier1 deleted the carlos/fix-broken-links-hosting branch January 28, 2026 20:32
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.

2 participants