diff --git a/docs/modules/meta.md b/docs/modules/meta.md index 5828ed27..bd54b442 100644 --- a/docs/modules/meta.md +++ b/docs/modules/meta.md @@ -67,6 +67,10 @@ Please read this resources before you enable `mobileAppIOS` option: - Default: `website` - Meta: `og:type` +**ogSiteName** +- Default: same as options.name +- Meta: `og:site_name` + **ogTitle** - Default: same as options.name - Meta: `og:title` diff --git a/packages/meta/index.js b/packages/meta/index.js index a0aa58ca..244d3a81 100755 --- a/packages/meta/index.js +++ b/packages/meta/index.js @@ -31,6 +31,7 @@ function generateMeta (_options) { theme_color: this.options.loading && this.options.loading.color, lang: 'en', ogType: 'website', + ogSiteName: true, ogTitle: true, ogDescription: true, ogImage: true, @@ -144,6 +145,13 @@ function generateMeta (_options) { if (options.ogTitle && !find(this.options.head.meta, 'property', 'og:title') && !find(this.options.head.meta, 'name', 'og:title')) { this.options.head.meta.push({ hid: 'og:title', name: 'og:title', property: 'og:title', content: options.ogTitle }) } + // og:site_name + if (options.ogSiteName === true) { + options.ogSiteName = options.name + } + if (options.ogSiteName && !find(this.options.head.meta, 'property', 'og:site_name') && !find(this.options.head.meta, 'name', 'og:site_name')) { + this.options.head.meta.push({ hid: 'og:site_name', name: 'og:site_name', property: 'og:site_name', content: options.ogSiteName }) + } // og:description if (options.ogDescription === true) {