File tree 3 files changed +14
-16
lines changed
3 files changed +14
-16
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,17 @@ export default {
47
47
return targetLang || defaultLang || { }
48
48
} ,
49
49
$title ( ) {
50
- return this . $page . frontmatter . title || this . $localeConfig . title || this . $site . title || ''
50
+ const page = this . $page
51
+ const siteTitle = this . $localeConfig . title || this . $site . title || ''
52
+ const selfTitle = page . frontmatter . home ? null : (
53
+ page . frontmatter . title || // explicit title
54
+ page . title // inferred title
55
+ )
56
+ return siteTitle
57
+ ? selfTitle
58
+ ? ( siteTitle + ' | ' + selfTitle )
59
+ : siteTitle
60
+ : selfTitle || 'VuePress'
51
61
} ,
52
62
$description ( ) {
53
63
return this . $page . frontmatter . description || this . $localeConfig . description || this . $site . description || ''
Original file line number Diff line number Diff line change @@ -14,15 +14,3 @@ export function findPageForPath (pages, path) {
14
14
}
15
15
}
16
16
}
17
-
18
- export function getTitle ( siteTitle , page ) {
19
- const selfTitle = page . frontmatter . home ? null : (
20
- page . frontmatter . title || // explicit title
21
- page . title // inferred title
22
- )
23
- return siteTitle
24
- ? selfTitle
25
- ? ( siteTitle + ' | ' + selfTitle )
26
- : siteTitle
27
- : selfTitle || 'VuePress'
28
- }
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ import Home from './Home.vue'
21
21
import Navbar from ' ./Navbar.vue'
22
22
import Page from ' ./Page.vue'
23
23
import Sidebar from ' ./Sidebar.vue'
24
- import { pathToComponentName , getTitle , getLang } from ' @app/util'
24
+ import { pathToComponentName } from ' @app/util'
25
25
import { resolveSidebarItems } from ' ./util'
26
26
27
27
export default {
@@ -76,7 +76,7 @@ export default {
76
76
77
77
created () {
78
78
if (this .$ssrContext ) {
79
- this .$ssrContext .title = getTitle ( this .$title , this . $page )
79
+ this .$ssrContext .title = this .$title
80
80
this .$ssrContext .lang = this .$lang
81
81
this .$ssrContext .description = this .$page .description || this .$description
82
82
}
@@ -87,7 +87,7 @@ export default {
87
87
// update title / meta tags
88
88
this .currentMetaTags = []
89
89
const updateMeta = () => {
90
- document .title = getTitle ( this .$title , this . $page )
90
+ document .title = this .$title
91
91
document .documentElement .lang = this .$lang
92
92
const meta = [
93
93
{
You can’t perform that action at this time.
0 commit comments