Canonical links not respecting trailingSlash behaviour
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 15.1k
- Forks
- 1.9k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 143
Description
Describe the bug
When trailingSlash: 'always' is set in createRouter, the canonical link href returned by a route's head() function and read through useRouterState via match.links does not have a trailing slash enforced.
The trailingSlash option correctly enforces trailing slashes on navigation URLs, but the href values in the links array on route matches are returned as-is without the trailing slash transformation applied.
Expected behavior
When trailingSlash: 'always' is configured, the router should ensure that href values in match.links also have a trailing slash appended.
How often does this bug happen?
Every time
Platform
@tanstack/react-routerversion1.157.1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the createRouter trailingSlash handling and trace how a route's head() output becomes match.links, including the useRouterState entry point. Verify the behavior with trailingSlash: 'always' and ensure canonical href values receive the same trailing-slash treatment as navigation URLs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100