Skip to content

Commit

Permalink
feat: support header.exclude links and improve titleTemplate
Browse files Browse the repository at this point in the history
  • Loading branch information
atinux committed Sep 20, 2022
1 parent c4ece0d commit 6c43735
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion template/content/2.guide/2.configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ export default defineAppConfig({
| `header.logo` | `boolean` | | Whether or not to use `Logo.vue` as the header logo |
| `header.title` | `string` | | If set to a string, will be used in the header |
| `header.showLinksIcons` | `boolean` | | If set to `true` links icons will show in the header |
| `header.exclude` | `string[]` | | An array of path to exclude out from the header navigation |
| **Aside** | | | |
| `aside` | `object` | | Aside configuration |
| `aside.level` | `string` | 0 | Aside base level of nesting |
| `aside.filter` | `string[]` | | An array of path to filter out from the navigation |
| `aside.collapsed` | `boolean` | | Will be used as default value for collapsible navigation categories |
| **Footer** | | | |
| `footer` | `object` | | Footer configuration |
Expand Down
13 changes: 12 additions & 1 deletion theme/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export default defineAppConfig({
header: {
title: '',
logo: false, // TODO: handle logo as string for component
showLinksIcons: false // Toggle links icons in the header
showLinksIcons: false, // Toggle links icons in the header
exclude: []
},
footer: {
credits: {
Expand All @@ -32,3 +33,13 @@ export default defineAppConfig({
}
}
})

// TODO: declare types when happy about them
// declare module '@nuxt/schema' {
// interface AppConfigInput {
// docus?: {
// /** Project name */
// title?: string
// }
// }
// }
2 changes: 1 addition & 1 deletion theme/components/AppLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { navigation, page } = useContent()
const { navKeyFromPath } = useContentHelpers()
const titleTemplate = computed(() => {
const appTitleTemplate = docus.value.head?.titleTemplate || `%s | ${docus.value.title}`
const appTitleTemplate = docus.value.head?.titleTemplate || `%s · ${docus.value.title}`
if (page.value) {
return page.value.head?.titleTemplate || navKeyFromPath(page.value._path, 'titleTemplate', navigation.value) || appTitleTemplate
}
Expand Down
2 changes: 1 addition & 1 deletion theme/components/NavbarCenter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const docus = useDocus()
const hasNavigation = computed(() => !!docus.value.aside?.level)
const filtered = computed(() => docus.value.aside?.filter || [])
const filtered = computed(() => docus.value.header?.exclude || [])
const tree = computed(() => {
return (navigation.value || []).filter((item) => {
Expand Down

1 comment on commit 6c43735

@vercel
Copy link

@vercel vercel bot commented on 6c43735 Sep 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.