Skip to content

Latest commit

 

History

History
322 lines (261 loc) · 5.79 KB

readme.md

File metadata and controls

322 lines (261 loc) · 5.79 KB

Top 10 things developers need to know about SEO

A Simple API containing a curated set of metrics about the health of a webpage from the technical SEO point of view. It should act as a starting point for an engineer who likes to play and learn more about extracting insights from web pages for the purposes of SEO or testing.

Prerequisites

  • nodejs >=12
  • yarn > 1

Installing

To install dependecies

yarn install

To build and run

yarn starts

Using the API

  • URL /api/page-health

  • Method:

    • GET
  • URL Params

    Required:

    • url=[string]
  • Response

The endpoints response will be an array of all the metrics below, each with a unique name and interface for the value property. If value property is an array, then the isArray property will be true.

type property is the name of the data type of the value property and when value is an array, then type name will be the name of the data type of it's items.

[{
    value: "any",
    type: "string|number|object|boolean"
    name: "string name of metric",
    isArray: true | false
  },
  ...
]

List of metrics

isResponsive

{
  "value": true | false,
  "type": "boolean",
  "name": "isResponsive",
  "isArray": false
}

isNoIndex

{
  "value": true | false,
  "type": "boolean",
  "name": "isNoIndex",
  "isArray": false
}

internalLinks

{
  value: [{
    href: "https://stackoverflow.com",
    listeners: [{
      type: "click",
      useCapture: false,
      passive: false,
      once: false,
      scriptId: "12",
      lineNumber: 2,
      columnNumber: 9085
    }],
    text: " Stack Overflow ",
    healthy: true
  }],
  type: "object",
  name: "internalLinks",
  isArray: true
}

performanceMetrics

{
  value: [{
      name: "first-paint",
      entryType: "paint",
      startTime: 1171.500000054948,
      duration: 0
    },
    {
      name: "first-contentful-paint",
      entryType: "paint",
      startTime: 1171.500000054948,
      duration: 0
    }
  ],
  type: "object",
  name: "internalLinks",
  isArray: true
}

PerformanceEntry: https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry

tfIdfScore

{
  value: [{
      term: "http",
      tf: 22,
      idf: 0.3068528194400547,
      tfidf: 6.750762027681204
    },
    {
      term: "request",
      tf: 22,
      idf: 0.3068528194400547,
      tfidf: 6.750762027681204
    },
    {
      term: "status",
      tf: 19,
      idf: 0.3068528194400547,
      tfidf: 5.830203569361039
    }
  ],
  type: "object",
  name: "internalLinks",
  isArray: true
}

tfIdfTerm: https://github.com/NaturalNode/natural#tf-idf

responseStatus

{
  "value": 200,
  "type": "number",
  "name": "responseStatus",
  "isArray": false
}

schemaOrg

{
  value: {
    "microdata": {
      "Product": [
        {
          "@context": "http://schema.org/",
          "@type": "Product",
          "brand": "ACME",
          "name": "Executive Anvil",
          "image": "anvil_executive.jpg",
          "description": "Sleeker than ACME's Classic Anvil, the\n    Executive Anvil is perfect for the business traveler\n    looking for something to drop from a height.",
          "mpn": "925872",
          "aggregateRating": {
            "@context": "http://schema.org/",
            "@type": "AggregateRating",
            "ratingValue": "4.4",
            "reviewCount": "89"
          },
          "offers": {
            "@context": "http://schema.org/",
            "@type": "Offer",
            "priceCurrency": "USD",
            "price": "119.99",
            "priceValidUntil": "5 November!",
            "seller": {
              "@context": "http://schema.org/",
              "@type": "Organization",
              "name": "Executive Objects"
            },
            "itemCondition": "http://schema.org/UsedCondition",
            "availability": "http://schema.org/InStock"
          }
        }
      ]
    },
    "rdfa": {},
    "jsonld": {},
    "metatags": {
      "priceCurrency": [
        "USD",
        "USD"
      ]
    }
  },
  type: "object",
  name: "schemaOrg",
  isArray: false
}

redirectChain

{
  value: [{
    url: "https://stackoverflow.com/questions/3290182/rest-http-status-codes-for-failed-validation-or-invalid-duplicate",
    status: 200,
    isRedirect: false
  }]
  type: "object",
  name: "redirectChain",
  isArray: true
}

allowedInRobotsTxt

  {
    value: {
      isAllowed: true,
      matchedAtLine: 68
    },
    type: "object",
    name: "allowedInRobotsTxt",
    isArray: false
  }

Code Documentation

If you like to read how each metric is calculated please refer to the code documentation.

High level API

High level API

Metric example: Internal links

High level API

Built With ❤️ using

  • TypeScript - JavaScript that scales
  • Puppeteer - Headless Chrome Node.js API
  • cheerio - jQuery designed specifically for the server

License

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

Acknowledgments