@julseb-lib/react 0.0.96 → 0.0.99
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +295 -254
- package/dist/index.umd.js +47 -47
- package/dist/lib/components/Meta/Meta.tsx +68 -12
- package/dist/lib/components/Meta/types.ts +3 -0
- package/package.json +1 -1
|
@@ -12,10 +12,13 @@ import type { ILibMeta } from "./types"
|
|
|
12
12
|
* @param {string} [props.description] - Meta description for SEO.
|
|
13
13
|
* @param {string[]} [props.keywords] - Array of keywords for SEO.
|
|
14
14
|
* @param {string} [props.author] - Author of the document.
|
|
15
|
+
* @param {string} [props.publisher] - Publisher of the document, default is author.
|
|
15
16
|
* @param {string} [props.type] - Open Graph type (e.g., "website", "article").
|
|
16
17
|
* @param {string} [props.cover] - Open Graph image URL.
|
|
17
18
|
* @param {string} [props.siteName] - Open Graph site name.
|
|
18
19
|
* @param {string} [props.language] - Document language (used for <html lang=""> and og:locale).
|
|
20
|
+
* @param {string} [props.url] - Canonical URL for the page.
|
|
21
|
+
* @param {string} [props.email] - Contact email for the page.
|
|
19
22
|
* @returns {JSX.Element} The rendered meta tags.
|
|
20
23
|
*
|
|
21
24
|
* @see https://documentation-components-react.vercel.app/components/meta
|
|
@@ -30,6 +33,8 @@ import type { ILibMeta } from "./types"
|
|
|
30
33
|
* cover="/cover.png"
|
|
31
34
|
* siteName="My Site"
|
|
32
35
|
* language="en"
|
|
36
|
+
* url="https://mysite.com"
|
|
37
|
+
* email="me@mysite.com"
|
|
33
38
|
* />
|
|
34
39
|
*/
|
|
35
40
|
export const Meta: FC<ILibMeta> = ({
|
|
@@ -39,31 +44,82 @@ export const Meta: FC<ILibMeta> = ({
|
|
|
39
44
|
description,
|
|
40
45
|
keywords,
|
|
41
46
|
author,
|
|
47
|
+
publisher = author,
|
|
42
48
|
type,
|
|
43
49
|
cover,
|
|
44
50
|
siteName,
|
|
45
51
|
language,
|
|
52
|
+
url,
|
|
53
|
+
email,
|
|
46
54
|
}) => {
|
|
47
55
|
return (
|
|
48
56
|
<>
|
|
49
57
|
<title>{title}</title>
|
|
50
|
-
<meta
|
|
58
|
+
<meta property="og:title" content={title} />
|
|
59
|
+
<meta httpEquiv="Content-Type" content="text/html;charset=UTF-8" />
|
|
51
60
|
<meta
|
|
52
|
-
content="width=device-width, initial-scale=1"
|
|
53
61
|
name="viewport"
|
|
62
|
+
content="width=device-width, initial-scale=1.0"
|
|
54
63
|
/>
|
|
55
|
-
|
|
56
|
-
{
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
64
|
+
<meta name="referrer" content="origin" />
|
|
65
|
+
{description && (
|
|
66
|
+
<>
|
|
67
|
+
<meta name="description" content={description} />
|
|
68
|
+
<meta property="og:description" content={description} />
|
|
69
|
+
<meta name="twitter:description" content={description} />
|
|
70
|
+
</>
|
|
71
|
+
)}
|
|
72
|
+
{favicon && (
|
|
73
|
+
<>
|
|
74
|
+
<link
|
|
75
|
+
rel="shortcut icon"
|
|
76
|
+
href={favicon}
|
|
77
|
+
type="image/x-icon"
|
|
78
|
+
/>
|
|
79
|
+
<link rel="icon" href={favicon} />
|
|
80
|
+
</>
|
|
81
|
+
)}
|
|
82
|
+
{author && (
|
|
83
|
+
<>
|
|
84
|
+
<meta name="author" content={author} />
|
|
85
|
+
<meta name="creator" content={author} />
|
|
86
|
+
<meta name="twitter:creator" content={author} />
|
|
87
|
+
</>
|
|
88
|
+
)}
|
|
89
|
+
{keywords && <meta name="keywords" content={keywords?.join(",")} />}
|
|
90
|
+
{siteName && (
|
|
91
|
+
<>
|
|
92
|
+
<meta name="application-name" content={siteName} />
|
|
93
|
+
<meta property="og:site_name" content={siteName} />
|
|
94
|
+
<meta property="og:site_name" content={siteName} />
|
|
95
|
+
<meta name="twitter:title" content={siteName} />
|
|
96
|
+
</>
|
|
97
|
+
)}
|
|
98
|
+
{publisher && <meta name="publisher" content={publisher} />}
|
|
99
|
+
{type && (
|
|
100
|
+
<>
|
|
101
|
+
<meta name="category" content={type} />
|
|
102
|
+
<meta property="og:type" content={type} />
|
|
103
|
+
</>
|
|
104
|
+
)}
|
|
105
|
+
{cover && (
|
|
106
|
+
<>
|
|
107
|
+
<meta property="og:image" content={cover} />
|
|
108
|
+
<meta property="og:image" content={cover} />
|
|
109
|
+
<meta name="twitter:image" content={cover} />
|
|
110
|
+
</>
|
|
60
111
|
)}
|
|
61
|
-
{author && <meta name="author" content={author} />}
|
|
62
|
-
<meta property="og:title" content={title} />
|
|
63
|
-
{type && <meta property="og:type" content={type} />}
|
|
64
|
-
{cover && <meta property="og:image" content={cover} />}
|
|
65
|
-
{siteName && <meta property="og:site_name" content={siteName} />}
|
|
66
112
|
{language && <meta property="og:locale" content={language} />}
|
|
113
|
+
{url && (
|
|
114
|
+
<>
|
|
115
|
+
<meta property="og:url" content={url} />
|
|
116
|
+
<meta name="twitter:site" content={url} />
|
|
117
|
+
</>
|
|
118
|
+
)}
|
|
119
|
+
{email && <meta property="og:email" content={email} />}
|
|
120
|
+
<meta name="twitter:card" content="summary" />
|
|
121
|
+
|
|
122
|
+
{children}
|
|
67
123
|
</>
|
|
68
124
|
)
|
|
69
125
|
}
|
|
@@ -6,9 +6,12 @@ export interface ILibMeta {
|
|
|
6
6
|
description?: string
|
|
7
7
|
keywords?: Array<string>
|
|
8
8
|
author?: string
|
|
9
|
+
publisher?: string
|
|
9
10
|
type?: string
|
|
10
11
|
cover?: string
|
|
11
12
|
siteName?: string
|
|
12
13
|
language?: string
|
|
14
|
+
url?: string
|
|
15
|
+
email?: string
|
|
13
16
|
children?: ReactChildren
|
|
14
17
|
}
|