1.2.1 • Published 30 days ago

seo-api v1.2.1

Weekly downloads
-
License
ISC
Repository
-
Last release
30 days ago

SEO-API

The Hooray SEO API, accompanied by a client-side JavaScript package to interact with the API. This was developed by Jake Labate for the purposes of accelerating the auditing, fulfillment and reporting of the agency's SEO services.

Install & Import

npm i seo-api
import SEO from 'seo-api';

Init & Auth

auth (required)

brand_id (optional)

  • This accesses previous saved information about a brand you wish to consider when calling services.
const seo = new SEO({
  auth: process.env.SEO_API_KEY,
  brand_id: 'your-brand-id'
});

back to top ⬆️

Service Configuration

  • The config object specifies input information for the requested service.
  • The 2 keys in the config object are style and data.
const seo = new SEO({
  auth: process.env.SEO_API_KEY,
  brand_id: 'your-brand-id'
});

const config = {
  style: '',
  data: []
}

seo.audit.speed(config);

style

  • The style key sets the style / format / option / desired approach of the requested service.
  • Defaults to a service-specific default style if not set.
  • Style options depend on the requested service.

data

  • The data key expects information used in the services requested. This expects an array of objects to perform the service on.
  • Multi-object requests are server-processed in parallel, and await all responses before returning.
  • The expect keys nested inside a data object change based on the service requested.
// config.data as an array of objects
seo.generate.titleTag({
  style: 'pathIndicative',
  data: [
    { url: 'https://www.jakelabate.com/clients/hooray-agency' },
    { url: 'https://www.jakelabate.com/work/hotel-schema' }
  ]
});

Object-specific styling

style keys can be placed inside each data object for more granular styling options. Falls back to the config.style key value.

seo.generate.titleTag({
  style: 'pathIndicative', // fallback styling
  data: [
    {
      style: 'ai', // processed as 'ai'
      url: 'https://www.jakelabate.com/clients/hooray-agency'
    },
    {
      style: null, // processed as 'pathIndicative'
      url: 'https://www.jakelabate.com/clients/bitx-funding'
    }
  ]
});

back to top ⬆️

Response Object

{
  status: 'success',
  code: 200,
  value: [], // returns a res object for each req object
  errors: [], // if any server errors
  meta: {
    timestamp: 1620000000,
    service: 'generate/title-tag', // endpoint path
    docs: 'https://www.npmjs.com/package/seo-api#{{service}}' // public README.md
  }
}

Service Index

back to top ⬆️

Data Gathering Services

// function path
seo.gather

User Data

seo.gather.userData({
  style: '',
  data: [
    
  ]
});

Auditing Services

// function path
seo.audit

Domain Age

seo.audit.domainAge({
  style: '',
  data: [
    
  ]
});

Forms

seo.audit.forms({
  style: '',
  data: [
    
  ]
});

Heading Structure

seo.audit.headingStructure({
  style: '',
  data: [
    
  ]
});

Images

seo.audit.images({
  style: '',
  data: [
    
  ]
});

Links

seo.audit.links({
  style: '',
  data: [
    
  ]
});

Meta Data

seo.audit.metaData({
  style: '',
  data: [
    
  ]
});

Robots txt

seo.audit.robotTxt({
  style: '',
  data: [
    
  ]
});

Schema Markup

seo.audit.schemaMarkup({
  style: '',
  data: [
    
  ]
});

Sitemap

seo.audit.sitemap({
  style: '',
  data: [
    
  ]
});

Speed

seo.audit.speed({
  style: '',
  data: [
    
  ]
});

SSL Certificate

seo.audit.sslCertificate({
  style: '',
  data: [
    
  ]
});

URL Structure

seo.audit.urlStructure({
  style: '',
  data: [
    
  ]
});

back to top ⬆️

Compression Services

// function path
seo.compress

Image

Compress the file size of any publicly accessible image (via a URL) without losing image quality.

Config

style

  • Not relevant for this service.

data

  • image_url is the URL of the publicly accessible image.
seo.compress.image({
  style: null,
  data: [
    {
      image_url: 'https://www.example.com/image.png'
    }
  ]
});

back to top ⬆️

Generation Services

// function path
seo.generate

Title Tag

Write a title tag for any published or non-published URL.

seo.generate.titleTag({
  style: '',
  data: [

  ]
});

Meta Description

Write a meta description for any published URL.

seo.generate.metaDescription({
  style: '',
  data: [

  ]
});

Image Alt Text

Generate alt text for any publicly accessible image (via a URL).

seo.generate.imageAltText({
  style: '',
  data: [

  ]
});

Open Graph Image

seo.generate.openGraphImage({
  style: '',
  data: [

  ]
});

back to top ⬆️

Reporting Services

// function path
seo.report

The report service is a single-endpoint service that works a little different.

style

  • The pdf option returns a PDF report.

data

  • Expects an array of service-result objects in the default service-returned response.
async function reportWebsiteSpeed(url) {

  const response = await seo.audit.speed({
    style: null,
    data: [{ url }]
  });
  
  return await seo.report({
    style: 'pdf',
    data: response
  });
  
}

const url = 'https://www.jakelabate.com';
reportWebsiteSpeed(url);

back to top ⬆️

1.2.0

30 days ago

1.1.9

1 month ago

1.1.8

1 month ago

1.1.7

1 month ago

1.1.6

1 month ago

1.1.5

1 month ago

1.1.4

1 month ago

1.1.3

1 month ago

1.2.1

30 days ago

1.1.2

1 month ago

1.1.1

2 months ago

1.1.0

2 months ago

1.0.9

2 months ago

1.0.8

2 months ago

1.0.7

2 months ago

1.0.6

2 months ago

1.0.5

2 months ago

1.0.4

2 months ago

1.0.3

2 months ago

1.0.2

3 months ago

1.0.1

3 months ago

1.0.0

3 months ago