links
Defines<link> tags to be inserted into the document <head> for a route. Commonly used for stylesheets, favicons, and other resource hints.
Signature
LinkDescriptor[]
An array of link descriptor objects. Each descriptor becomes a
<link> element in the document head.Basic Example
Multiple Stylesheets
External Resources
Prefetch and Preload
Favicons and Icons
Manifest and Theme
Alternate Links
Canonical URLs
Media Queries
TypeScript Type
Combining with Parent Routes
Dynamic Links
Best Practices
Use CSS imports with ?url
Use CSS imports with ?url
Import CSS files with the
?url suffix to get the URL:Preload critical resources
Preload critical resources
Use preload for resources needed immediately:
Keep styles scoped to routes
Keep styles scoped to routes
Only include styles needed for the current route:
Links are removed on route change
Links are removed on route change
Links are automatically removed when navigating away:
See Also
- meta - Define meta tags
- Route Module API - Overview of route exports