Skip to content

Commit 3990ddf

Browse files
TheAlexLichterpi0
authored andcommittedMar 8, 2018
feat(meta): add ogUrl url property (#42)
1 parent cafcfc4 commit 3990ddf

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed
 

Diff for: ‎docs/modules/meta.md

+4
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ These types are accepted:
9393
* `width`, `height`: specify the dimensions, respectively.
9494
* `type`: specify the MIME type.
9595

96+
**ogUrl**
97+
- Default: ogHost (if defined)
98+
- Meta: `og:url`
99+
96100
**nativeUI**
97101
- Default: `false`
98102

Diff for: ‎packages/meta/index.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ function generateMeta (_options) {
3333
ogType: 'website',
3434
ogTitle: true,
3535
ogDescription: true,
36-
ogImage: true
36+
ogImage: true,
37+
ogHost: undefined,
38+
ogUrl: true
3739
}
3840

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

153+
// og:url
154+
if (options.ogHost && options.ogUrl === true) {
155+
options.ogUrl = options.ogHost
156+
}
157+
if (options.ogUrl && !find(this.options.head.meta, 'property', 'og:url') && !find(this.options.head.meta, 'name', 'og:url')) {
158+
this.options.head.meta.push({hid: 'og:url', name: 'og:url', property: 'og:url', content: options.ogUrl})
159+
}
160+
151161
// og:image
152162
if (options.ogImage === true) {
153163
if (options.icons && options.icons.length > 0) {

0 commit comments

Comments
 (0)
Please sign in to comment.