|
|
|
@ -16,17 +16,17 @@ export default {
|
|
|
|
|
|
|
|
|
|
The `pattern` option defines the URL structure for the link, and `:path` is going to be replaced with the page path.
|
|
|
|
|
|
|
|
|
|
You can also put a pure function that accepts `relativePath` as the argument and returns the URL string.
|
|
|
|
|
You can also put a pure function that accepts [`PageData`](./runtime-api#usedata) as the argument and returns the URL string.
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
export default {
|
|
|
|
|
themeConfig: {
|
|
|
|
|
editLink: {
|
|
|
|
|
pattern: ({ relativePath }) => {
|
|
|
|
|
if (relativePath.startsWith('packages/')) {
|
|
|
|
|
return `https://github.com/acme/monorepo/edit/main/${relativePath}`
|
|
|
|
|
pattern: ({ filePath }) => {
|
|
|
|
|
if (filePath.startsWith('packages/')) {
|
|
|
|
|
return `https://github.com/acme/monorepo/edit/main/${filePath}`
|
|
|
|
|
} else {
|
|
|
|
|
return `https://github.com/acme/monorepo/edit/main/docs/${relativePath}`
|
|
|
|
|
return `https://github.com/acme/monorepo/edit/main/docs/${filePath}`
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|