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.
- nodejs >=12
- yarn > 1
To install dependecies
yarn install
To build and run
yarn starts
-
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
},
...
]
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
}
responseStatus
{
"value": 200,
"type": "number",
"name": "responseStatus",
"isArray": false
}
schemaOrg
{
value: [{
@type: "Answer",
upvoteCount: "200",
text: " I recommend status code 422, "
Unprocessable Entity ". 11.2. 422 Unprocessable Entity The 422 (Unprocessable Entity) status code means the server understands the content type of the request entity (hence a 415(Unsupported Media Type) status code is inappropriate), and the syntax of the request entity is correct (thus a 400 (Bad Request) status code is inappropriate) but was unable to process the contained instructions. For example, this error condition may occur if an XML request body contains well-formed (i.e., syntactically correct), but semantically erroneous, XML instructions. ",
dateCreated: "",
url: "/a/3291292"
}]
type: "object",
name: "schemaOrg",
isArray: true
}
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
}
If you like to read how each metric is calculated please refer to the code documentation.
- TypeScript - JavaScript that scales
- Puppeteer - Headless Chrome Node.js API
- cheerio - jQuery designed specifically for the server
This project is licensed under the MIT License - see the LICENSE.md file for details
- Rachel Costello - Technical SEO, Content Manager and Author @DeepCrawl
- Alec Bertram - Reformed SEO and born-again product person