seo-meta 1.0.0
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/README.md +19 -0
- package/index.js +59 -0
- package/package.json +15 -0
package/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# seo-meta
|
|
2
|
+
|
|
3
|
+
Professional utility for generating SEO metadata and JSON-LD schemas for web applications.
|
|
4
|
+
|
|
5
|
+
## 🚀 Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install seo-meta
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 📖 Usage
|
|
12
|
+
|
|
13
|
+
```javascript
|
|
14
|
+
import { generatePersonSchema } from 'seo-meta';
|
|
15
|
+
const schema = generatePersonSchema({ name: 'John Doe' });
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## ⚖️ License
|
|
19
|
+
MIT
|
package/index.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* seo-meta
|
|
3
|
+
* Helper functions for SEO optimization.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Generates person schema for JSON-LD.
|
|
8
|
+
* @param {Object} options
|
|
9
|
+
*/
|
|
10
|
+
export function generatePersonSchema(options) {
|
|
11
|
+
const { name, jobTitle, url, sameAs = [], alumniOf = '' } = options;
|
|
12
|
+
return {
|
|
13
|
+
"@context": "https://schema.org",
|
|
14
|
+
"@type": "Person",
|
|
15
|
+
"name": name,
|
|
16
|
+
"jobTitle": jobTitle,
|
|
17
|
+
"url": url,
|
|
18
|
+
"sameAs": sameAs,
|
|
19
|
+
"alumniOf": alumniOf
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Generates creative work schema for JSON-LD projects.
|
|
25
|
+
* @param {Object} options
|
|
26
|
+
*/
|
|
27
|
+
export function generateProjectSchema(options) {
|
|
28
|
+
const { name, description, url, image, keywords = [] } = options;
|
|
29
|
+
return {
|
|
30
|
+
"@context": "https://schema.org",
|
|
31
|
+
"@type": "CreativeWork",
|
|
32
|
+
"name": name,
|
|
33
|
+
"description": description,
|
|
34
|
+
"url": url,
|
|
35
|
+
"image": image,
|
|
36
|
+
"keywords": keywords.join(', ')
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Helper to generate standard meta tags.
|
|
42
|
+
*/
|
|
43
|
+
export function getMetaTags(options) {
|
|
44
|
+
const { title, description, image, url, twitterHandle = '' } = options;
|
|
45
|
+
return [
|
|
46
|
+
{ name: 'title', content: title },
|
|
47
|
+
{ name: 'description', content: description },
|
|
48
|
+
{ property: 'og:type', content: 'website' },
|
|
49
|
+
{ property: 'og:url', content: url },
|
|
50
|
+
{ property: 'og:title', content: title },
|
|
51
|
+
{ property: 'og:description', content: description },
|
|
52
|
+
{ property: 'og:image', content: image },
|
|
53
|
+
{ name: 'twitter:card', content: 'summary_large_image' },
|
|
54
|
+
{ name: 'twitter:site', content: twitterHandle },
|
|
55
|
+
{ name: 'twitter:title', content: title },
|
|
56
|
+
{ name: 'twitter:description', content: description },
|
|
57
|
+
{ name: 'twitter:image', content: image }
|
|
58
|
+
];
|
|
59
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "seo-meta",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Professional utility for generating SEO metadata and JSON-LD schemas for web applications.",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"seo",
|
|
8
|
+
"meta",
|
|
9
|
+
"json-ld",
|
|
10
|
+
"schema",
|
|
11
|
+
"structured-data"
|
|
12
|
+
],
|
|
13
|
+
"author": "Antigravity",
|
|
14
|
+
"license": "MIT"
|
|
15
|
+
}
|