Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added Github baseURL to allow Enterprise URL #924

Merged
merged 2 commits into from Jun 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -283,6 +283,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