npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

hexo-broken-link-checker

v1.0.3

Published

Detects links that don't work, missing images and redirects.

Downloads

5

Readme

Introduction

This is a hexo plugin which detects links that don't work, missing images and redirects.

Plugin installation

Run the following command in the root directory of hexo:

npm install hexo-broken-link-checker --save

And enable the plugin in your _config.yml.

plugins:
  - hexo-broken-link-checker

Configuration

Open your _config.yml file and paste the following lines:

# hexo-broken-link-checker plugin
link_checker:
  enabled: true
  storage_dir: temp/link_checker
  silent_logs: false
  • enabled: (boolean) - Enables or disables the post inspection for links.
  • storage_dir: (string) - Where do you want the plugin to store its files.
  • silent_logs: (boolean) - If true, the logs will be placed in a log file instead of the console output.

First run

Once you have all configured, you need to create a few files that will be used by this plugin. Run the following command:

hexo link_checker setup

You'll see something link this:

If, for some reason, you execute this command twice, you'll see a warning message:

Pro Tip!

link_checker command has an alias, lc. That said, hexo link_checker [arguments] and hexo lc [arguments] are the same command.

Usage

Extracting links

First of all, make sure the plugin is enabled:

# _config.yml
link_checker:
  enabled: true

This will automatically register a hexo post filter, which is a function that processes your already rendered posts. The post filter will be called every time you run hexo generate, will extract and store all the links on your posts. Currently, hexo-broken-link-checker detects:

  • <a> tags.
  • <img> tags.
  • YouTube embedded videos.

So, as I said, run:

hexo generate

And you'll see the following messages:

Scanning links

If you have a blog with 1000 posts, and each article has 2 external links, you'll have 2000 links to extract and check. That's a lot of operations just to check for success or error HTTP Codes, and that's why the extraction and scan are two different tasks.

Once hexo generate has finished the extraction process, you can run:

hexo lc scan

This command will take every link on the storage file and will make a HTTP request to it. All results will be stored on the same storage file.

Pro Tip!

Because this command is slow and passive, you can use a cron job to check all of your links in background. For example:

# Every day at 10PM, go to my blog directory, run the scanner and only store the errors on linkchecker_error.log
0 22 * * * cd /home/me/MyBlog/ && hexo lc scan 2> linkchecker_errors.log

Checking the scan results

hexo lc show-links [options]

Options can be:

  • --filter=[all|broken|ok|redirects|unverified]: filter links by status.
  • --id=[linkID]: shows detailed info of a link.

Examples:

Checking the log files

hexo lc show-logs

The screenshot below shows the log file when you set silent_logs: true into _config.yml:

Bitdeli Badge