Skip to content

Commit 76a1f89

Browse files
aapokiisopi0
authored andcommitted
fix(meta): add unique identifiers to meta fields (#23)
Uses the [`vmid` option](https://github.com/declandewet/vue-meta#lists-of-tags) of vue-meta
1 parent d22fed2 commit 76a1f89

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

packages/meta/index.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,27 +49,27 @@ function generateMeta (_options) {
4949

5050
// Charset
5151
if (options.charset && !find(this.options.head.meta, 'charset')) {
52-
this.options.head.meta.push({ charset: options.charset })
52+
this.options.head.meta.push({ hid: 'charset', charset: options.charset })
5353
}
5454

5555
// Viewport
5656
if (options.viewport && !find(this.options.head.meta, 'name', 'viewport')) {
57-
this.options.head.meta.push({ name: 'viewport', content: options.viewport })
57+
this.options.head.meta.push({ hid: 'viewport', name: 'viewport', content: options.viewport })
5858
}
5959

6060
// mobileApp
6161
if (options.mobileApp && !find(this.options.head.meta, 'name', 'mobile-web-app-capable')) {
62-
this.options.head.meta.push({ name: 'mobile-web-app-capable', content: 'yes' })
62+
this.options.head.meta.push({ hid: 'mobile-web-app-capable', name: 'mobile-web-app-capable', content: 'yes' })
6363
}
6464

6565
// mobileApp (IOS)
6666
if (options.mobileAppIOS && !find(this.options.head.meta, 'name', 'apple-mobile-web-app-capable')) {
67-
this.options.head.meta.push({ name: 'apple-mobile-web-app-capable', content: 'yes' })
67+
this.options.head.meta.push({ hid: 'apple-mobile-web-app-capable', name: 'apple-mobile-web-app-capable', content: 'yes' })
6868
}
6969

7070
// statusBarStyle (IOS)
7171
if (options.mobileAppIOS && options.appleStatusBarStyle && !find(this.options.head.meta, 'name', 'apple-mobile-web-app-status-bar-style')) {
72-
this.options.head.meta.push({ name: 'apple-mobile-web-app-status-bar-style', content: options.appleStatusBarStyle })
72+
this.options.head.meta.push({ hid: 'apple-mobile-web-app-status-bar-style', name: 'apple-mobile-web-app-status-bar-style', content: options.appleStatusBarStyle })
7373
}
7474

7575
// Icons
@@ -99,7 +99,7 @@ function generateMeta (_options) {
9999
// IOS launch icon title
100100
const title = options.name || this.options.head.title || false
101101
if (title && !find(this.options.head.meta, 'name', 'apple-mobile-web-app-title')) {
102-
this.options.head.meta.push({ name: 'apple-mobile-web-app-title', content: title })
102+
this.options.head.meta.push({ hid: 'apple-mobile-web-app-title', name: 'apple-mobile-web-app-title', content: title })
103103
}
104104

105105
// description meta
@@ -109,7 +109,7 @@ function generateMeta (_options) {
109109

110110
// theme-color meta
111111
if (options.theme_color && !find(this.options.head.meta, 'name', 'theme-color')) {
112-
this.options.head.meta.push({ name: 'theme-color', content: options.theme_color })
112+
this.options.head.meta.push({ hid: 'theme-color', name: 'theme-color', content: options.theme_color })
113113
}
114114

115115
// Add lang to html tag
@@ -122,23 +122,23 @@ function generateMeta (_options) {
122122

123123
// og:type
124124
if (options.ogType && !find(this.options.head.meta, 'property', 'og:type') && !find(this.options.head.meta, 'name', 'og:type')) {
125-
this.options.head.meta.push({ name: 'og:type', property: 'og:type', content: options.ogType })
125+
this.options.head.meta.push({ hid: 'og:type', name: 'og:type', property: 'og:type', content: options.ogType })
126126
}
127127

128128
// og:title
129129
if (options.ogTitle === true) {
130130
options.ogTitle = options.name
131131
}
132132
if (options.ogTitle && !find(this.options.head.meta, 'property', 'og:title') && !find(this.options.head.meta, 'name', 'og:title')) {
133-
this.options.head.meta.push({ name: 'og:title', property: 'og:title', content: options.ogTitle })
133+
this.options.head.meta.push({ hid: 'og:title', name: 'og:title', property: 'og:title', content: options.ogTitle })
134134
}
135135

136136
// og:description
137137
if (options.ogDescription === true) {
138138
options.ogDescription = options.description
139139
}
140140
if (options.ogDescription && !find(this.options.head.meta, 'property', 'og:description') && !find(this.options.head.meta, 'name', 'og:description')) {
141-
this.options.head.meta.push({ name: 'og:description', property: 'og:description', content: options.ogDescription })
141+
this.options.head.meta.push({ hid: 'og:description', name: 'og:description', property: 'og:description', content: options.ogDescription })
142142
}
143143
}
144144

0 commit comments

Comments
 (0)