<SiteLink>
Learn how to use the <SiteLink> component.
This has the exact same API as
<template>
<!-- Will be set to /about/ if trailingSlash is enabled -->
<SiteLink to="/about">
About
</SiteLink>
</template>
Internally this uses the createSitePathResolver composable.
Props
withBase
- Type:
boolean - Default:
false
When enabled, the
absolute
- Type:
Boolean - Default:
false
Will render the link as an absolute path.
canonical
- Type:
Boolean - Default:
false
When
The non-canonical URL will use the request origin instead of the configured site URL.
Component Options
If needed, you can modify the behaviour of how this component is registered through using Nuxt Config.
This can be useful for making the component global, allowing it to work in Nuxt Content, or setting a prefix to avoid collisions with other components.
export default defineNuxtConfig({
site: {
componentOptions: {
prefix: 'I',
global: true,
},
},
})
<template>
<ISiteLink to="/foo">
Foo
</ISiteLink>
</template>
Did this page help you?