Skip to content

Commit

Permalink
feat: ogSiteName (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
manniL authored and pi0 committed Apr 2, 2018
1 parent 2b69761 commit 0c99ab9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/modules/meta.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
8 changes: 8 additions & 0 deletions packages/meta/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 0c99ab9

Please sign in to comment.