fix: unable to use non-GitHub repo in editLink

close https://github.com/vuejs/vitepress/issues/694
pull/697/head
Percy Ma 3 years ago
parent 6e53be6575
commit ed291fc426
No known key found for this signature in database
GPG Key ID: A1803D3315E6CCBC

@ -188,6 +188,61 @@ export interface Footer {
}
```
## editLink
- Type: `EditLink`
Edit link configuration. You can then customize git repo link and display text.
```ts
export default {
themeConfig: {
editLink: {
domain: 'github.com'
repo: 'vuejs/vitepress',
branch: 'next',
dir: 'docs',
text: 'Edit this page on GitHub'
},
}
}
```
```ts
export interface EditLink {
/**
* Domain of git repo
*
* @example 'github.com' or 'https://github.com'
*/
domain?: string
/**
* Repo of the site.
*
* @example 'vuejs/docs'
*/
repo: string
/**
* Branch of the repo.
*
* @default 'main'
*/
branch?: string
/**
* If your docs are not at the root of the repo.
*
* @example 'docs'
*/
dir?: string
/**
* Custom text for edit link.
*
* @default 'Edit this page'
*/
text?: string
}
```
## lastUpdatedText
- Type: `string`

@ -6,7 +6,7 @@ export function useEditLink() {
return computed(() => {
const url = [
'https://github.com',
`https://${theme.value.editLink?.domain || 'github.com'}`,
theme.value.editLink?.repo || '???',
'edit',
theme.value.editLink?.branch || 'main',

@ -119,6 +119,13 @@ export namespace DefaultTheme {
// edit link -----------------------------------------------------------------
export interface EditLink {
/**
* Domain of git repo
*
* @example 'github.com' or 'https://github.com'
*/
domain?: string
/**
* Repo of the site.
*

Loading…
Cancel
Save