import { docsUtilsRoutes } from '@pikas/docs-routes'; export const { getLink } = docsUtilsRoutes; import { NextSeo } from 'next-seo';
This package contains a avatar component.
Change LogYou can install this package using npm, yarn, or pnpm.
npm install @pikas-utils/router
yarn add @pikas-utils/router
pnpm add @pikas-utils/router
import { routes } from '@pikas-utils/router';
// Define your routes
const { getLink } = routes({
origin: 'https://www.google.com',
links: {
home: '/',
about: '/about',
contact: '/contact',
items: '/items:id',
docs: '/docs',
},
});
Prop | Description | Type | Default |
---|---|---|---|
origin |
The origin of the website | string |
required |
links |
The links of the website | Record<string, string> |
required |
getLink('ROUTE_NAME', CONFIG);
const homeLink = getLink('home');
// => '/'
const aboutLink = getLink('about', {
withOrigin: true,
});
// => 'https://www.google.com/about'
const itemLink = getLink('items', {
query: {
id: '123',
},
});
// => '/items/123'
const contactLink = getLink('contact', {
hash: 'MyHash',
});
// => '/contact#MyHash'
const docsLink = getLink('docs', {
lang: 'en',
});
// => '/en/docs'
Prop | Description | Type | Default |
---|---|---|---|
withOrigin |
The origin of link | boolean |
false |
query |
The query of link | Record<string, number or string> |
- |
lang |
The language of link | string |
- |
hash |
The hash of link | string |
- |
keepHash |
Keep the hash | boolean |
false |
keepSearch |
Keep the search | boolean |
false |
This documentation can be edited on GitHub here