Skip to content

Commit

Permalink
feat: added Github baseURL to allow Enterprise URL (#924)
Browse files Browse the repository at this point in the history
Co-authored-by: Bernardo Oliveira <bernardo.oliveira@bovo.studio>
Co-authored-by: Sébastien Chopin <seb@nuxt.com>
  • Loading branch information
3 people committed Jun 30, 2023
1 parent eac38fe commit 7d145cc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
14 changes: 11 additions & 3 deletions components/docs/EditOnLink.vue
Expand Up @@ -6,6 +6,14 @@ import { useAppConfig } from '#imports'
export default defineComponent({
props: {
/**
* GitHub base URL.
*/
baseUrl: {
type: String,
default: () => useAppConfig()?.docus?.github?.baseUrl || 'https://github.com',
required: false
},
/**
* Repository owner.
*/
Expand Down Expand Up @@ -81,7 +89,7 @@ export default defineComponent({
}
const source = computed(() => {
let { repo, owner, branch, contentDir } = props
let { baseUrl, repo, owner, branch, contentDir } = props
let prefix = ''
// Resolve source from content sources
Expand All @@ -105,10 +113,10 @@ export default defineComponent({
}
}
return { repo, owner, branch, contentDir, prefix }
return { baseUrl, repo, owner, branch, contentDir, prefix }
})
const base = computed(() => joinURL('https://github.com', `${source.value.owner}/${source.value.repo}`))
const base = computed(() => joinURL(`${source.value.baseUrl}/${source.value.owner}/${source.value.repo}`))
const path = computed(() => {
const dirParts: string[] = []
Expand Down
6 changes: 6 additions & 0 deletions nuxt.schema.ts
Expand Up @@ -286,6 +286,12 @@ export default defineNuxtSchema({
* @studioIcon simple-icons:github
*/
github: {
/**
* Base URL
*
* You can use this to link to GitHub Enterprise.
*/
baseUrl: 'https://github.com',
/**
* Directory
*
Expand Down

0 comments on commit 7d145cc

Please sign in to comment.