UNPKG

1.21 kBJavaScriptView Raw
1'use strict';
2
3module.exports = appleMetaTags;
4
5function appleMetaTags(manifest, config) {
6 if (manifest.apple === false) {
7 return [];
8 }
9
10 var tags = [];
11
12 let webAppCapable = manifest.apple && manifest.apple.webAppCapable;
13 let standalone = ['fullscreen', 'standalone'].indexOf(manifest.display) > -1;
14
15 if ((standalone && webAppCapable !== false) || webAppCapable === true) {
16 tags.push('<meta name="apple-mobile-web-app-capable" content="yes">');
17 }
18
19 if (manifest.name) {
20 tags.push('<meta name="apple-mobile-web-app-title" content="' + manifest.name + '">');
21 }
22
23 if (manifest.apple && manifest.apple.statusBarStyle) {
24 tags.push('<meta name="apple-mobile-web-app-status-bar-style" content="' + manifest.apple.statusBarStyle + '">');
25 } else {
26 tags.push('<meta name="apple-mobile-web-app-status-bar-style" content="default">');
27 }
28
29 if (manifest.apple && manifest.apple.formatDetection) {
30 var detection = manifest.apple.formatDetection;
31 var content = '';
32
33 if (detection.telephone === false) {
34 content += 'telephone=no';
35 }
36
37 if (content) {
38 tags.push('<meta name="format-detection" content="' + content + '">');
39 }
40 }
41
42 return tags;
43}