Skip to content

Commit

Permalink
Add og url property
Browse files Browse the repository at this point in the history
  • Loading branch information
manniL committed Mar 8, 2018
1 parent 6481d2b commit de01ce0
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 @@ -89,6 +89,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 @@ -32,7 +32,9 @@ function generateMeta (_options) {
ogType: 'website',
ogTitle: true,
ogDescription: true,
ogImage: true
ogImage: true,
ogHost: undefined,
ogUrl: true
}

// Combine sources
Expand Down Expand Up @@ -142,6 +144,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 de01ce0

Please sign in to comment.