From cff66434f16d35660d16d311dea241c0bbcacb88 Mon Sep 17 00:00:00 2001 From: Xinyu Liu Date: Wed, 9 May 2018 20:13:04 +0800 Subject: [PATCH] fix: move ssrContext setting to core --- lib/app/dataMixin.js | 7 +++++++ lib/app/util.js | 4 ++++ lib/default-theme/Layout.vue | 8 -------- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/app/dataMixin.js b/lib/app/dataMixin.js index 5b249b4589..4684cf7ca2 100644 --- a/lib/app/dataMixin.js +++ b/lib/app/dataMixin.js @@ -80,5 +80,12 @@ export default { this.$route.path ) } + }, + created () { + if (this.$ssrContext) { + this.$ssrContext.title = this.$title + this.$ssrContext.lang = this.$lang + this.$ssrContext.description = this.$page.description || this.$description + } } } diff --git a/lib/app/util.js b/lib/app/util.js index 29643be49f..e1229ad1d8 100644 --- a/lib/app/util.js +++ b/lib/app/util.js @@ -13,4 +13,8 @@ export function findPageForPath (pages, path) { return page } } + return { + path: '', + frontmatter: {} + } } diff --git a/lib/default-theme/Layout.vue b/lib/default-theme/Layout.vue index df988d69d7..ff7961bc68 100644 --- a/lib/default-theme/Layout.vue +++ b/lib/default-theme/Layout.vue @@ -87,14 +87,6 @@ export default { } }, - created () { - if (this.$ssrContext) { - this.$ssrContext.title = this.$title - this.$ssrContext.lang = this.$lang - this.$ssrContext.description = this.$page.description || this.$description - } - }, - mounted () { // update title / meta tags this.currentMetaTags = []