Skip to content

Rewrite reddit.com / old.reddit.com links to relative lurker URLs #34

@PortableProgrammer

Description

@PortableProgrammer

Proposal

When a comment or post body contains a link to reddit.com/r/<sub>/comments/<id> or old.reddit.com/..., rewrite it to a relative lurker URL (/comments/<id>) so users stay inside lurker. Bare subreddit references (/r/foo, r/foo) similarly become relative.

Where

Extend src/extlinks.js — likely a new transformation in resolveExternalInlineLinks that pattern-matches reddit URLs and rewrites the href.

Patterns to handle

  • https://reddit.com/r/<sub>/comments/<id>/comments/<id>
  • https://reddit.com/r/<sub>/comments/<id>/_/<comment_id>/comments/<id>/comment/<comment_id>
  • https://www.reddit.com/... and https://old.reddit.com/... — same rewriting
  • https://reddit.com/r/<sub>/r/<sub>
  • /r/<sub> (already relative-ish) → stays as /r/<sub> (matches lurker's existing routes)
  • r/<sub> (bare in text) → linkify to /r/<sub>
  • u/<user> — out of scope unless lurker grows user pages

Acceptance

Clicking any reddit-domain link in a comment body navigates within lurker rather than out to reddit.com.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions