• Stars
    star
    227
  • Rank 169,723 (Top 4 %)
  • Language
    JavaScript
  • Created almost 10 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A node library and command line tool to test the integrity of your internal an external hyperlinks

Hyperlink

NPM version Build Status Coverage Status Dependency Status Greenkeeper badge

Detect invalid and inefficient links on your webpages. Works with local files or websites, on the command line and as a node library.

Because web performance is not only about making your own page run smoothly, but also about giving people a quick navigation out of your page.

Read some more of the thoughts behind hyperlink in Check your link rot.

Hyperlink is known to:

  • Detect broken links to internal assets
  • Detect broken links to external assets
  • Detect broken links to fragment identifiers
  • Detect missing DNS records on external links
  • Detect inefficient external links that result in a redirect chain
  • Detect miscellaneous syntax errors in your web assets
  • Detect mixed content warnings on TLS secured pages

Todo:

  • Detect inefficient redirects to internal assets
  • Autocorrect inefficient redirects in local files

Installation

$ npm install -g hyperlink

Hyperlink exposes an executable hyperlink in your npm binaries folder.

Usage

Command line usage and options:

hyperlink [options] <htmlFile(s) | url(s)>

Options:
  -h, --help         Show this help                     [default: false]
  --root             Path to your web root (will be deduced from your
                     input files if not specified)
  --canonicalroot    URI root where the project being built will be
                     deployed. Canonical URLs in local sources will be
                     resolved to local URLs
  --verbose, -v      Log all added assets and relations. VERY verbose.
  --recursive, -r    Crawl all HTML-pages linked with relative and root
                     relative links. This stays inside your domain.
  --internal, -i     Only check links to assets within your own web root

  --pretty, -p       Resolve "pretty" urls without .html extension to
                     the .html file on disk             [default: false]
  --source-maps      Verify the correctness of links to source map
                     files and sources.                 [default: false]
  --skip             Avoid running a test where the report matches the
                     given pattern
  --todo             Mark a failed tests as todo where the report
                     matches the given pattern
  --concurrency, -c  The maximum number of assets that can be loading
                     at once                               [default: 25]

Hyperlink takes any number of input files or urls. It is recommended having these urls on the same domain or be part of the same web site.

The --root option is only needed for resolving root relative urls in case you are not sending in pages located in the web root.

Common Use Cases

Checking internal URL's only

Running hyperlink path/to/index.html --canonicalroot https://deployed.website.com/ -r --internal path/to/index.html will recursively explore the internals links of your website to ensure internal integrity. It is recommended to make this a part of your build pipeline and block on errors, since any error is very likely to be actually user facing if our page is deployed.

Running hyperlink path/to/index.html --canonicalroot https://deployed.website.com/ -r path/to/index.html will recursively explore all links of your website, internal and external, to ensure that you aren't linking to external resources that have been removed or are otherwise failing. It is not recommended to block your build pipeline on a failure of external links, since they are out of your control. Run in this mode in a non-blocking way and fix the errors in the report at your leisure. It is recommended to to this regularly, since external assets can move or disappear without warning.

Using a sitemap

Hyperlink understands sitemaps, and if you have one, it is recommended to start hyperlink out from that. You might have multiple sitemaps, annotated with Sitemap:-directives in your robots.txt, in which case you can start hyperlink from your robots.txt as well. Run hyperlink path/to/robots.txt or hyperlink path/to/sitemap.xml

The following sitemap formats are supported:

Reporters

Hyperlink is using the TAP output format, which is sort of human readable, and very machine readable. Use the TAP output in your CI setup, or pipe the output through one of these awesome reporters to get improved human readability or an output Jenkins likes

These reporters are known to work well with hyperlink:

  • tap-spot: Minimal output for non-errors and human readable reports for errors marked as TODO or ERROR

Example:

$ hyperlink https://mntr.dk/ | tap-spot

Tee is a very useful program when you want to save and replay TAP outputs. In order to save the output to a file but still see the logs on stdout you might run a command line like so:

hyperlink https://mntr.dk -r | tee mntr.dk.tap | tap-spot

License

The MIT License (MIT)

Copyright (c) 2014 Peter MΓΌller [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

subfont

Command line tool to optimize your webfont loading. Aggressive subsetting based on your font use, self-hosting of Google fonts and preloading
JavaScript
1,538
star
2

fusile

A web asset precompiling file system proxy.
HTML
233
star
3

grunt-reduce

A grunt kitchen that reduces your web ingredients down to their essence for optimal serving. Bon appΓ©tit!
JavaScript
184
star
4

assetviz

Assetviz is a web application code base visualization tool. Generate a self encapsulated html-file with a force directed graph representing the assets in your project and their relations.
JavaScript
87
star
5

netlify-plugin-checklinks

Netlify build plugin check your links and asset references
JavaScript
86
star
6

netlify-plugin-subfont

Netlify build plugin to run automated web font loading optimizations on static pages
JavaScript
67
star
7

node-histogram

Javascript histogram library that gives you a data structure describing your PNG/JPEG/GIF. Works in NodeJS and any canvas supporting browser. Added bonus: Exports AMD module in the browser if require.js is loaded, otherwise falls back to exposing histogram on window.
JavaScript
62
star
8

generator-greenfield

A full and clean frontend web workflow Yeoman generator. Simple configuration, powerful preprocessing and image pipeline, livereload and a highly optimized production build output
ApacheConf
42
star
9

netlify-plugin-hashfiles

Netlify build plugin to get optimal file caching with hashed file names and immutable cache headers
JavaScript
32
star
10

express-systemjs-translate

Express middleware to speed up systemjs development loads by running translations serverside
JavaScript
28
star
11

tolk

A file reader that promises to translate non-web assets to web assets given the available transpilers. Autoprefixing, sourcemaps and all!
HTML
27
star
12

generator-npm-webapp

A full and clean frontend web workflow Yeoman generator with npm as task runner. Simple configuration, powerful preprocessing and image pipeline, livereload and a highly optimized production build output
JavaScript
16
star
13

express-compile-sass

Express middleware to compile sass in the HTTP stream
CSS
15
star
14

yify-query

Find torrent magnet links from the yify database directly from the command line or in your node modules
JavaScript
14
star
15

todomvc-challenge

Challenge: Use assetgraph to build every example app from TasteJS/TodoMVC
JavaScript
13
star
16

contentsecure

A Content Security Policy auto generator (DEPRECATED)
JavaScript
12
star
17

expush

Express with spdy push of static assets and proxy passthrough for non-static assets
JavaScript
11
star
18

pipetteur

A function to extract any colors from a string
JavaScript
11
star
19

grunt-livestyle

A static file development server with automated file watching, less/sass/jsx preprocessing, image preprocessing, autoprefixing and proxy passthrough
JavaScript
10
star
20

episode

JavaScript utility function to find tv series season and episode numbers from a string
JavaScript
9
star
21

synesthesia

A collection of regular expressions to match color syntax substrings from a text
JavaScript
7
star
22

svg-clock

JavaScript
7
star
23

dotfiles

Shell
7
star
24

webapp-skel

Web application skeleton directory set up for builds of webapps with Ext JS using assetgraph-builder
JavaScript
6
star
25

bower-to-jspm

Utility to help you migrate from bower to jspm. Finds packages on npm and github and generates jspm install command lines
JavaScript
6
star
26

express-legacy-csp

Downgrade content-security-policy version and fidelity to support the requesting browser
JavaScript
6
star
27

jspm-config-test

A tool to run through your jspm config and check if all modules load without errors. Helps debug missing dependencies or shims
JavaScript
5
star
28

schemes

IANA Uniform Resource Identifier (URI) Schemes list, including crowd sourced unofficial ones
JavaScript
5
star
29

webpack-assetgraph-plugin

EXPERIMENTAL! Assetgraph plugin for webpack that will include all referenced external assets in the build
JavaScript
5
star
30

buildfu

A collection of CLI tools for improving web performance optimization and building webapps
JavaScript
5
star
31

generator-webapp-assetgraph

An alternative grunt workflow leveraging the power of Assetgraph
ApacheConf
5
star
32

ambitus

A calendar interval controller
JavaScript
5
star
33

ezflix

Play video directly from eztv torrents
JavaScript
4
star
34

playify

Play movies from yify directly from the command line using torrentstream
JavaScript
4
star
35

pressable

JavaScript representations of pressable keys that aren't text. These are stored in the Unicode PUA (Private Use Area) code points, 0xE000-0xF8FF.
JavaScript
4
star
36

JS-snippets

Collection of often used JS scripts
JavaScript
4
star
37

fontinspect

Trace the web font usage of a particular web page on the command line
JavaScript
4
star
38

requirejs-istanbul

RequireJS plugin to instrument modules with Istanbul for code coverage
JavaScript
3
star
39

www.browserling.com

Build system experiment using www.browserling.com as an example
JavaScript
3
star
40

LSB-improvement

LΓ₯n og Spar netbank forbedring via Chrome/Firefox userscript
JavaScript
2
star
41

coronasmitte.netlify.app

A clone of the Danish Police website limited to the sections about coronavirus.
JavaScript
2
star
42

no-build-system

A talk about build systems for EmpireJS 2014
CSS
2
star
43

mntr.dk

My blog
CSS
2
star
44

plugin-subfont-demo

Demo page for Jamstack 2020 virtual netlify-plugin-subfont
HTML
2
star
45

colorcat

Demo: CSS3 nyan cat with color adjustment inputs using One-color.js
JavaScript
2
star
46

micro.offset

Microlib to get the offset of a DOM element on the page
JavaScript
2
star
47

RevyTeX

LaTeX environment and scripts for the science revues at Copenhagen university
TeX
2
star
48

BallsBallsBalls

A quiz about balls
CSS
2
star
49

hoodie-css-local

Example setup for applying local css to remote proxied website
HTML
2
star
50

node-color-commando

Nothing but the bare naked color math. CLI owns a pretty color picker every time!
JavaScript
2
star
51

assetgraph-webbundle

Assetgraph transform to create a webbundle from the existing graph
JavaScript
2
star
52

tap-spot

Compact dot reporter for TAP output. Supports skip and todo
JavaScript
2
star
53

talk-images

Assets for a talk about auto generated image variants in development and static builds
CSS
2
star
54

svelte-a11y-tree

Svelte-based implementation of the WAI-ARIA TreeView: https://www.w3.org/TR/wai-aria-practices/#TreeView
JavaScript
2
star
55

toggleprint

Defines a hotkey that can toggle your print stylesheets to be applied on your screen for fast print stylesheet iteration
JavaScript
2
star
56

rollcount

An experiment in CSS 3d transforms for making a rolling slot counter
CSS
1
star
57

coin

Mac Donalds coin offer code generator
JavaScript
1
star
58

hyperlink-webpack

Temporary testing ground for running hyperlink on webpack docs
HTML
1
star
59

requirejs-react-hotload

JavaScript
1
star
60

assetgraph-relation-htmlimportmap

Assetgraph relation to model import maps from HTML assets
JavaScript
1
star
61

talk-transpiling-recomposed

A talk about the complexity of configuring transpilers for your web development workflows
JavaScript
1
star
62

system-plugin-jsx-bug

JavaScript
1
star
63

ren-lyrics

Lyrics and subtitles of Ren songs with translations
1
star
64

perf

JavaScript
1
star
65

jquery-datatables

HTML
1
star
66

jquery-prestige

A jQuery plugin that makes any dom element a clickable file input.
CSS
1
star
67

micro.mouse

Microlib to fix mouse event differences
JavaScript
1
star
68

companydata

JavaScript
1
star
69

node-untile

Combines map tiles into a sinlge map png
JavaScript
1
star
70

semihkirdinli.github.io

HTML
1
star
71

node-sass-evergreen

node-sass compatibility wrapper providing nodes-sass compatibility with previous major versions
JavaScript
1
star
72

yeoman-angular-reduce-example

Example repos to demonstrate how to adapt a yeoman generated angular application to use grunt-reduce as a build system
JavaScript
1
star
73

m.lanyrd.com

Repo for experimenting with build system optimization of m.lanyrd.com
Shell
1
star
74

Userscripts

Random userscripts for different websites I use
JavaScript
1
star
75

apollo-pokedex-experiment

Personal playground for learning Apollo and Graphql via Pokedex
JavaScript
1
star
76

MochaJsdomReact

Temporary repository to debug a crazy Mocha / Jsdom / React combination failure
JavaScript
1
star
77

seespee.netlify.com

Website for seespee
JavaScript
1
star
78

CloudPun

Pun web page for cloud presentation at Open Source Days
JavaScript
1
star
79

FileJS

A collection of small decoupled javascript AMD modules for file input and upload
JavaScript
1
star
80

awesome-wpo

A curated list of Web Performance Optimization. Everyone can contribute here!
1
star