Skip to content

Commit e4bae6c

Browse files
feat(theme-docs): add defaultDir options (#468)
* feat(theme-docs): add defaultDir option * docs: display defaultDir option
1 parent a72d92e commit e4bae6c

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

docs/content/en/themes/docs.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,8 @@ You can create a `content/settings.json` file to configure the theme.
364364
- The Twitter username `@username` you want to link. Example: `@nuxt_js`
365365
- `defaultBranch` (`String`) <badge>v0.2.0+</badge>
366366
- The default branch for the GitHub repository of your project, used in the `Edit this page on GitHub link` on each page (defaults to `main` if it cannot be detected).
367+
- `defaultDir` (`String`) <badge>v0.6.0+</badge>
368+
- The default dir of your project, used in the `Edit this page on GitHub link` on each page (defaults to `docs`).
367369
- `layout` (`String`) <badge>v0.4.0+</badge>
368370
- The layout of your documentation (defaults to `default`). Can be changed to `single` to have a one-page doc.
369371

packages/theme-docs/src/components/app/AppGithubLink.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,14 @@ export default {
3232
return
3333
}
3434
35-
return `https://github.com/${this.settings.github}/edit/${this.settings.defaultBranch}/docs/content${this.document.path}${this.document.extension}`
35+
return [
36+
'https://github.com',
37+
this.settings.github,
38+
'edit',
39+
this.settings.defaultBranch,
40+
this.settings.defaultDir,
41+
`content${this.document.path}${this.document.extension}`
42+
].filter(path => !!path).join('/')
3643
}
3744
}
3845
}

packages/theme-docs/src/store/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export const state = () => ({
66
releases: [],
77
settings: {
88
title: 'Nuxt Content Docs',
9+
defaultDir: 'docs',
910
defaultBranch: '',
1011
filled: false
1112
}
@@ -35,7 +36,7 @@ export const mutations = {
3536
state.settings.defaultBranch = branch
3637
},
3738
SET_SETTINGS (state, settings) {
38-
state.settings = Object.assign({}, settings, { filled: true })
39+
state.settings = Object.assign({}, state.settings, settings, { filled: true })
3940
}
4041
}
4142

0 commit comments

Comments
 (0)