Skip to content

Commit

Permalink
fix(theme-docs): remove redundant header (#722)
Browse files Browse the repository at this point in the history
  • Loading branch information
NozomuIkuta authored Jan 22, 2021
1 parent 51619dd commit e85daf0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion docs/content/en/themes/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,8 @@ To make it work properly, make sure to include these properties in the front-mat
#### Optional fields
- `category` (`String`)
- This will be used to group the documents in the navigation
- This will be used to group the documents in the navigation (defaults to `""`)
- If `category` is falsy or not a string, it is coerced to be an empty string, and isn't renderd in the sidebar.
- `version` (`Float`)
- Alert users that the page is new with a badge. Once the page is seen, the version is stored in the local storage until you increment it
- `fullscreen` (`Boolean`)
Expand Down
1 change: 1 addition & 0 deletions packages/theme-docs/src/components/app/AppNav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
}"
>
<p
v-if="category"
class="mb-2 text-gray-500 uppercase tracking-wider font-bold text-sm lg:text-xs"
>{{ category }}</p>
<ul>
Expand Down
9 changes: 6 additions & 3 deletions packages/theme-docs/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,13 @@ function themeModule () {
// Configure content after each hook
hook('content:file:beforeInsert', (document) => {
const regexp = new RegExp(`^/(${options.i18n.locales.map(locale => locale.code).join('|')})`, 'gi')
const dir = document.dir.replace(regexp, '')
const slug = document.slug.replace(/^index/, '')
const { dir, slug, category } = document
const _dir = dir.replace(regexp, '')
const _slug = slug.replace(/^index/, '')
const _category = category && typeof category === 'string' ? category : ''

document.to = `${dir}/${slug}`
document.to = `${_dir}/${_slug}`
document.category = _category
})
// Extend `/` route
hook('build:extendRoutes', (routes) => {
Expand Down

0 comments on commit e85daf0

Please sign in to comment.