Skip to content

Support relative links #511

@maxsalven

Description

@maxsalven

Would love to see support for relative links in Wouter!

URL: https://www.example.com/some/long/unnested/route/foo

<Link to="../bar">Takes you to example.com/some/long/unnested/route/bar</Link>

I appreciate we can nest things but that's not always an appropriate option.

Activity

molefrog

molefrog commented on Feb 21, 2025

@molefrog
Owner

It's not something we have in the roadmap, but maybe this can be solved with a custom wrapper around Link component e.g.

// under the hood, takes current location from `useLocation`, resolves the absolute path and renders a regular Link
<RelLink to="../bar" />

If you get it working, please let me know, maybe we can add this to the README.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Support relative links · Issue #511 · molefrog/wouter