Skip to content

Commit

Permalink
feat(meta): add ogUrl url property (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
manniL authored and pi0 committed Mar 8, 2018
1 parent cafcfc4 commit 3990ddf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions docs/modules/meta.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ These types are accepted:
* `width`, `height`: specify the dimensions, respectively.
* `type`: specify the MIME type.

**ogUrl**
- Default: ogHost (if defined)
- Meta: `og:url`

**nativeUI**
- Default: `false`

Expand Down
12 changes: 11 additions & 1 deletion packages/meta/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ function generateMeta (_options) {
ogType: 'website',
ogTitle: true,
ogDescription: true,
ogImage: true
ogImage: true,
ogHost: undefined,
ogUrl: true
}

// Combine sources
Expand Down Expand Up @@ -148,6 +150,14 @@ function generateMeta (_options) {
this.options.head.meta.push({ hid: 'og:description', name: 'og:description', property: 'og:description', content: options.ogDescription })
}

// og:url
if (options.ogHost && options.ogUrl === true) {
options.ogUrl = options.ogHost
}
if (options.ogUrl && !find(this.options.head.meta, 'property', 'og:url') && !find(this.options.head.meta, 'name', 'og:url')) {
this.options.head.meta.push({hid: 'og:url', name: 'og:url', property: 'og:url', content: options.ogUrl})
}

// og:image
if (options.ogImage === true) {
if (options.icons && options.icons.length > 0) {
Expand Down

0 comments on commit 3990ddf

Please sign in to comment.