-
Notifications
You must be signed in to change notification settings - Fork 155
/
constants.ts
79 lines (72 loc) · 1.64 KB
/
constants.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
export enum TAG_PROPERTIES {
CHARSET = 'charset',
CSS_TEXT = 'cssText',
HREF = 'href',
HTTPEQUIV = 'http-equiv',
INNER_HTML = 'innerHTML',
ITEM_PROP = 'itemprop',
NAME = 'name',
PROPERTY = 'property',
REL = 'rel',
SRC = 'src',
}
export enum ATTRIBUTE_NAMES {
BODY = 'bodyAttributes',
HTML = 'htmlAttributes',
TITLE = 'titleAttributes',
}
export enum TAG_NAMES {
BASE = 'base',
BODY = 'body',
HEAD = 'head',
HTML = 'html',
LINK = 'link',
META = 'meta',
NOSCRIPT = 'noscript',
SCRIPT = 'script',
STYLE = 'style',
TITLE = 'title',
FRAGMENT = 'Symbol(react.fragment)',
}
export const SEO_PRIORITY_TAGS = {
link: { rel: ['amphtml', 'canonical', 'alternate'] },
script: { type: ['application/ld+json'] },
meta: {
charset: '',
name: ['generator', 'robots', 'description'],
property: [
'og:type',
'og:title',
'og:url',
'og:image',
'og:image:alt',
'og:description',
'twitter:url',
'twitter:title',
'twitter:description',
'twitter:image',
'twitter:image:alt',
'twitter:card',
'twitter:site',
],
},
};
export const VALID_TAG_NAMES = Object.values(TAG_NAMES);
export const REACT_TAG_MAP = {
accesskey: 'accessKey',
charset: 'charSet',
class: 'className',
contenteditable: 'contentEditable',
contextmenu: 'contextMenu',
'http-equiv': 'httpEquiv',
itemprop: 'itemProp',
tabindex: 'tabIndex',
};
export const HTML_TAG_MAP = Object.entries(REACT_TAG_MAP).reduce(
(carry, [key, value]) => {
carry[value] = key;
return carry;
},
{} as { [key: string]: string }
);
export const HELMET_ATTRIBUTE = 'data-rh';