JSPM

@sharpapi/sharpapi-node-seo-tags

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 12
  • Score
    100M100P100Q29079F
  • License MIT

SharpAPI.com Node.js SDK for generating SEO tags

Package Exports

  • @sharpapi/sharpapi-node-seo-tags
  • @sharpapi/sharpapi-node-seo-tags/src/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@sharpapi/sharpapi-node-seo-tags) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

SharpAPI GitHub cover

SEO & Social Media Tags Generator API for Node.js

šŸ” Generate SEO-optimized meta tags with AI — powered by SharpAPI.

npm version License

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.


šŸ“‹ Table of Contents

  1. Requirements
  2. Installation
  3. Usage
  4. API Documentation
  5. Response Format
  6. Examples
  7. License

Requirements

  • Node.js >= 16.x
  • npm or yarn

Installation

Step 1. Install the package via npm:

npm install @sharpapi/sharpapi-node-seo-tags

Step 2. Get your API key

Visit SharpAPI.com to get your API key.


Usage

const { SharpApiSeoTagsService } = require('@sharpapi/sharpapi-node-seo-tags');

const apiKey = process.env.SHARP_API_KEY; // Store your API key in environment variables
const service = new SharpApiSeoTagsService(apiKey);

const content = `
Introducing our new AI-powered task management platform.
Boost productivity with intelligent automation, smart scheduling, and team collaboration tools.
`;

async function generateSeoTags() {
  try {
    // Submit SEO tags generation job
    const statusUrl = await service.generateSeoTags(content, 'English');
    console.log('Job submitted. Status URL:', statusUrl);

    // Fetch results (polls automatically until complete)
    const result = await service.fetchResults(statusUrl);
    console.log('Generated SEO tags:', result.getResultJson());
  } catch (error) {
    console.error('Error:', error.message);
  }
}

generateSeoTags();

API Documentation

Methods

generateSeoTags(content: string, language?: string, voiceTone?: string): Promise<string>

Generates comprehensive SEO meta tags and Open Graph tags based on content.

Parameters:

  • content (string, required): The web page content to generate SEO tags for
  • language (string, optional): Output language (default: 'English')
  • voiceTone (string, optional): Tone of voice for descriptions (e.g., 'Professional', 'Casual')

Returns:

  • Promise: Status URL for polling the job result

Example:

const statusUrl = await service.generateSeoTags(
  articleContent,
  'English',
  'Professional'
);
const result = await service.fetchResults(statusUrl);

Response Format

The API returns comprehensive SEO and Open Graph tags:

{
  "data": {
    "type": "api_job_result",
    "id": "3c4e887a-0dfd-49b6-8edb-9280e468c210",
    "attributes": {
      "status": "success",
      "type": "seo_generate_tags",
      "result": {
        "meta_tags": {
          "title": "AI-Powered Task Management Platform - Boost Team Productivity",
          "description": "Discover our intelligent task management solution with smart automation, scheduling, and collaboration. Increase productivity by 40% with AI-driven insights.",
          "keywords": "task management, AI automation, productivity tool, team collaboration, smart scheduling",
          "robots": "index, follow",
          "canonical": null,
          "author": null
        },
        "og_tags": {
          "og:title": "AI-Powered Task Management Platform",
          "og:description": "Boost productivity with intelligent automation, smart scheduling, and team collaboration tools",
          "og:type": "website",
          "og:url": null,
          "og:image": null,
          "og:site_name": null,
          "og:locale": "en_US"
        },
        "twitter_tags": {
          "twitter:card": "summary_large_image",
          "twitter:title": "AI-Powered Task Management Platform",
          "twitter:description": "Boost productivity with intelligent automation and smart scheduling",
          "twitter:image": null,
          "twitter:site": null,
          "twitter:creator": null
        }
      }
    }
  }
}

Generated Tags Include:

  • Meta Tags: Title, description, keywords, robots directives
  • Open Graph Tags: OG title, description, type, locale
  • Twitter Card Tags: Card type, title, description, image

Examples

Basic SEO Tags Generation

const { SharpApiSeoTagsService } = require('@sharpapi/sharpapi-node-seo-tags');

const service = new SharpApiSeoTagsService(process.env.SHARP_API_KEY);

const blogPost = `
  Ultimate Guide to Web Performance Optimization.
  Learn proven techniques to make your website load faster,
  improve user experience, and boost search rankings.
`;

service.generateSeoTags(blogPost, 'English')
  .then(statusUrl => service.fetchResults(statusUrl))
  .then(result => {
    const seoData = result.getResultJson().result;

    console.log('šŸ“ Meta Tags:');
    console.log(`Title: ${seoData.meta_tags.title}`);
    console.log(`Description: ${seoData.meta_tags.description}`);
    console.log(`Keywords: ${seoData.meta_tags.keywords}`);

    console.log('\n🌐 Open Graph Tags:');
    console.log(`OG Title: ${seoData.og_tags['og:title']}`);
    console.log(`OG Description: ${seoData.og_tags['og:description']}`);
  })
  .catch(error => console.error('Generation failed:', error));

CMS Integration

const service = new SharpApiSeoTagsService(process.env.SHARP_API_KEY);

async function enrichArticleWithSEO(article) {
  const fullContent = `${article.title}\n\n${article.body}`;

  const statusUrl = await service.generateSeoTags(fullContent, 'English', 'Professional');
  const result = await service.fetchResults(statusUrl);
  const seoData = result.getResultJson().result;

  return {
    ...article,
    seo: {
      metaTitle: seoData.meta_tags.title,
      metaDescription: seoData.meta_tags.description,
      keywords: seoData.meta_tags.keywords.split(', '),
      ogTags: seoData.og_tags,
      twitterTags: seoData.twitter_tags
    }
  };
}

const article = {
  id: 123,
  title: 'Getting Started with React Hooks',
  body: 'React Hooks revolutionized functional components...',
  author: 'Jane Doe'
};

const enrichedArticle = await enrichArticleWithSEO(article);
console.log('Article with SEO:', enrichedArticle);

E-commerce Product Pages

const service = new SharpApiSeoTagsService(process.env.SHARP_API_KEY);

async function generateProductSEO(product) {
  const productContent = `
    ${product.name}
    ${product.description}
    Features: ${product.features.join(', ')}
    Price: $${product.price}
    Category: ${product.category}
  `;

  const statusUrl = await service.generateSeoTags(productContent, 'English', 'Enthusiastic');
  const result = await service.fetchResults(statusUrl);
  const seoData = result.getResultJson().result;

  // Format for HTML meta tags
  const metaTags = [
    `<title>${seoData.meta_tags.title}</title>`,
    `<meta name="description" content="${seoData.meta_tags.description}">`,
    `<meta name="keywords" content="${seoData.meta_tags.keywords}">`,
    `<meta property="og:title" content="${seoData.og_tags['og:title']}">`,
    `<meta property="og:description" content="${seoData.og_tags['og:description']}">`,
    `<meta property="og:type" content="product">`,
    `<meta name="twitter:card" content="${seoData.twitter_tags['twitter:card']}">`
  ];

  return metaTags.join('\n');
}

const product = {
  name: 'Professional DSLR Camera',
  description: '24MP full-frame sensor with 4K video',
  features: ['Wi-Fi', 'Touchscreen', 'Weather-sealed'],
  price: 1299,
  category: 'Photography'
};

const htmlTags = await generateProductSEO(product);
console.log('HTML Meta Tags:\n', htmlTags);

Batch Processing for Multiple Pages

const service = new SharpApiSeoTagsService(process.env.SHARP_API_KEY);

async function processSiteSEO(pages) {
  const results = await Promise.all(
    pages.map(async (page) => {
      const statusUrl = await service.generateSeoTags(page.content, 'English');
      const result = await service.fetchResults(statusUrl);
      const seoData = result.getResultJson().result;

      return {
        url: page.url,
        title: seoData.meta_tags.title,
        description: seoData.meta_tags.description,
        keywords: seoData.meta_tags.keywords,
        lastUpdated: new Date().toISOString()
      };
    })
  );

  return results;
}

const websitePages = [
  { url: '/products', content: 'Browse our complete product catalog...' },
  { url: '/about', content: 'Learn about our company mission...' },
  { url: '/blog', content: 'Read the latest industry insights...' }
];

const seoMap = await processSiteSEO(websitePages);

console.log('Site SEO Map:');
seoMap.forEach(page => {
  console.log(`\n${page.url}`);
  console.log(`  Title: ${page.title}`);
  console.log(`  Description: ${page.description.substring(0, 80)}...`);
});

Use Cases

  • Content Management Systems: Auto-generate SEO tags for articles and pages
  • E-commerce Platforms: Optimize product pages for search engines
  • Blog Platforms: Create compelling meta descriptions for posts
  • Landing Pages: Generate conversion-focused SEO tags
  • Social Media Sharing: Ensure proper Open Graph tag implementation
  • SEO Audits: Generate improved tags for existing content
  • Multi-language Sites: Create localized SEO tags

SEO Best Practices

The generator follows these SEO guidelines:

  • Title Tags: 50-60 characters, includes primary keywords
  • Meta Descriptions: 150-160 characters, compelling and actionable
  • Keywords: Relevant, specific, and naturally distributed
  • Open Graph: Optimized for social media sharing
  • Twitter Cards: Configured for maximum engagement
  • Robots Meta: Proper indexing directives

API Endpoint

POST /seo/generate_tags

For detailed API specifications, refer to:



License

This project is licensed under the MIT License. See the LICENSE.md file for details.


Support


Powered by SharpAPI - AI-Powered API Workflow Automation