@sharpapi/sharpapi-node-seo-tags 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 +370 -0
- package/package.json +40 -0
- package/src/SharpApiSeoTagsService.js +26 -0
- package/src/index.js +6 -0
package/README.md
ADDED
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# SEO & Social Media Tags Generator API for Node.js
|
|
4
|
+
|
|
5
|
+
## 🔍 Generate SEO-optimized meta tags with AI — powered by SharpAPI.
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@sharpapi/sharpapi-node-seo-tags)
|
|
8
|
+
[](https://github.com/sharpapi/sharpapi-node-client/blob/master/LICENSE.md)
|
|
9
|
+
|
|
10
|
+
**SharpAPI SEO Tags Generator** creates comprehensive SEO meta tags and Open Graph tags for web pages. Perfect for content management systems, blogs, e-commerce platforms, and marketing websites.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## 📋 Table of Contents
|
|
15
|
+
|
|
16
|
+
1. [Requirements](#requirements)
|
|
17
|
+
2. [Installation](#installation)
|
|
18
|
+
3. [Usage](#usage)
|
|
19
|
+
4. [API Documentation](#api-documentation)
|
|
20
|
+
5. [Response Format](#response-format)
|
|
21
|
+
6. [Examples](#examples)
|
|
22
|
+
7. [License](#license)
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Requirements
|
|
27
|
+
|
|
28
|
+
- Node.js >= 16.x
|
|
29
|
+
- npm or yarn
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
### Step 1. Install the package via npm:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install @sharpapi/sharpapi-node-seo-tags
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Step 2. Get your API key
|
|
42
|
+
|
|
43
|
+
Visit [SharpAPI.com](https://sharpapi.com/) to get your API key.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Usage
|
|
48
|
+
|
|
49
|
+
```javascript
|
|
50
|
+
const { SharpApiSeoTagsService } = require('@sharpapi/sharpapi-node-seo-tags');
|
|
51
|
+
|
|
52
|
+
const apiKey = process.env.SHARP_API_KEY; // Store your API key in environment variables
|
|
53
|
+
const service = new SharpApiSeoTagsService(apiKey);
|
|
54
|
+
|
|
55
|
+
const content = `
|
|
56
|
+
Introducing our new AI-powered task management platform.
|
|
57
|
+
Boost productivity with intelligent automation, smart scheduling, and team collaboration tools.
|
|
58
|
+
`;
|
|
59
|
+
|
|
60
|
+
async function generateSeoTags() {
|
|
61
|
+
try {
|
|
62
|
+
// Submit SEO tags generation job
|
|
63
|
+
const statusUrl = await service.generateSeoTags(content, 'English');
|
|
64
|
+
console.log('Job submitted. Status URL:', statusUrl);
|
|
65
|
+
|
|
66
|
+
// Fetch results (polls automatically until complete)
|
|
67
|
+
const result = await service.fetchResults(statusUrl);
|
|
68
|
+
console.log('Generated SEO tags:', result.getResultJson());
|
|
69
|
+
} catch (error) {
|
|
70
|
+
console.error('Error:', error.message);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
generateSeoTags();
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## API Documentation
|
|
80
|
+
|
|
81
|
+
### Methods
|
|
82
|
+
|
|
83
|
+
#### `generateSeoTags(content: string, language?: string, voiceTone?: string): Promise<string>`
|
|
84
|
+
|
|
85
|
+
Generates comprehensive SEO meta tags and Open Graph tags based on content.
|
|
86
|
+
|
|
87
|
+
**Parameters:**
|
|
88
|
+
- `content` (string, required): The web page content to generate SEO tags for
|
|
89
|
+
- `language` (string, optional): Output language (default: 'English')
|
|
90
|
+
- `voiceTone` (string, optional): Tone of voice for descriptions (e.g., 'Professional', 'Casual')
|
|
91
|
+
|
|
92
|
+
**Returns:**
|
|
93
|
+
- Promise<string>: Status URL for polling the job result
|
|
94
|
+
|
|
95
|
+
**Example:**
|
|
96
|
+
```javascript
|
|
97
|
+
const statusUrl = await service.generateSeoTags(
|
|
98
|
+
articleContent,
|
|
99
|
+
'English',
|
|
100
|
+
'Professional'
|
|
101
|
+
);
|
|
102
|
+
const result = await service.fetchResults(statusUrl);
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Response Format
|
|
108
|
+
|
|
109
|
+
The API returns comprehensive SEO and Open Graph tags:
|
|
110
|
+
|
|
111
|
+
```json
|
|
112
|
+
{
|
|
113
|
+
"data": {
|
|
114
|
+
"type": "api_job_result",
|
|
115
|
+
"id": "3c4e887a-0dfd-49b6-8edb-9280e468c210",
|
|
116
|
+
"attributes": {
|
|
117
|
+
"status": "success",
|
|
118
|
+
"type": "seo_generate_tags",
|
|
119
|
+
"result": {
|
|
120
|
+
"meta_tags": {
|
|
121
|
+
"title": "AI-Powered Task Management Platform - Boost Team Productivity",
|
|
122
|
+
"description": "Discover our intelligent task management solution with smart automation, scheduling, and collaboration. Increase productivity by 40% with AI-driven insights.",
|
|
123
|
+
"keywords": "task management, AI automation, productivity tool, team collaboration, smart scheduling",
|
|
124
|
+
"robots": "index, follow",
|
|
125
|
+
"canonical": null,
|
|
126
|
+
"author": null
|
|
127
|
+
},
|
|
128
|
+
"og_tags": {
|
|
129
|
+
"og:title": "AI-Powered Task Management Platform",
|
|
130
|
+
"og:description": "Boost productivity with intelligent automation, smart scheduling, and team collaboration tools",
|
|
131
|
+
"og:type": "website",
|
|
132
|
+
"og:url": null,
|
|
133
|
+
"og:image": null,
|
|
134
|
+
"og:site_name": null,
|
|
135
|
+
"og:locale": "en_US"
|
|
136
|
+
},
|
|
137
|
+
"twitter_tags": {
|
|
138
|
+
"twitter:card": "summary_large_image",
|
|
139
|
+
"twitter:title": "AI-Powered Task Management Platform",
|
|
140
|
+
"twitter:description": "Boost productivity with intelligent automation and smart scheduling",
|
|
141
|
+
"twitter:image": null,
|
|
142
|
+
"twitter:site": null,
|
|
143
|
+
"twitter:creator": null
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
**Generated Tags Include:**
|
|
152
|
+
- **Meta Tags**: Title, description, keywords, robots directives
|
|
153
|
+
- **Open Graph Tags**: OG title, description, type, locale
|
|
154
|
+
- **Twitter Card Tags**: Card type, title, description, image
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Examples
|
|
159
|
+
|
|
160
|
+
### Basic SEO Tags Generation
|
|
161
|
+
|
|
162
|
+
```javascript
|
|
163
|
+
const { SharpApiSeoTagsService } = require('@sharpapi/sharpapi-node-seo-tags');
|
|
164
|
+
|
|
165
|
+
const service = new SharpApiSeoTagsService(process.env.SHARP_API_KEY);
|
|
166
|
+
|
|
167
|
+
const blogPost = `
|
|
168
|
+
Ultimate Guide to Web Performance Optimization.
|
|
169
|
+
Learn proven techniques to make your website load faster,
|
|
170
|
+
improve user experience, and boost search rankings.
|
|
171
|
+
`;
|
|
172
|
+
|
|
173
|
+
service.generateSeoTags(blogPost, 'English')
|
|
174
|
+
.then(statusUrl => service.fetchResults(statusUrl))
|
|
175
|
+
.then(result => {
|
|
176
|
+
const seoData = result.getResultJson().result;
|
|
177
|
+
|
|
178
|
+
console.log('📝 Meta Tags:');
|
|
179
|
+
console.log(`Title: ${seoData.meta_tags.title}`);
|
|
180
|
+
console.log(`Description: ${seoData.meta_tags.description}`);
|
|
181
|
+
console.log(`Keywords: ${seoData.meta_tags.keywords}`);
|
|
182
|
+
|
|
183
|
+
console.log('\n🌐 Open Graph Tags:');
|
|
184
|
+
console.log(`OG Title: ${seoData.og_tags['og:title']}`);
|
|
185
|
+
console.log(`OG Description: ${seoData.og_tags['og:description']}`);
|
|
186
|
+
})
|
|
187
|
+
.catch(error => console.error('Generation failed:', error));
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### CMS Integration
|
|
191
|
+
|
|
192
|
+
```javascript
|
|
193
|
+
const service = new SharpApiSeoTagsService(process.env.SHARP_API_KEY);
|
|
194
|
+
|
|
195
|
+
async function enrichArticleWithSEO(article) {
|
|
196
|
+
const fullContent = `${article.title}\n\n${article.body}`;
|
|
197
|
+
|
|
198
|
+
const statusUrl = await service.generateSeoTags(fullContent, 'English', 'Professional');
|
|
199
|
+
const result = await service.fetchResults(statusUrl);
|
|
200
|
+
const seoData = result.getResultJson().result;
|
|
201
|
+
|
|
202
|
+
return {
|
|
203
|
+
...article,
|
|
204
|
+
seo: {
|
|
205
|
+
metaTitle: seoData.meta_tags.title,
|
|
206
|
+
metaDescription: seoData.meta_tags.description,
|
|
207
|
+
keywords: seoData.meta_tags.keywords.split(', '),
|
|
208
|
+
ogTags: seoData.og_tags,
|
|
209
|
+
twitterTags: seoData.twitter_tags
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
const article = {
|
|
215
|
+
id: 123,
|
|
216
|
+
title: 'Getting Started with React Hooks',
|
|
217
|
+
body: 'React Hooks revolutionized functional components...',
|
|
218
|
+
author: 'Jane Doe'
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
const enrichedArticle = await enrichArticleWithSEO(article);
|
|
222
|
+
console.log('Article with SEO:', enrichedArticle);
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### E-commerce Product Pages
|
|
226
|
+
|
|
227
|
+
```javascript
|
|
228
|
+
const service = new SharpApiSeoTagsService(process.env.SHARP_API_KEY);
|
|
229
|
+
|
|
230
|
+
async function generateProductSEO(product) {
|
|
231
|
+
const productContent = `
|
|
232
|
+
${product.name}
|
|
233
|
+
${product.description}
|
|
234
|
+
Features: ${product.features.join(', ')}
|
|
235
|
+
Price: $${product.price}
|
|
236
|
+
Category: ${product.category}
|
|
237
|
+
`;
|
|
238
|
+
|
|
239
|
+
const statusUrl = await service.generateSeoTags(productContent, 'English', 'Enthusiastic');
|
|
240
|
+
const result = await service.fetchResults(statusUrl);
|
|
241
|
+
const seoData = result.getResultJson().result;
|
|
242
|
+
|
|
243
|
+
// Format for HTML meta tags
|
|
244
|
+
const metaTags = [
|
|
245
|
+
`<title>${seoData.meta_tags.title}</title>`,
|
|
246
|
+
`<meta name="description" content="${seoData.meta_tags.description}">`,
|
|
247
|
+
`<meta name="keywords" content="${seoData.meta_tags.keywords}">`,
|
|
248
|
+
`<meta property="og:title" content="${seoData.og_tags['og:title']}">`,
|
|
249
|
+
`<meta property="og:description" content="${seoData.og_tags['og:description']}">`,
|
|
250
|
+
`<meta property="og:type" content="product">`,
|
|
251
|
+
`<meta name="twitter:card" content="${seoData.twitter_tags['twitter:card']}">`
|
|
252
|
+
];
|
|
253
|
+
|
|
254
|
+
return metaTags.join('\n');
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
const product = {
|
|
258
|
+
name: 'Professional DSLR Camera',
|
|
259
|
+
description: '24MP full-frame sensor with 4K video',
|
|
260
|
+
features: ['Wi-Fi', 'Touchscreen', 'Weather-sealed'],
|
|
261
|
+
price: 1299,
|
|
262
|
+
category: 'Photography'
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
const htmlTags = await generateProductSEO(product);
|
|
266
|
+
console.log('HTML Meta Tags:\n', htmlTags);
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### Batch Processing for Multiple Pages
|
|
270
|
+
|
|
271
|
+
```javascript
|
|
272
|
+
const service = new SharpApiSeoTagsService(process.env.SHARP_API_KEY);
|
|
273
|
+
|
|
274
|
+
async function processSiteSEO(pages) {
|
|
275
|
+
const results = await Promise.all(
|
|
276
|
+
pages.map(async (page) => {
|
|
277
|
+
const statusUrl = await service.generateSeoTags(page.content, 'English');
|
|
278
|
+
const result = await service.fetchResults(statusUrl);
|
|
279
|
+
const seoData = result.getResultJson().result;
|
|
280
|
+
|
|
281
|
+
return {
|
|
282
|
+
url: page.url,
|
|
283
|
+
title: seoData.meta_tags.title,
|
|
284
|
+
description: seoData.meta_tags.description,
|
|
285
|
+
keywords: seoData.meta_tags.keywords,
|
|
286
|
+
lastUpdated: new Date().toISOString()
|
|
287
|
+
};
|
|
288
|
+
})
|
|
289
|
+
);
|
|
290
|
+
|
|
291
|
+
return results;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
const websitePages = [
|
|
295
|
+
{ url: '/products', content: 'Browse our complete product catalog...' },
|
|
296
|
+
{ url: '/about', content: 'Learn about our company mission...' },
|
|
297
|
+
{ url: '/blog', content: 'Read the latest industry insights...' }
|
|
298
|
+
];
|
|
299
|
+
|
|
300
|
+
const seoMap = await processSiteSEO(websitePages);
|
|
301
|
+
|
|
302
|
+
console.log('Site SEO Map:');
|
|
303
|
+
seoMap.forEach(page => {
|
|
304
|
+
console.log(`\n${page.url}`);
|
|
305
|
+
console.log(` Title: ${page.title}`);
|
|
306
|
+
console.log(` Description: ${page.description.substring(0, 80)}...`);
|
|
307
|
+
});
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## Use Cases
|
|
313
|
+
|
|
314
|
+
- **Content Management Systems**: Auto-generate SEO tags for articles and pages
|
|
315
|
+
- **E-commerce Platforms**: Optimize product pages for search engines
|
|
316
|
+
- **Blog Platforms**: Create compelling meta descriptions for posts
|
|
317
|
+
- **Landing Pages**: Generate conversion-focused SEO tags
|
|
318
|
+
- **Social Media Sharing**: Ensure proper Open Graph tag implementation
|
|
319
|
+
- **SEO Audits**: Generate improved tags for existing content
|
|
320
|
+
- **Multi-language Sites**: Create localized SEO tags
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
## SEO Best Practices
|
|
325
|
+
|
|
326
|
+
The generator follows these SEO guidelines:
|
|
327
|
+
|
|
328
|
+
- **Title Tags**: 50-60 characters, includes primary keywords
|
|
329
|
+
- **Meta Descriptions**: 150-160 characters, compelling and actionable
|
|
330
|
+
- **Keywords**: Relevant, specific, and naturally distributed
|
|
331
|
+
- **Open Graph**: Optimized for social media sharing
|
|
332
|
+
- **Twitter Cards**: Configured for maximum engagement
|
|
333
|
+
- **Robots Meta**: Proper indexing directives
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
## API Endpoint
|
|
338
|
+
|
|
339
|
+
**POST** `/seo/generate_tags`
|
|
340
|
+
|
|
341
|
+
For detailed API specifications, refer to:
|
|
342
|
+
- [Postman Documentation](https://documenter.getpostman.com/view/31106842/2sBXVeGsVY)
|
|
343
|
+
- [Product Page](https://sharpapi.com/en/catalog/ai/seo/seo-social-media-tags-generator)
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
347
|
+
## Related Packages
|
|
348
|
+
|
|
349
|
+
- [@sharpapi/sharpapi-node-generate-keywords](https://www.npmjs.com/package/@sharpapi/sharpapi-node-generate-keywords) - Keyword extraction
|
|
350
|
+
- [@sharpapi/sharpapi-node-summarize-text](https://www.npmjs.com/package/@sharpapi/sharpapi-node-summarize-text) - Text summarization
|
|
351
|
+
- [@sharpapi/sharpapi-node-product-intro](https://www.npmjs.com/package/@sharpapi/sharpapi-node-product-intro) - Product descriptions
|
|
352
|
+
- [@sharpapi/sharpapi-node-client](https://www.npmjs.com/package/@sharpapi/sharpapi-node-client) - Full SharpAPI SDK
|
|
353
|
+
|
|
354
|
+
---
|
|
355
|
+
|
|
356
|
+
## License
|
|
357
|
+
|
|
358
|
+
This project is licensed under the MIT License. See the [LICENSE.md](LICENSE.md) file for details.
|
|
359
|
+
|
|
360
|
+
---
|
|
361
|
+
|
|
362
|
+
## Support
|
|
363
|
+
|
|
364
|
+
- **Documentation**: [SharpAPI.com Documentation](https://sharpapi.com/documentation)
|
|
365
|
+
- **Issues**: [GitHub Issues](https://github.com/sharpapi/sharpapi-node-client/issues)
|
|
366
|
+
- **Email**: contact@sharpapi.com
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
370
|
+
**Powered by [SharpAPI](https://sharpapi.com/) - AI-Powered API Workflow Automation**
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sharpapi/sharpapi-node-seo-tags",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "SharpAPI.com Node.js SDK for generating SEO tags",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "jest"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"sharpapi",
|
|
11
|
+
"ai-powered",
|
|
12
|
+
"ai capabilities",
|
|
13
|
+
"api",
|
|
14
|
+
"ai api",
|
|
15
|
+
"api integration",
|
|
16
|
+
"artificial intelligence",
|
|
17
|
+
"natural language processing",
|
|
18
|
+
"restful api",
|
|
19
|
+
"nodejs",
|
|
20
|
+
"software development",
|
|
21
|
+
"seo",
|
|
22
|
+
"meta tags",
|
|
23
|
+
"search engine optimization"
|
|
24
|
+
],
|
|
25
|
+
"author": "Dawid Makowski <contact@sharpapi.com>",
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@sharpapi/sharpapi-node-core": "file:../sharpapi-node-core"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"jest": "^29.7.0"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
},
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "https://github.com/sharpapi/sharpapi-node-seo-tags.git"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const { SharpApiCoreService, SharpApiJobTypeEnum } = require('@sharpapi/sharpapi-node-core');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Service for generating SEO tags using SharpAPI.com
|
|
5
|
+
*/
|
|
6
|
+
class SharpApiSeoTagsService extends SharpApiCoreService {
|
|
7
|
+
/**
|
|
8
|
+
* Generates all most important META tags based on the content provided.
|
|
9
|
+
* Make sure to include link to the website and pictures URL to get as many tags populated as possible.
|
|
10
|
+
*
|
|
11
|
+
* @param {string} text
|
|
12
|
+
* @param {string|null} language
|
|
13
|
+
* @param {string|null} voiceTone
|
|
14
|
+
* @returns {Promise<string>} - The status URL.
|
|
15
|
+
*/
|
|
16
|
+
async generateSeoTags(text, language = null, voiceTone = null) {
|
|
17
|
+
const data = { content: text };
|
|
18
|
+
if (language) data.language = language;
|
|
19
|
+
if (voiceTone) data.voice_tone = voiceTone;
|
|
20
|
+
|
|
21
|
+
const response = await this.makeRequest('POST', SharpApiJobTypeEnum.SEO_GENERATE_TAGS.url, data);
|
|
22
|
+
return this.parseStatusUrl(response);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
module.exports = { SharpApiSeoTagsService };
|