fix: show title regardless of logo condition

pull/677/head
Kia Ishii 3 years ago
parent 14711c1cbc
commit 0c0232ae5a

@ -37,7 +37,7 @@ export default {
- Type: `string | false` - Type: `string | false`
You can customize this item to replace the default site title (`title` in app config) in nav. When you set `logo`, you can set it to `false` to hide the title. You can customize this item to replace the default site title (`title` in app config) in nav. When set to `false`, title in nav will be disabled. Useful when you have `logo` that already contains the site title text.
```ts ```ts
export default { export default {

@ -9,11 +9,10 @@ const { hasSidebar } = useSidebar()
<template> <template>
<div class="VPNavBarTitle" :class="{ 'has-sidebar': hasSidebar }"> <div class="VPNavBarTitle" :class="{ 'has-sidebar': hasSidebar }">
<a class="title" href="/"> <a class="title" href="/">
<img v-if="theme.logo" class="logo" :src="theme.logo" :alt="site.title"> <img v-if="theme.logo" class="logo" :src="theme.logo">
<template v-if="theme.siteTitle">{{ theme.siteTitle }}</template> <template v-if="theme.siteTitle">{{ theme.siteTitle }}</template>
<template v-else-if="theme.siteTitle || !theme.logo">{{ site.title }}</template> <template v-else-if="theme.siteTitle === undefined">{{ site.title }}</template>
</a> </a>
</div> </div>
</template> </template>

@ -8,7 +8,8 @@ export namespace DefaultTheme {
logo?: string logo?: string
/** /**
* Custom site title in navbar * Custom site title in navbar. If the value is undefined,
* `config.title` will be used.
*/ */
siteTitle?: string | false siteTitle?: string | false

Loading…
Cancel
Save