@foo-software/binoculars
v1.0.5
Published
A tool to measure web page SEO friendliness
Downloads
45
Maintainers
Readme
@foo-software/binoculars
A tool to measure web page SEO friendliness. Binoculars extends Google's Lighthouse to provide a more opinionated, SEO specific audit.
- Choice of programmatic usage or CLI.
- Run a single audit or multiple audits at once.
- Upload reports to S3 via simple configuration.
- Automatically post results as comments in GitHub via commits or pull requests (see options).
- Automatically post results in Slack (see options).
Meaningful Content
Binoculars extends Lighthouse by adding the following audits in a custom group named "Meaningful Content".
- Title Length: Title should be between 50 - 70 characters.
- Description Length: Descriptions should be between 100 - 160 characters.
- Keywords: Keyword phrases of at least 2 words should exist in the title, description and at least twice in the content of the page.
- Headings: Has at least 1
<h1>
tag and 1<h2>
tag. - Meaningful Text: Has sufficient textual content (300 characters).
- Meaningful Tag Structure: Has at least 2 different informational HTML tags of the following types:
<p>
,<li>
,<img>
,<table>
.
Metrics
Binoculars accounts for metrics from Lighthouse SEO and accessibility categories and weights them accordingly. It combines metrics from these categories with the "Meaningful Content" group detailed above. See the complete list of audits and weighting here.
Usage
Use programmatically or via CLI.
npm i @foo-software/binoculars
or
yarn @foo-software/binoculars
Programmatic Usage
const path = require('path');
const binoculars = require('@foo-software/binoculars').default;
(async () => {
const results = await binoculars({
url: 'https://www.foo.software',
// example if you have an "artifacts" directory in your root directory
outputDirectory: path.resolve('./artifacts'),
// any other options go here
});
console.log('local report', results[0].localReport);
// local report ./reports/report-1602194942162.html
console.log('score', results[0].result.categories.binocularsSeo.score);
// score 0.96
})();
CLI Usage
Arguments are represented in the options section. Any array type relies on the pipe symbol as shown with urls
in the second example below.
binoculars --url https://www.foo.software --outputDirectory ./artifacts
Use a |
when auditing multiple URLs like so:
binoculars --urls "https://www.foo.software|https://www.foo.software/register"
Options
Return Payload
binoculars
is a promise that resolves an array. The reason it resolves with an array is because options allow url
or urls
. Because a consistent return is ideal, we return an array regardless if there is only one result or more. Each array item is an object with the below payload.
Environment Variables
You can optionally provide environment variables as detailed below.
Credits
This package was brought to you by Foo - a website quality monitoring tool. Automatically test and monitor website performance, SEO and accessibility with Lighthouse. Analyze historical records of Lighthouse tests with automated monitoring. Report with confidence about SEO and performance improvements to stay on top of changes when they happen!