From 150de7a3194bfdfa880f83e817e4e1ab4267b4da Mon Sep 17 00:00:00 2001 From: wuxinhua Date: Thu, 7 Nov 2019 14:33:35 +0800 Subject: [PATCH 1/2] feat: add default title and description meta --- packages/saber/vue-app/create-app.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/packages/saber/vue-app/create-app.js b/packages/saber/vue-app/create-app.js index 88a79a5fc..57e7e7bd2 100644 --- a/packages/saber/vue-app/create-app.js +++ b/packages/saber/vue-app/create-app.js @@ -54,15 +54,26 @@ export default context => { if (!htmlAttrs.lang) { delete htmlAttrs.lang } + + const title = this.$siteConfig.title || 'Saber' + + const defaultMeta = [ + { + name: 'generator', + content: `Saber v${__SABER_VERSION__}` + }, + { + name: 'description', + content: `${this.$siteConfig.description || 'A framework for building modern static websites'}` + } + ] return { ...head, htmlAttrs, + title, meta: [ - { - name: 'generator', - content: `Saber v${__SABER_VERSION__}` - }, + ...defaultMeta, ...(head.meta || []) ] } From f545e2935427bc8ca70805c8846bd7049a59589c Mon Sep 17 00:00:00 2001 From: wuxinhua Date: Mon, 11 Nov 2019 20:34:53 +0800 Subject: [PATCH 2/2] fix: remove default title description setting --- packages/saber/vue-app/create-app.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/saber/vue-app/create-app.js b/packages/saber/vue-app/create-app.js index 57e7e7bd2..fe8eedca1 100644 --- a/packages/saber/vue-app/create-app.js +++ b/packages/saber/vue-app/create-app.js @@ -55,19 +55,22 @@ export default context => { delete htmlAttrs.lang } - const title = this.$siteConfig.title || 'Saber' + const { title, description } = this.$siteConfig const defaultMeta = [ { name: 'generator', content: `Saber v${__SABER_VERSION__}` - }, - { - name: 'description', - content: `${this.$siteConfig.description || 'A framework for building modern static websites'}` } ] + if (description) { + defaultMeta.push({ + name: 'description', + content: description + }) + } + return { ...head, htmlAttrs,